Below are the steps for renaming an ASM diskgroup with database files present inside for a running database.

 

EXAMPLE:

In this article we will rename the diskgroup +DATATST to +NEWTST.  The database present inside the diskgroup is TESTDB2 .

1. Check configuration of the database:

srvctl config database -d TESTDB2

srvctl config database -d TESTDB2
Database unique name: TESTDB2
Database name: TESTDB2
Oracle home: /oracle/app/oracle/product/12.1.0.2/dbhome_1
Oracle user: oracle
Spfile: +DATATST/TESTDB2/PARAMETERFILE/spfile.268.934027789
Password file: +DATATST/TESTDB2/PASSWORD/pwdtestdb2.256.934026697
Domain:
Start options: open
Stop options: immediate
Database role: PRIMARY
Management policy: AUTOMATIC
Server pools:
Disk Groups: DATATST
Mount point paths:
Services:
Type: RAC
Start concurrency:
Stop concurrency:
OSDBA group: dba
OSOPER group: dba
Database instances: TESTDB21,TESTDB22
Configured nodes: host1,host2
Database is administrator managed

 

2. Check whether ASM instance spfile is present is that diskgroup.
srvctl config asm

 

oracle@:$ srvctl config asm
ASM home:
Password file: +MGMTDB/orapwASM
ASM listener: LISTENER

 

If asm parameter pfile is present in the diskgroup which we are planning to rename, Then different steps need to be followed, which we will show in future article.

3. Take a backup of database pfile:

SQL> show parameter pfile

NAME TYPE VALUE
———————————— ———– ——————————
spfile string +DATATST/TESTDB2/PARAMETERFILE
/spfile.268.934027789

SQL> create pfile=’/export/home/oracle/pfiletes.ora’ from spfile;

File created.

4. Modify the parameter which are pointing to old diskgroup(+DATATST to +NEWTST)

*.control_files=’+NEWTST/TESTDB2/CONTROLFILE/current.257.934026715′
*.db_create_file_dest=’+NEWTST’

5. Stop the database

srvctl stop database -d TESTDB2

6. Check the diskgroup (DATATST) status:

crsctl status resource

ora.DATATST.dg
ONLINE ONLINE host1 STABLE
ONLINE ONLINE host2 STABLE

7. Disable the HAS component ( Do ON BOTH THE NODES)

./crsctl disable has
CRS-4621: Oracle High Availability Services autostart is disabled.

8 .Unmount the diskgroup ( ON BOTH THE NODES)

asmcmd umount DATATST

9. Rename the diskgroup ( Only on one node)

renamedg phase=both dgname=DATATST newdgname=NEWTST verbose=true

$ renamedg phase=both dgname=DATATST newdgname=NEWTST verbose=true

Parsing parameters..

Parameters in effect:

Old DG name : DATATST
New DG name : NEWTST
Phases :
Phase 1
Phase 2
Discovery str : (null)
Clean : TRUE
Raw only : TRUE
renamedg operation: phase=both dgname=DATATST newdgname=NEWTST verbose=true
Executing phase 1
Discovering the group
Performing discovery with string:
Identified disk UFS:/dev/rdsk/c0t514F0C57A4E00116d0s6 with disk number:0 and timestamp (33048299 -1573311488)
Checking for hearbeat…
Re-discovering the group
Performing discovery with string:
Identified disk UFS:/dev/rdsk/c0t514F0C57A4E00116d0s6 with disk number:0 and timestamp (33048299 -1573311488)
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 /dev/rdsk/c0t514F0C57A4E00116d0s6
Modifying the header
Completed phase 2
Terminating kgfd context 1001bdc90

10. Now mount the new diskgroup ( ON BOTH THE NODES)

asmcmd mount NEWTST

asmcmd lsdg
State Type Rebal Sector Block AU Total_MB Free_MB Req_mir_free_MB Usable_file_MB Offline_disks Voting_files Name
MOUNTED EXTERN N 512 4096 1048576 204716 111057 0 111057 0 N DATAPRE/
MOUNTED EXTERN N 512 4096 1048576 20400 15782 0 15782 0 N MGMTDB/
MOUNTED EXTERN N 512 4096 1048576 204759 202496 0 202496 0 N NEWTST/
MOUNTED NORMAL N 512 4096 1048576 20400 19812 0 9906 0 Y OCRVD/

11. Mount the database pfile backup

SQL> startup nomount pfile=pfiletes.ora
ORACLE instance started.

Total System Global Area 9328132096 bytes
Fixed Size 7641912 bytes
Variable Size 6039798984 bytes
Database Buffers 3254779904 bytes
Redo Buffers 25911296 bytes

SQL> alter database mount;

Database altered.

12. Rename the databafiles from old location to new location:

SQL> select name from v$datafile;

NAME
——————————————————————————–
+DATATST/TESTDB2/DATAFILE/system.260.934026715
+DATATST/TESTDB2/DATAFILE/sysaux.261.934026717
+DATATST/TESTDB2/DATAFILE/undotbs1.262.934026719
+DATATST/TESTDB2/DATAFILE/undotbs2.264.934026727
+DATATST/TESTDB2/DATAFILE/users.265.934026729

alter database rename file ‘+DATATST/TESTDB2/DATAFILE/system.260.934026715’
to ‘+NEWTST/TESTDB2/DATAFILE/system.260.934026715’;
alter database rename file ‘+DATATST/TESTDB2/DATAFILE/sysaux.261.934026717’
to ‘+NEWTST/TESTDB2/DATAFILE/sysaux.261.934026717’;
alter database rename file ‘+DATATST/TESTDB2/DATAFILE/undotbs1.262.934026719’
to ‘+NEWTST/TESTDB2/DATAFILE/undotbs1.262.934026719’;
alter database rename file ‘+DATATST/TESTDB2/DATAFILE/undotbs2.264.934026727’
to ‘+NEWTST/TESTDB2/DATAFILE/undotbs2.264.934026727’;
alter database rename file ‘+DATATST/TESTDB2/DATAFILE/users.265.934026729’
to ‘+NEWTST/TESTDB2/DATAFILE/users.265.934026729’;

13.Rename the redolog files from old location to new location

SQL> select member from gv$Logfile;

MEMBER
——————————————————————————–
+DATATST/TESTDB2/ONLINELOG/group_1.258.934026715
+DATATST/TESTDB2/ONLINELOG/group_2.259.934026715
+DATATST/TESTDB2/ONLINELOG/group_3.266.934027789
+DATATST/TESTDB2/ONLINELOG/group_4.267.934027789

alter database rename file ‘+DATATST/TESTDB2/ONLINELOG/group_1.258.934026715’ to ‘+NEWTST/TESTDB2/ONLINELOG/group_1.258.934026715’;
alter database rename file ‘+DATATST/TESTDB2/ONLINELOG/group_2.259.934026715’ to ‘+NEWTST/TESTDB2/ONLINELOG/group_2.259.934026715’;
alter database rename file ‘+DATATST/TESTDB2/ONLINELOG/group_3.266.934027789’ to ‘+NEWTST/TESTDB2/ONLINELOG/group_3.266.934027789’;
alter database rename file ‘+DATATST/TESTDB2/ONLINELOG/group_4.267.934027789’ to ‘+NEWTST/TESTDB2/ONLINELOG/group_4.267.934027789’;

14. Rename the tempfile:

SQL> select name from v$tempfile;

NAME
————————————————————
+DATATST/TESTDB2/TEMPFILE/temp.263.934026719

SQL> alter database rename file ‘+DATATST/TESTDB2/TEMPFILE/temp.263.934026719’ to ‘+NEWTST/TESTDB2/TEMPFILE/temp.263.934026719’;

Database altered.

15. Now create spfile pointing to new

SQL> create spfile=’+NEWTST/TESTDB2/spfiletestdb2.ora’ from pfile=’/export/home/oracle/pfiletes.ora’;

File created.

16. Shutdown database

shutdown immediate;

17. Modify init file in $ORACLE_HOME/dbs location on both nodes( Pointing to new spfile location)

cat initTESTDB21.ora
SPFILE=’+NEWTST/TESTDB2/spfileTESTDB2.ora’

18. Modify database configuration with new spfile location

srvctl modify database -d TESTDB2 -spfile +NEWTST/TESTDB2/spfileTESTDB2.ora

19.Modify database configuration with new pwdfile location

srvctl modify database -d TESTDB2 -diskgroup NEWTST
21. Check the database configuration again( Make no parameter pointing to old diskgroup)
srvctl config database -d TESTDB2

Database unique name: TESTDB2
Database name: TESTDB2
Oracle home: /oracle/app/oracle/product/12.1.0.2/dbhome_1
Oracle user: oracle
Spfile: +NEWTST/TESTDB2/spfileTESTDB2.ora
Password file: +NEWTST/TESTDB2/PASSWORD/pwdtestdb2.256.934026697
Domain:
Start options: open
Stop options: immediate
Database role: PRIMARY
Management policy: AUTOMATIC
Server pools:
Disk Groups: NEWTST
Mount point paths:
Services:
Type: RAC
Start concurrency:
Stop concurrency:
OSDBA group: dba
OSOPER group: dba
Database instances: TESTDB21,TESTDB22
Configured nodes: host1,host2
Database is administrator managed

22. Now RENAME the underline disk also(OPTIONAL – available in Oracle 12c only)

Rename disk is introduced in Oracle 12c. This is an optional step. However, if you wish to rename the underlining alias diskname also, follow below steps.

 

set pagesize 200
set lines 299
col disk_name for a19
col path for a78
select a.NAME DISKGROUP_NAME , b.NAME DISK_NAME , b.path PATH from v$asm_diskgroup A , v$asm_disk b
where a.group_number=b.group_number and a.name=’&DISKGROUP_NAME’;

DISKGROUP_NAME DISK_NAME PATH
—————————— ——————- —————————————————-
NEWTST DATATST_0000 /dev/rdsk/c0t514F0C57A4E00116d0s6

We will rename the diskname DATATST_0000 to NEWTST_0000 .

Check for active connections to the diskgroup:

select a.instance_name,a.db_name,a.status from v$asm_client a, v$asm_diskgroup b
where a.group_number=b.group_number and b.name=’NEWTST’;

no rows selected

Dismount the diskgroup( ON both nodes)

SQL> alter diskgroup NEWTST dismount;

Diskgroup altered.

Mount the diskgroup in restrict mode ( ONE NODE)

SQL> alter diskgroup NEWTST mount restricted;

Diskgroup altered.

Rename the diskname:

Now dismount the diskgroup
SQL> alter diskgroup NEWTST dismount;

Diskgroup altered.

Mount the diskgroup on both the nodes:
SQL> alter diskgroup NEWTST mount;

Diskgroup altered.

23. Start the database 

srvctl start database -d TESTDB2

24. Enable HAS on both node

crsctl enable has

About The Author

Comments

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.