oracle版本:11.2.0.4
需求:
RAC两个节点RAC1和RAC2,分别对应实例为racdb1和racdb2,将实例名
修改为racdb_1,racdb_2
--1.停止实例名
[oracle@rac2 ~]$ srvctl status database -d racdb
Instance racdb1 is not running on node rac1
Instance racdb2 is not running on node rac2
[oracle@rac1~]$ srvctl stop instance -d racdb -i racdb1
[oracle@rac1 ~]$ srvctl stop instance -d racdb -i racdb2
--2.杀死oracle进程
在两个节点的系统检查oracle进程是否被正常枪毙 ps aux | grep ora
--3.删除再添加
[oracle@rac1 ~]$ srvctl status database -d racdb
Instance racdb1 is not running on node rac1
Instance racdb2 is not running on node rac2
--删除
srvctl remove instance -d racdb -i racdb1
srvctl remove instance -d racdb -i racdb2
--添加
srvctl add instance -d racdb -i racdb_1 -n rac1
srvctl add instance -d racdb -i racdb_2 -n rac2
--4.启动2个实例
srvctl start instance -d racdb -i racdb_1
srvctl start instance -d racdb -i racdb_2
[oracle@rac2 ~]$ srvctl status database -d racdb
Instance racdb_1 is running on node rac1
Instance racdb_2 is running on node rac2
SQL> select instance_number,instance_name from gv$instance;
INSTANCE_NUMBER INSTANCE_NAME
--------------- ----------------
2 racdb_2
1 racdb_1
SQL> show parameter instance_name;
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
instance_name string racdb_1
SQL> show parameter instance_name;
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
instance_name string racdb_2
--5.修改pfile(两个节点)
■节点1
sql>create pfile from spfile;
#cd /u01/app/oracle/product/11.2.0/db_1/dbs
#vi /u01/app/oracle/product/11.2.0/db_1/dbs/initracdb_1.ora
racdb_2.__db_cache_size=1392508928
racdb_1.__db_cache_size=1392508928
racdb_1.__java_pool_size=16777216
racdb_2.__java_pool_size=16777216
racdb_1.__large_pool_size=33554432
racdb_2.__large_pool_size=33554432
racdb_1.__oracle_base='/u01/app/oracle'#ORACLE_BASE set from environment
racdb_1.__pga_aggregate_target=1325400064
racdb_2.__pga_aggregate_target=1325400064
racdb_1.__sga_target=1962934272
racdb_2.__sga_target=1962934272
racdb_1.__shared_io_pool_size=0
racdb_2.__shared_io_pool_size=0
racdb_1.__shared_pool_size=486539264
racdb_2.__shared_pool_size=486539264
racdb_1.__streams_pool_size=0
racdb_2.__streams_pool_size=0
*.audit_file_dest='/u01/app/oracle/admin/racdb/adump'
*.audit_trail='db'
*.cluster_database=true
*.compatible='11.2.0.4.0'
*.control_files='+DATA/racdb/controlfile/current.256.901314887','+FRA/racdb/controlfile/current.256.901314889'
*.db_block_size=8192
*.db_create_file_dest='+DATA'
*.db_domain=''
*.db_name='racdb'
*.db_recovery_file_dest='+FRA'
*.db_recovery_file_dest_size=12582912000
*.diagnostic_dest='/u01/app/oracle'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=racdbXDB)'
racdb_2.instance_number=2
racdb_1.instance_number=1
*.local_listener=''
*.memory_target=3274702848
*.open_cursors=300
*.processes=150
*.remote_listener='rac-cluster.jinri.com:1521'
*.remote_login_passwordfile='exclusive'
racdb_2.thread=2
racdb_1.thread=1
racdb_1.undo_tablespace='UNDOTBS1'
racdb_2.undo_tablespace='UNDOTBS2'
sql>startup nomount pfile='/u01/app/oracle/product/11.2.0/db_1/dbs/initracdb_1.ora';
sql>create SPFILE='+DATA/racdb/spfileracdb.ora' from pfile;
#echo "SPFILE='+DATA/racdb/spfileracdb.ora'" >/u01/app/oracle/product/11.2.0/db_1/dbs/initracdb_1.ora
sql>shutdown immediate;
■节点2
#vi /u01/app/oracle/product/11.2.0/db_1/dbs/initracdb_2.ora
racdb_2.__db_cache_size=1392508928
racdb_1.__db_cache_size=1392508928
racdb_1.__java_pool_size=16777216
racdb_2.__java_pool_size=16777216
racdb_1.__large_pool_size=33554432
racdb_2.__large_pool_size=33554432
racdb_2.__oracle_base='/u01/app/oracle'#ORACLE_BASE set from environment
racdb_1.__pga_aggregate_target=1325400064
racdb_2.__pga_aggregate_target=1325400064
racdb_1.__sga_target=1962934272
racdb_2.__sga_target=1962934272
racdb_1.__shared_io_pool_size=0
racdb_2.__shared_io_pool_size=0
racdb_1.__shared_pool_size=486539264
racdb_2.__shared_pool_size=486539264
racdb_1.__streams_pool_size=0
racdb_2.__streams_pool_size=0
*.audit_file_dest='/u01/app/oracle/admin/racdb/adump'
*.audit_trail='db'
*.cluster_database=true
*.compatible='11.2.0.4.0'
*.control_files='+DATA/racdb/controlfile/current.256.901314887','+FRA/racdb/controlfile/current.256.901314889'
*.db_block_size=8192
*.db_create_file_dest='+DATA'
*.db_domain=''
*.db_name='racdb'
*.db_recovery_file_dest='+FRA'
*.db_recovery_file_dest_size=12582912000
*.diagnostic_dest='/u01/app/oracle'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=racdbXDB)'
racdb_2.instance_number=2
racdb_1.instance_number=1
*.local_listener=''
*.memory_target=3274702848
*.open_cursors=300
*.processes=150
*.remote_listener='rac-cluster.jinri.com:1521'
*.remote_login_passwordfile='exclusive'
racdb_2.thread=2
racdb_1.thread=1
racdb_1.undo_tablespace='UNDOTBS1'
racdb_2.undo_tablespace='UNDOTBS2'
sql>startup nomount pfile='/u01/app/oracle/product/11.2.0/db_1/dbs/initracdb_2.ora';
sql>create SPFILE='+DATA/racdb/spfileracdb.ora' from pfile;
#echo "SPFILE='+DATA/racdb/spfileracdb.ora'" >/u01/app/oracle/product/11.2.0/db_1/dbs/initracdb_2.ora
sql>shutdown immediate;
#srvctl config database -d racdb
Database unique name: racdb
Database name: racdb
Oracle home: /u01/app/oracle/product/11.2.0/db_1
Oracle user: oracle
Spfile: +DATA/racdb/spfileracdb.ora
Domain:
Start options: open
Stop options: immediate
Database role: PRIMARY
Management policy: AUTOMATIC
Server pools: racdb
Database instances: racdb_1,racdb_2
Disk Groups: DATA,FRA
Mount point paths:
Services:
Type: RAC
Database is administrator managed
----6.重启数据库
#srvctl stop database -d racdb
#srvctl status database -d racdb
Instance racdb_1 is not running on node rac1
Instance racdb_2 is not running on node rac2
#srvctl start database -d racdb
#srvctl status database -d racdb
Instance racdb_1 is running on node rac1
Instance racdb_2 is running on node rac2