Rename RAC dbname and GI diskgroup name
3 YEARS AGO ORACLE VIEWED 41 TIMES.
Customer wants to use Oracle OEM to manage all the database RACs, due to unoptimized plan of installation, they want to standardize naming conversion of DBNAME and diskgroup name, with NID utility, it's easy to modify the database name, but modify diskgroup name is a little bit complicated.
1. Modify DBNAME with nid
First of all, backup is essential before any changes.
- Bring RAC database in exclusive mode
1
|
SQL> alter system set cluster_database=false scope=both;
|
- Stop the database and bring database in mount mode
1 2 3
|
$srvctl stop database -d orcl $sqlplus "/as sysdba" SQL> startup mount
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
|
<localhost:/home/oracle>$ nid target=/ dbname=ccms DBNEWID: Release 12.1.0.2.0 - Production on Thu Feb 21 11:59:50 2019 Copyright (c) 1982, 2014, Oracle and/or its affiliates. All rights reserved. Connected to database ORCL (DBID=625082333) Connected to server version 12.1.0 Control Files in database: +DATA/ORCL/CONTROLFILE/current.267.998418721 Change database ID and database name ORCL to CCMS? (Y/[N]) => y Proceeding with operation Changing database ID from 625082333 to 2262823414 Changing database name from ORCL to CCMS Control File +DATA/ORCL/CONTROLFILE/current.267.998418721 - modified Datafile +DATA/ORCL/DATAFILE/system.270.99841872 - dbid changed, wrote new name Datafile +DATA/ORCL/DATAFILE/sysaux.271.99841872 - dbid changed, wrote new name Datafile +DATA/ORCL/DATAFILE/undotbs1.272.99841872 - dbid changed, wrote new name Datafile +DATA/ORCL/DATAFILE/undotbs2.274.99841874 - dbid changed, wrote new name Datafile +DATA/ORCL/DATAFILE/users.275.99841874 - dbid changed, wrote new name Datafile +DATA/ORCL/TEMPFILE/temp.273.99841872 - dbid changed, wrote new name Control File +DATA/ORCL/CONTROLFILE/current.267.998418721 - dbid changed, wrote new name Instance shut down Database name changed to CCMS. Modify parameter file and generate a new password file before restarting. Database ID for database CCMS changed to 2262823414. All previous backups and archived redo logs for this database are unusable. Database has been shutdown, open database with RESETLOGS option. Succesfully changed database name and ID. DBNEWID - Completed succesfully.
|
- Bring database back in mount mode and modify DBNAME in database
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
|
SQL> startup mount ORACLE instance started.
Total System Global Area 3.2481E+11 bytes Fixed Size 7668016 bytes Variable Size 4.6171E+10 bytes Database Buffers 2.7703E+11 bytes Redo Buffers 1602940928 bytes ORA-01103: database name 'CCMS' in control file is not 'ORCL'
SQL> alter system set db_name=ccms scope=spfile; System altered.
|
- Open database with resetlogs option
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
|
SQL> alter database open resetlogs; Database altered. SQL> show parameter name NAME TYPE VALUE
|
1 2 3 4 5
|
SQL> create pfile='/home/oracle/pfile.ora' from spfile;
|
- Remove old database and register new database
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
|
SQL> shutdown immediate $srvctl remove database -d orcl $srvctl add database -d ccms -o $ORACLE_HOME -spfile '+DATA/ORCL/spfile.ora' -startoption OPEN -policy AUTOMATIC -v
|
2. Modify ASM diskgroup name with renamedg
- Dismount diskgroups which need to be renamed
1 2 3 4
|
$srvctl stop database -d ccms
|
- Rename DG name with
renamedg
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
|
</home/grid>$ renamedg phase=both dgname=DATA \ newdgname=DATADG asm_diskstring='/dev/asmdisk*' verbose=true Parsing parameters..
Parameters in effect:
Old DG name : DATA New DG name : DATADG Phases : Phase 1 Phase 2 Discovery str : /dev/asmdisk* Clean : TRUE Raw only : TRUE renamedg operation: phase=both dgname=DATA newdgname=DATADG asm_diskstring=/dev/asmdisk* verbose=true Executing phase 1 Discovering the group Performing discovery with string:/dev/asmdisk* Identified disk UFS:/dev/asmdisk5 with disk number:1 and timestamp (33081105 1165527040) Identified disk UFS:/dev/asmdisk4 with disk number:0 and timestamp (33081105 1165527040) Checking for hearbeat... Re-discovering the group Performing discovery with string:/dev/asmdisk* Identified disk UFS:/dev/asmdisk5 with disk number:1 and timestamp (33081105 1165527040) Identified disk UFS:/dev/asmdisk4 with disk number:0 and timestamp (33081105 1165527040) Checking if the diskgroup is mounted or used by CSS Checking disk number:1 Checking disk number:0 Generating configuration file..
ccms1.__large_pool_size=8053063680 Completed phase 1
ccms1.__data_transfer_cache_size=0 Executing phase 2 Looking for /dev/asmdisk5 Modifying the header Looking for /dev/asmdisk4 Modifying the header Completed phase 2 Terminating kgfd context 0x7f09cb8ec0a0
|
- Remove old diskgroup name in GI
1 2 3
|
SQL> alter diskgroup DATADG mount ; $srvctl modify database -db ccms -o $ORACLE_HOME -spfile '+DATADG/ORCL/spfile.ora' -diskgroup 'DATADG' $srvctl remove diskgroup -g DATA
|
- Re-create controlfile to reflect new datafile localtion
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
|
SQL> alter database backup controlfile to trace as '/home/oracle/cntl.ctl';
|
- Modify pfile to reflect new controlfile location
Don't forget to modify cluster_database=true and set db_create_file_dest to new diskgroup name.
1 2 3
|
SQL> create spfile='+DATADG/ORCL/spfile.ora' from pfile='/home/oracle/pfile.ora' $srvctl stop database -d ccms $srvctl start database -d ccms
|
3. Troubleshooting & Tips
- Open resetlogs encountered ORA-01618
1 2 3 4 5 6 7 8
|
$ srvctl start database -d hist PRCR-1079 : Failed to start resource ora.hist.db CRS-5017: The resource action "ora.hist.db start" encountered the following error: ORA-01618: redo thread 2 is not enabled - cannot mount . For details refer to "(:CLSN00107:)" in "/grid/app/grid/diag/crs/histpdb02a/crs/trace/crsd_oraagent_oracle.trc".
CRS-2674: Start of 'ora.hist.db' on 'histpdb02a' failed CRS-2632: There are no more servers to try to place resource 'ora.hist.db' on that would satisfy its placement policy
|
Solution: add logfile for thread 2, and enable thread2.
Before using renamedg, all the diskgroups must be dismounted from all nodes, and it's recommended to specify ask_disktrings parameter in the command line. Otherwise, below error maybe occur:
1
|
KFNDG-00407: Could not find disks for disk group
|
EOF