linux下oracle11204的RAC环境手工建库

42 篇文章 0 订阅
34 篇文章 0 订阅
[oracle@racnode1 ~]$ cat /etc/issue
Oracle Linux Server release 6.3

1.节点1创建pfile文件

是从现有的RAC库拷贝过来,然后做了适当修改。
注意:得去掉control_file,暂时修改cluster_database为false,确认参数db_create_file_dest有正确的ASM值。
[oracle@racnode1 dbs]$ cd $ORACLE_HOME/dbs


[oracle@racnode1 dbs]$ vi inittest1.ora
audit_file_dest='/u01/apps/oracle/admin/test/adump'
audit_trail='db'
cluster_database=false
compatible='11.2.0.4.0'
db_block_size=8192
db_create_file_dest='+DATA'
db_domain=''
db_name='test'
db_recovery_file_dest='+FRA'
db_recovery_file_dest_size=5669650432
diagnostic_dest='/u01/apps/oracle'
dispatchers='(PROTOCOL=TCP) (SERVICE=testXDB)'
test1.instance_number=1
test2.instance_number=2
open_cursors=300
pga_aggregate_target=300m
processes=1000
remote_listener='racnode-cluster-scan:1521'
remote_login_passwordfile='exclusive'
sessions=1105
sga_target=800m
test2.thread=2
test1.thread=1
test1.undo_tablespace='UNDOTBS1'
test2.undo_tablespace='UNDOTBS2'


~                                     

[oracle@racnode1 dbs]$ mkdir -p /u01/apps/oracle/admin/test/adump

2.节点1密码文件

[oracle@racnode1 dbs]$ orapwd file=orapwtest1 password=oracle entries=10

3.节点1启动到nomount

[oracle@racnode1 ~]$ export ORACLE_SID=test1
[oracle@racnode1 ~]$ sqlplus / as sysdba

SQL> startup nomount;
ORACLE instance started.


4.create database:



运行以下脚本:


CREATE DATABASE TEST
   USER SYS IDENTIFIED BY oracle
   USER SYSTEM IDENTIFIED BY oracle
   LOGFILE GROUP 1  SIZE 512M ,
           GROUP 2  SIZE 512M ,
           GROUP 3  SIZE 512M 
   MAXLOGFILES 5
   MAXLOGMEMBERS 5
   MAXLOGHISTORY 1
   MAXDATAFILES 100
   CHARACTER SET ZHS16GBK
   NATIONAL CHARACTER SET AL16UTF16
   EXTENT MANAGEMENT LOCAL
   DATAFILE SIZE 1024M autoextend on next 10m maxsize unlimited
   SYSAUX DATAFILE SIZE 600M autoextend on next 10m maxsize unlimited
   DEFAULT TABLESPACE users
      DATAFILE 
      SIZE 500M  AUTOEXTEND ON MAXSIZE UNLIMITED
   DEFAULT TEMPORARY TABLESPACE tempts1
      TEMPFILE   SIZE 100M autoextend on next 10m maxsize unlimited
   UNDO TABLESPACE UNDOTBS1 DATAFILE SIZE 200M  AUTOEXTEND ON MAXSIZE UNLIMITED;


   
确认:
SQL> select name,open_mode from V$database;


NAME
---------------------------
OPEN_MODE
------------------------------------------------------------
TEST
READ WRITE


5.添加控制文件到参数文件中:



查询:
SQL> select concat('control_files=''', concat(replace(value, ', ', ''','''), '''')) ctl_files from v$parameter where name ='control_files'; 


CTL_FILES
--------------------------------------------------------------------------------
control_files='+DATA/test/controlfile/current.280.874807987','+FRA/test/controlf
ile/current.265.874807987'
或者:
SQL> show parameter control_files 


NAME                                 TYPE
------------------------------------ ---------------------------------
VALUE
------------------------------
control_files                        string
+DATA/test/controlfile/current
.280.874807987, +FRA/test/cont
rolfile/current.265.874807987


修改inittest1.ora
[oracle@racnode1 dbs]$ vi inittest1.ora 
添加:
control_files='+DATA/test/controlfile/current.280.874807987','+FRA/test/controlfile/current.265.874807987'


6.创建数据字典:



spool /tmp/catalog.log
  
@?/rdbms/admin/catalog.sql;  
@?/rdbms/admin/catblock.sql;  
@?/rdbms/admin/catproc.sql;  
@?/rdbms/admin/catoctk.sql;  
@?/rdbms/admin/owminst.plb;  


connect system/oracle 


@?/sqlplus/admin/pupbld.sql;  
@?/sqlplus/admin/help/hlpbld.sql helpus.sql;  
spool off  


7. 创建undo表空间:undotbs2

SQL> conn /as sysdba
Connected.
SQL>  create  UNDO TABLESPACE UNDOTBS2 DATAFILE SIZE 200M  AUTOEXTEND ON MAXSIZE UNLIMITED;
   

8.参数文件修改为spfile并存放于asm

SQL>  create spfile='+DATA/TEST/spfiletest.ora' from  pfile='/u01/apps/oracle/11.2.0/db_1/dbs/inittest1.ora';


修改pfile:
[oracle@racnode1 dbs]$ more inittest1.ora
spfile='+DATA/TEST/spfiletest.ora'
重启数据库
SQL> shutdown immediate
SQL> startup


9.修改参数

SQL> alter system set cluster_database=true scope=spfile;


System altered.


10.注册到crs

[oracle@racnode1 ~]$ srvctl add database -d test -o /u01/apps/oracle/11.2.0/db_1
[oracle@racnode1 ~]$ srvctl add instance -d test -i test1 -n racnode1
[oracle@racnode1 ~]$ srvctl add instance -d test -i test2 -n racnode2 


11.节点2上添加Pfile文件

[oracle@racnode2 dbs]$ vi inittest2.ora
spfile='+DATA/TEST/spfiletest.ora'


12.为节点2添加log文件


alter database add logfile thread 2 group 4;
alter database add logfile thread 2 group 5;
alter database add logfile thread 2 group 6;
alter database enable thread 2;
说明:若忘记创建thread为2的log文件,启动时将会报错:ORA-01617: cannot mount: 2 is not a valid thread number

13.重启数据库:

[oracle@racnode1 ~]$ srvctl stop database -d test   
[oracle@racnode1 ~]$ srvctl start database -d test 
[oracle@racnode1 ~]$ srvctl status database -d test 
Instance test1 is running on node racnode1
Instance test2 is running on node racnode2

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值