이 작업은 RAC 1 Node 생성시 인스턴스 접두어에 '_인스턴스 숫자'가 붙어서 생성된 인스턴스명(예: racdb_1)을 접두어 뒤에 바로 인스턴스 숫자가 붙는 형태(예: racdb1)로 변경하기 위한 작업입니다.
반드시 필요한 작업은 아니지만, 인스턴스명을 규칙에 맞게 고쳐야할 경우 참고 바랍니다.
export ORACLE_SID=racdb_1 sqlplus / as sysdba
[oracle@racdb1 ~]$ export ORACLE_SID=racdb_1 [oracle@racdb_1 ~]$ sqlplus / as sysdba SQL*Plus: Release 11.2.0.4.0 Production on Tue Mar 5 13:17:31 2019 Copyright (c) 1982, 2013, Oracle. All rights reserved. Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - Production With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP, Data Mining and Real Application Testing options SQL>
기존 이름의 인스턴스에 sysdba 권한으로 접속합니다.
show parameter spfile create pfile='$ORACLE_HOME/dbs/initracdb1.ora' from spfile; exit
SQL> show parameter spfile NAME TYPE VALUE ------------------------------------ ----------- ------------------------------ spfile string +DATA/racdb/spfileracdb.ora SQL> create pfile='$ORACLE_HOME/dbs/initracdb1.ora' from spfile; File created. SQL> exit Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - Production With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP, Data Mining and Real Application Testing options
ASM 경로에 등록된 spfile을 참고하여 로컬 경로에 pfile을 생성합니다.
racdb1.__db_cache_size=390070272 racdb2.__db_cache_size=390070272 racdb1.__java_pool_size=4194304 racdb2.__java_pool_size=4194304 racdb1.__large_pool_size=8388608 racdb2.__large_pool_size=8388608 racdb1.__pga_aggregate_target=213909504 racdb2.__pga_aggregate_target=213909504 racdb1.__sga_target=637534208 racdb2.__sga_target=637534208 racdb1.__shared_io_pool_size=0 racdb2.__shared_io_pool_size=0 racdb1.__shared_pool_size=226492416 racdb2.__shared_pool_size=226492416 racdb1.__streams_pool_size=0 racdb2.__streams_pool_size=0
생성한 pfile의 내용을 수정합니다.
기존에 racdb_1으로 되어 있는 것을 모두 racdb1으로 수정하고, racdb_2로 되어 있는 것을 모두 racdb2로 변경합니다.
racdb2.instance_number=2 racdb1.instance_number=1
인스턴스 숫자 파라미터를 pfile에 추가합니다.
파라미터가 누락되었을 경우 "ORA-29760: instance_number parameter not specified" 에러가 발생하며, no mount 모드로 변경되지 못합니다.
srvctl stop database -d racdb -o immediate crsctl stat res -t
[oracle@racdb_1 ~]$ srvctl stop database -d racdb -o immediate [oracle@racdb_1 ~]$ crsctl stat res -t -------------------------------------------------------------------------------- NAME TARGET STATE SERVER STATE_DETAILS -------------------------------------------------------------------------------- Local Resources -------------------------------------------------------------------------------- ora.CRS.dg ONLINE ONLINE rac1 ONLINE ONLINE rac2 ora.DATA.dg ONLINE ONLINE rac1 ONLINE ONLINE rac2 ora.LISTENER.lsnr ONLINE ONLINE rac1 ONLINE ONLINE rac2 ora.RECO.dg ONLINE ONLINE rac1 ONLINE ONLINE rac2 ora.asm ONLINE ONLINE rac1 Started ONLINE ONLINE rac2 Started ora.gsd OFFLINE OFFLINE rac1 OFFLINE OFFLINE rac2 ora.net1.network ONLINE ONLINE rac1 ONLINE ONLINE rac2 ora.ons ONLINE ONLINE rac1 ONLINE ONLINE rac2 -------------------------------------------------------------------------------- Cluster Resources -------------------------------------------------------------------------------- ora.LISTENER_SCAN1.lsnr 1 ONLINE ONLINE rac1 ora.cvu 1 ONLINE ONLINE rac1 ora.oc4j 1 ONLINE ONLINE rac1 ora.rac1.vip 1 ONLINE ONLINE rac1 ora.rac2.vip 1 ONLINE ONLINE rac2 ora.racdb.db 1 OFFLINE OFFLINE Instance Shutdown 2 OFFLINE OFFLINE Instance Shutdown ora.scan1.vip 1 ONLINE ONLINE rac1
oracle 유저 권한으로 database를 중지합니다.
export ORACLE_SID=racdb1 sqlplus / as sysdba
[oracle@racdb_1 ~]$ export ORACLE_SID=racdb1 [oracle@racdb1 ~]$ sqlplus / as sysdba SQL*Plus: Release 11.2.0.4.0 Production on Tue Mar 5 13:21:51 2019 Copyright (c) 1982, 2013, Oracle. All rights reserved. Connected to an idle instance. SQL>
새로운 인스턴스 이름에 sysdba 권한으로 접속합니다.
startup nomount create SPFILE='+DATA/racdb/spfileracdb.ora' from pfile; shutdown immediate; exit
SQL> startup nomount; ORACLE instance started. Total System Global Area 636100608 bytes Fixed Size 1366500 bytes Variable Size 301991452 bytes Database Buffers 327155712 bytes Redo Buffers 5586944 bytes SQL> create SPFILE='+DATA/racdb/spfileracdb.ora' from pfile; File created. SQL> shutdown immediate; ORA-01507: database not mounted ORACLE instance shut down. SQL> exit Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - Production With the Partitioning, Real Application Clusters, OLAP, Data Mining and Real Application Testing options
Database를 no mount 모드로 전환한 후에 spfile을 생성합니다.
spfile 생성 후 database를 다시 중지합니다.
mv $ORACLE_HOME/dbs/initracdb1.ora $ORACLE_HOME/dbs/initracdb1.ora.bak
[oracle@racdb1 ~]$ mv $ORACLE_HOME/dbs/initracdb1.ora $ORACLE_HOME/dbs/initracdb1.ora.bak
인스턴스 이름을 변경하기 위해 사용한 pfile을 다른 이름으로 변경합니다.
SPFILE='+DATA/racdb/spfileracdb.ora'
SPFILE='+DATA/racdb/spfileracdb.ora'
각 노드에 pfile를 생성합니다.
pfile에는 spfile의 위치 정보를 입력합니다.
srvctl remove instance -d racdb -i racdb_1 srvctl remove instance -d racdb -i racdb_2 crsctl stat res -t
[oracle@racdb1 ~]$ srvctl remove instance -d racdb -i racdb_1 racdb 데이터베이스에서 인스턴스를 제거하겠습니까? (y/[n]) y [oracle@racdb1 ~]$ srvctl remove instance -d racdb -i racdb_2 racdb 데이터베이스에서 인스턴스를 제거하겠습니까? (y/[n]) y [oracle@racdb1 ~]$ crsctl stat res -t -------------------------------------------------------------------------------- NAME TARGET STATE SERVER STATE_DETAILS -------------------------------------------------------------------------------- Local Resources -------------------------------------------------------------------------------- ora.CRS.dg ONLINE ONLINE rac1 ONLINE ONLINE rac2 ora.DATA.dg ONLINE ONLINE rac1 ONLINE ONLINE rac2 ora.LISTENER.lsnr ONLINE ONLINE rac1 ONLINE ONLINE rac2 ora.RECO.dg ONLINE ONLINE rac1 ONLINE ONLINE rac2 ora.asm ONLINE ONLINE rac1 Started ONLINE ONLINE rac2 Started ora.gsd OFFLINE OFFLINE rac1 OFFLINE OFFLINE rac2 ora.net1.network ONLINE ONLINE rac1 ONLINE ONLINE rac2 ora.ons ONLINE ONLINE rac1 ONLINE ONLINE rac2 -------------------------------------------------------------------------------- Cluster Resources -------------------------------------------------------------------------------- ora.LISTENER_SCAN1.lsnr 1 ONLINE ONLINE rac1 ora.cvu 1 ONLINE ONLINE rac1 ora.oc4j 1 ONLINE ONLINE rac1 ora.rac1.vip 1 ONLINE ONLINE rac1 ora.rac2.vip 1 ONLINE ONLINE rac2 ora.racdb.db 1 OFFLINE OFFLINE Instance Shutdown ora.scan1.vip 1 ONLINE ONLINE rac1
기존의 인스턴스를 클러스터에서 제거합니다.
srvctl add instance -d racdb -i racdb1 -n rac1 srvctl add instance -d racdb -i racdb2 -n rac2 srvctl start database -d racdb crsctl stat res -t
[oracle@racdb1 ~]$ srvctl add instance -d racdb -i racdb1 -n rac1 [oracle@racdb1 ~]$ srvctl add instance -d racdb -i racdb2 -n rac2 [oracle@racdb1 ~]$ srvctl start database -d racdb [oracle@racdb1 ~]$ crsctl stat res -t -------------------------------------------------------------------------------- NAME TARGET STATE SERVER STATE_DETAILS -------------------------------------------------------------------------------- Local Resources -------------------------------------------------------------------------------- ora.CRS.dg ONLINE ONLINE rac1 ONLINE ONLINE rac2 ora.DATA.dg ONLINE ONLINE rac1 ONLINE ONLINE rac2 ora.LISTENER.lsnr ONLINE ONLINE rac1 ONLINE ONLINE rac2 ora.RECO.dg ONLINE ONLINE rac1 ONLINE ONLINE rac2 ora.asm ONLINE ONLINE rac1 Started ONLINE ONLINE rac2 Started ora.gsd OFFLINE OFFLINE rac1 OFFLINE OFFLINE rac2 ora.net1.network ONLINE ONLINE rac1 ONLINE ONLINE rac2 ora.ons ONLINE ONLINE rac1 ONLINE ONLINE rac2 -------------------------------------------------------------------------------- Cluster Resources -------------------------------------------------------------------------------- ora.LISTENER_SCAN1.lsnr 1 ONLINE ONLINE rac1 ora.cvu 1 ONLINE ONLINE rac1 ora.oc4j 1 ONLINE ONLINE rac1 ora.rac1.vip 1 ONLINE ONLINE rac1 ora.rac2.vip 1 ONLINE ONLINE rac2 ora.racdb.db 1 ONLINE ONLINE rac1 Open 2 ONLINE ONLINE rac2 Open ora.scan1.vip 1 ONLINE ONLINE rac1
새로운 인스턴스명으로 인스턴스를 추가하고 database를 기동합니다.