-
创建目录
mkdir -p /u01/app/oracle/admin/orcl/adump -
编辑参数文件
*.memory_target=512m
*.audit_file_dest='/u01/app/oracle/admin/orcl/adump'
*.audit_trail='db'
*.control_files=’+DATADG/ORCL/controlfile/control01.ctl’, ‘+DATADG/ORCL/controlfile/control02.ctl’
*.db_block_size=8192
*.db_create_file_dest='+DATADG'
*.db_domain=''
*.db_name='orcl'
*.db_recovery_file_dest='+DATADG'
*.db_recovery_file_dest_size=1G
*.diagnostic_dest='/u01/app/oracle'
*.open_cursors=300
*.processes=150
*.remote_listener='nodescan:1521'
*.remote_login_passwordfile='exclusive' -
创建ASM目录和创建spfile
-
创建spfile路径
[grid@node1 ~]$ asmcmd
ASMCMD> cd DATADG
ASMCMD> mkdir ORCL
-
开启第一个节点
[grid@node1 ~]$ sqlplus / as sysdba
SQL> create spfile='+DATADG/ORCL/spfileorcl.ora' from pfile='/tmp/1.txt';
-
创建init文件
-
节点1
vi initorcl1.ora
SPFILE='+DATADG/ORCL/spfileorcl.ora' -
节点2
vi initorcl2.ora
SPFILE='+DATADG/ORCL/spfileorcl.ora'
-
节点1
-
创建spfile路径
-
创建密码文件
cd $ORACLE_HOME/dbs
节点1:orapwd file=orapwORCL1 password=oracle
节点2:orapwd file=orapwORCL2 password=oracle -
创建DB
CREATE DATABASE orcl
USER SYS IDENTIFIED BY oracle
USER SYSTEM IDENTIFIED BY oracle
LOGFILE GROUP 1 ('+DATADG') SIZE 100M,
GROUP 2 ('+DATADG') SIZE 100M,
GROUP 3 ('+DATADG') SIZE 100M
MAXLOGFILES 5
MAXLOGMEMBERS 5
MAXLOGHISTORY 1
MAXDATAFILES 100
CHARACTER SET US7ASCII
NATIONAL CHARACTER SET AL16UTF16
EXTENT MANAGEMENT LOCAL
DATAFILE '+DATADG' SIZE 325M
SYSAUX DATAFILE '+DATADG' SIZE 325M
DEFAULT TABLESPACE users
DATAFILE '+DATADG'
SIZE 500M AUTOEXTEND ON MAXSIZE UNLIMITED
DEFAULT TEMPORARY TABLESPACE tempts1
TEMPFILE '+DATADG'
SIZE 20M
UNDO TABLESPACE undotbs1
DATAFILE '+DATADG'
SIZE 200M AUTOEXTEND ON MAXSIZE UNLIMITED; -
创建undo 和添加redo
-
UNDO
CREATE UNDO TABLESPACE UNDOTBS2 DATAFILE '+DATADG' SIZE 200M; -
REDO
ALTER DATABASE ADD LOGFILE THREAD 2 GROUP 4 '+DATADG' SIZE 100M;
ALTER DATABASE ADD LOGFILE THREAD 2 GROUP 5 '+DATADG' SIZE 100M;
ALTER DATABASE ADD LOGFILE THREAD 2 GROUP 6 '+DATADG' SIZE 100M;
-
UNDO
-
以下转单实例db到RAC DB
-
添加rac 参数
*.cluster_database=true
orcl1.instance_number=1
orcl2.instance_number=2
orcl2.thread=2
orcl1.thread=1
orcl1.undo_tablespace='UNDOTBS1'
orcl2.undo_tablespace='UNDOTBS2' -
启动第一节点
startup
ALTER DATABASE ENABLE PUBLIC THREAD 2;
-
启动第二节点数据库
startup
-
验证
select instance_name from gv$instance;
-
添加rac 参数
-
执行创建数据字典脚本
@?/rdbms/admin/catalog.sql
@?/rdbms/admin/catproc.sql
@?/rdbms/admin/catclust.sql
@?/rdbms/admin/utlrp.sql -
注册数据库到Clusterware
-
注册
srvctl add database -d orcl -o $ORACLE_HOME
srvctl add instance -d orcl -i orcl1 -n node1
srvctl add instance -d orcl -i orcl2 -n node2
srvctl enable database -d orcl
srvctl start database -d orcl
-
验证
crsctl stat res -t
-
注册
Linux 安装 Oracle 11g——手工建库(RAC)