ASM management-how to rename diskgroup
The new diskgroup rename function is added in ASM 11.2.0.1. You can use the renamedg command to rename the created diskgroup. Before renaming, you must first dismount diskgroup.
If the renamed diskgroup is already used to store database data files, you must manually synchronize the location of the data files.
-- Check whether the current name of the ASM diskgroup is DGASMDB.
$ Su-grid
$ Sqlplus/as sysasm
SQL> select GROUP_NUMBER, name, state, type, offline_disks, ALLOCATION_UNIT_SIZE, BLOCK_SIZE, TOTAL_MB, FREE_MB from v $ asm_diskgroup;
GROUP_NUMBER name state type OFFLINE_DISKS ALLOCATION_UNIT_SIZE BLOCK_SIZE TOTAL_MB FREE_MB
---------------------------------------------------------------------------------------------------
1 dgasmdb mounted extern 0 1048576 4096 3992
-- Check the current information of the database (spfile/controlfile/datafile/redo)
Su-Oracle
$ Sqlplus/as sysdba
SQL> show parameter spfile;
NAME TYPE VALUE
-----------------------------------------------------------------------------
Spfile string + DGASMDB/asmdb/spfileasmdb. ora
SQL> show parameter control
NAME TYPE VALUE
-----------------------------------------------------------------------------
Control_files string + DGASMDB/asmdb/controlfile/current.256.856653049
SQL> select name from v $ datafile;
NAME
--------------------------------------------------------------------------------
+ DGASMDB/asmdb/datafile/system.260.856653053
+ DGASMDB/asmdb/datafile/sysaux.261.856653059
+ DGASMDB/asmdb/datafile/undotbs1.262.856653061
+ DGASMDB/asmdb/datafile/users.264.856653075
+ DGASMDB/asmdb/datafile/asm_test.dbf
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
-- Dismount diskgroup dgasmdb
$ Su-grid
$ Asmcmd umount dgasmdb
-- Recommand diskgroup. The new diskgroup name is dgasmdb_new.
$ Renamedg phase = both dgname = dgasmdb newdgname = dgasmdb_new verbose = true
Parsing parameters ..
Parameters in effect:
Old DG name: DGASMDB
New DG name: DGASMDB_NEW
Phases:
Phase 1
Phase 2
Discovery str: (null)
Clean: TRUE
Raw only: TRUE
Renamedg operation: phase = both dgname = dgasmdb newdgname = dgasmdb_new verbose = true
Executing phase 1
Discovering the group
Discovery with string:
Identified disk ASM:/opt/oracle/extapi/64/asm/orcl/1/libasm. so: ORCL: ASMDISK4G1 with disk number: 0 and timestamp (33006423 142494720)
Checking for hearbeat...
Re-discovering the group
Discovery with string:
Identified disk ASM:/opt/oracle/extapi/64/asm/orcl/1/libasm. so: ORCL: ASMDISK4G1 with disk number: 0 and timestamp (33006423 142494720)
Checking if the diskgroup is mounted or used by CSS
Checking disk number: 0
Generating configuration file ..
Completed phase 1
Executing phase 2
Looking for ORCL: ASMDISK4G1
Modifying the header
Completed phase 2
Terminating kgfd context 0x7fa6c2bee0a0
-- Mount the new diksgroup dgasmdb_new
$ Asmcmd mount dgasmdb_new
-- View the new diskgroup Information
SQL> select GROUP_NUMBER, name, state, type, offline_disks, ALLOCATION_UNIT_SIZE, BLOCK_SIZE, TOTAL_MB, FREE_MB from v $ asm_diskgroup;
GROUP_NUMBER name state type OFFLINE_DISKS ALLOCATION_UNIT_SIZE BLOCK_SIZE TOTAL_MB FREE_MB
----------------------------------------------------------------------------------------------------
1 DGASMDB_NEW mounted extern 0 1048576 4096 3992
-- Modify the configuration information of DB initialization parameters (/u01/app/oracle/product/11.2.0/dbhome_1/dbs/initasmdb. ora)
Originally: SPFILE = '+ DGASMDB/asmdb/spfileasmdb. ora'
After modification: SPFILE = '+ DGASMDB_NEW/asmdb/spfileasmdb. ora'
-- Start database nomount
Su-oracle
Sqlplus/as sysdba
Startup nomount;
-- Modify the parameters of control_files:
SQL> alter system set control_files = '+ DGASMDB_NEW/asmdb/controlfile/current.256.856653049' scope = spfile;
SQL> shutdown immediate;
SQL> startup mount;
SQL> show parameter control_files
NAME TYPE VALUE
-----------------------------------------------------------------------------
Control_files string + DGASMDB_NEW/asmdb/controlfile
/Current.256.856653049
-- Confirm that the datafile of the current record is still in the original diskgroup DGASMDB
SQL> select FILE #, name from v $ datafile;
FILE # NAME
---------- Success --------------------------------------------------------------------------------------------------------------
1 + DGASMDB/asmdb/datafile/system.260.856653053
2 + DGASMDB/asmdb/datafile/sysaux.261.856653059
3 + DGASMDB/asmdb/datafile/undotbs1.262.856653061
4 + DGASMDB/asmdb/datafile/users.264.856653075
5 + DGASMDB/asmdb/datafile/asm_test.dbf
SQL> select file #, name from v $ tempfile;
FILE # NAME
------------------------------------------------------------------------------------------
1 + DGASMDB/asmdb/tempfile/temp.263.856653061
-- Modify the datafile/tempfile location:
SQL> conn/as sysdba
SQL> ALTER DATABASE RENAME FILE '+ DGASMDB/asmdb/datafile/system.260.856653053' TO '+ DGASMDB_NEW/asmdb/datafile/system.260.856653053 ';
SQL> ALTER DATABASE RENAME FILE '+ DGASMDB/asmdb/datafile/sysaux.261.856653059' TO '+ DGASMDB_NEW/asmdb/datafile/sysaux.261.856653059 ';
SQL> ALTER DATABASE RENAME FILE '+ DGASMDB/asmdb/datafile/undotbs1.262.856653061' TO '+ DGASMDB_NEW/asmdb/datafile/undotbs1.262.856653061 ';
SQL> ALTER DATABASE RENAME FILE '+ DGASMDB/asmdb/datafile/users.264.856653075' TO '+ DGASMDB_NEW/asmdb/datafile/users.264.856653075 ';
SQL> ALTER DATABASE RENAME FILE '+ DGASMDB/asmdb/datafile/asm_test.dbf' TO '+ DGASMDB_NEW/asmdb/datafile/asm_test.dbf ';
SQL> ALTER DATABASE RENAME FILE '+ DGASMDB/asmdb/tempfile/temp.263.856653061' TO '+ DGASMDB_NEW/asmdb/tempfile/temp.263.856653061 ';
-- Confirm after modification:
SQL> select FILE #, name from v $ datafile;
FILE # NAME
---------- Success --------------------------------------------------------------------------------------------------------------
1 + DGASMDB_NEW/asmdb/datafile/system.260.856653053
2 + DGASMDB_NEW/asmdb/datafile/sysaux.261.856653059
3 + DGASMDB_NEW/asmdb/datafile/undotbs1.262.856653061
4 + DGASMDB_NEW/asmdb/datafile/users.264.856653075
5 + DGASMDB_NEW/asmdb/datafile/asm_test.dbf
-- Modify the redo log location
Alter database rename file '+ DGASMDB/asmdb/onlinelog/group_1.257.856653049' to '+ DGASMDB_NEW/asmdb/onlinelog/group_1.257.856653049 ';
Alter database rename file '+ DGASMDB/asmdb/onlinelog/group_2.258.856653051' to '+ DGASMDB_NEW/asmdb/onlinelog/group_2.258.856653051 ';
Alter database rename file '+ DGASMDB/asmdb/onlinelog/group_3.259.856653051' to '+ DGASMDB_NEW/asmdb/onlinelog/group_3.259.856653051 ';
Select * from v $ logfile;
-- Start the database
SQL> alter database open;
What is the impact on the database after the diskgroup is renamed? How to synchronize data?
Before renaming a diskgroup, you must manually dismount the disk group. Therefore, no data is modified during the rename process, so no additional synchronization is required.