DBA Hub

📋Steps in this guide1/17

How to rename ASM diskgroup DBACLASS

How to rename ASM diskgroup with RAC database. If datafiles are present inside ASM diskgroup i.e if you have a running RAC database inside the diskgroup . then.

oracle clusteringintermediate
by OracleDba
14 views
1

Overview

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:
2

Section 2

srvctl config database -d TESTDB2 2. Check whether ASM instance spfile is present is that diskgroup. srvctl config asm 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.

Code/Command (click line numbers to comment):

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
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

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

Section 3

3. Take a backup of database pfile: 4. Modify the parameter which are pointing to old diskgroup(+DATATST to +NEWTST)

Code/Command (click line numbers to comment):

1
2
3
4
5
6
7
8
9
10
11
12
13
14
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.

*.control_files='+NEWTST/TESTDB2/CONTROLFILE/current.257.934026715'
*.db_create_file_dest='+NEWTST'
4

Section 4

5. Stop the database 6. Check the diskgroup (DATATST) status: crsctl status resource

Code/Command (click line numbers to comment):

1
srvctl stop database -d TESTDB2
5

Section 5

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

Code/Command (click line numbers to comment):

1
2
3
4
5
6
ora.DATATST.dg
               ONLINE  ONLINE       host1               STABLE
               ONLINE  ONLINE       host2                STABLE

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

Section 6

9. Rename the diskgroup ( Only on one node) renamedg phase=both dgname=DATATST newdgname=NEWTST verbose=true 10. Now mount the new diskgroup ( ON BOTH THE NODES)

Code/Command (click line numbers to comment):

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
asmcmd umount  DATATST

$ 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
7

Section 7

11. Mount the database pfile backup 12. Rename the databafiles from old location to new location:

Code/Command (click line numbers to comment):

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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/

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.
8

Section 8

13.Rename the redolog files from old location to new location 14. Rename the tempfile:

Code/Command (click line numbers to comment):

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
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';

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';
9

Section 9

15. Now create spfile pointing to new 16. Shutdown database

Code/Command (click line numbers to comment):

1
2
3
4
5
6
7
8
9
10
11
12
13
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.

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

File created.
10

Section 10

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

Code/Command (click line numbers to comment):

1
2
3
4
shutdown immediate;

cat initTESTDB21.ora
SPFILE='+NEWTST/TESTDB2/spfileTESTDB2.ora'
11

Section 11

19.Modify database configuration with new pwdfile location 20. Modify database configuration with new DISKGROUP

Code/Command (click line numbers to comment):

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

srvctl  modify database -d TESTDB2 -pwfile +NEWTST/TESTDB2/PASSWORD/pwdtestdb2.256.934026697
12

Section 12

21. Check the database configuration again( Make no parameter pointing to old diskgroup) 22. Now RENAME the underline disk also(OPTIONAL – available in Oracle 12c only)

Code/Command (click line numbers to comment):

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
srvctl  modify database -d TESTDB2 -diskgroup NEWTST

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
13

Section 13

Rename disk is introduced in oracle 12c. This is an optional steps. However if you wish to rename the underlining alias diskname also , follow below steps. We will rename the diskname DATATST_0000 to NEWTST_0000 . Check for active connections to the diskgroup:

Code/Command (click line numbers to comment):

1
2
3
4
5
6
7
8
9
10
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
14

Section 14

Dismount the diskgroup( ON both nodes) Mount the diskgroup in restrict mode ( ONE NODE)

Code/Command (click line numbers to comment):

1
2
3
4
5
6
7
8
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

SQL> alter diskgroup NEWTST dismount;

Diskgroup altered.
15

Section 15

Rename the diskname: Now dismount the diskgroup

Code/Command (click line numbers to comment):

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
SQL>  alter diskgroup NEWTST  mount restricted;

Diskgroup altered.

SQL> alter diskgroup NEWTST rename disk 'DATATST_0000' to 'NEWTST_0000';

Diskgroup altered.

SQL>  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';

Enter value for diskgroup_name: NEWTST
old   2: where a.group_number=b.group_number and a.name='&DISKGROUP_NAME'
new   2: where a.group_number=b.group_number and a.name='NEWTST'

DISKGROUP_NAME                 DISK_NAME           PATH
------------------------------ ------------------- ------------------------------------------------------------------------------
NEWTST                         NEWTST_0000         /dev/rdsk/c0t514F0C57A4E00116d0s6
16

Section 16

Mount the diskgroup on both the nodes: 23. Start the database

Code/Command (click line numbers to comment):

1
2
3
4
5
6
7
SQL> alter diskgroup NEWTST dismount;

Diskgroup altered.

SQL> alter diskgroup NEWTST mount;

Diskgroup altered.
17

Section 17

srvctl start database -d TESTDB2 24. Enable HAS on both nodes Recommended BOOKS: Expert Oracle RAC 12c Oracle 12c for Dummies Oracle Database 12c Performance Tuning Recipes

Code/Command (click line numbers to comment):

1
crsctl enable has

Comments (0)

Please to add comments

No comments yet. Be the first to comment!