Quantcast
Channel: Doyensys Allappsdba Blog..
Viewing all articles
Browse latest Browse all 1640

Rename Diskgroup having OCR , Vote File , ASM SPILE

$
0
0
Consider a setup having OCR ,Vote File and ASM SPFILE on a diskgroup. You have a requirement to rename this diskgroup."renamedg" utility can be used to rename of the diskgroup when the diskgroup is dismounted. Our diskgroup is containing vote disk and OCR so we need to use an intermediate diskgroup for storing OCR and Vote File temporarily while renaming the actual diskgroup.
Below assumptions are made :
 1. Name of Temporary diskgroup is TEST.
 2. OCR,Voting Disks and ASM SPFILE are originally stored in diskgroup CRS.
 3. Diskgroup CRS should be renamed to VOS.
 4. $ORACLE_HOME points to GRID Home.
 5. Cluster is up and running in all nodes of RAC.
1) Create a temporary diskgroup :
Login as SYSASM using SQLPLUS into ASM instance on one node and run below commands:
create diskgroup TEMP normal redundancy disk <disk_1> ,<disk_2> ,<disk_3>
attribute 'compatible.rdbms'='11.2.0.0', 'compatible.asm'='11.2.0.0', 'au_size'=<desired_au_size>;
Example:
SQL> create diskgroup TEMP normal redundancy disk 'ORCL:DISK4' ,'ORCL:DISK5' ,'ORCL:DATA4' attribute 'compatible.rdbms'='11.2.0.0', 'compatible.asm'='11.2.0.0', 'au_size'='4M';
Diskgroup created.
2) Move OCR and Vote file from <current diskgroup> to <TEMP> :
$ORACLE_HOME/bin/bin/ocrconfig -add +TEST
$ORACLE_HOME/bin/bin/ocrconfig -delete +CRS
$ORACLE_HOME/bin/crsctl replace votedisk +TEST
Example :
[root@rac1 ~]# $ORACLE_HOME/bin/ocrconfig -add +TEST
[root@rac1 ~]# date
Fri Mar 24 06:11:07 EDT 2017
[root@rac1 ~]# $ORACLE_HOME/bin/ocrconfig -delete +CRS
[root@rac1 ~]# date
Fri Mar 24 06:11:39 EDT 2017
[root@rac1 ~]# $ORACLE_HOME/bin/crsctl replace votedisk +TEST
Successful addition of voting disk 60eb341b8b744fe7bf85a5d513153bcc.
Successful deletion of voting disk 261993a31aa74fccbf7e8d14755cc9bc.
Successfully replaced voting disk group with +TEST.
CRS-4266: Voting file(s) successfully replaced
[root@rac1 ~]# date
Fri Mar 24 06:12:06 EDT 2017
[root@rac1 ~]# $ORACLE_HOME/bin/crsctl query css votedisk
##  STATE    File Universal Id                File Name Disk group
--  -----    -----------------                --------- ---------
 1. ONLINE   60eb341b8b744fe7bf85a5d513153bcc (ORCL:TEMP) [TEST]
Located 1 voting disk(s).
[root@rac1 ~]# $ORACLE_HOME/bin/ocrcheck
Status of Oracle Cluster Registry is as follows :
         Version                  :          3
         Total space (kbytes)     :     262120
         Used space (kbytes)      :       2788
         Available space (kbytes) :     259332
         ID                       : 1056661873
         Device/File Name         :      +TEST
                                    Device/File integrity check succeeded
                                    Device/File not configured
                                    Device/File not configured
                                    Device/File not configured
                                    Device/File not configured
         Cluster registry integrity check succeeded
         Logical corruption check succeeded
3) Change ASM SPFILE location from <Current diskgroup> to <TEST> diskgroup.That can be verified by below commands :
$ORACLE_HOME/bin/gpnptool get
$asmcmd spget
Example:
[oracle@rac1 ~]$ sqlplus / as sysasm
SQL> create pfile='/tmp/init.txt' from spfile;
File created.
SQL> create spfile='+TEST' from pfile='/tmp/init.txt' ;
File created.
[oracle@rac1 ~]$ asmcmd spget
+TEST/rac-cluster/asmparameterfile/registry.253.939449937
4) Restart CRS on all nodes to startup CRS using new SPFILE from TEMP diskgroup :
crsctl stop crs
crsctl start crs
5) Dismount the OLD Diskgroup on all cluster nodes:
Login as SYSASM using SQLPLUS into ASM instance:-
SQL>alter diskgroup crs dismount; -- on all node
Verify it with : asmcmd lsdg
Example:
SQL> alter diskgroup crs dismount;
Diskgroup altered.
SQL> !date
Fri Mar 24 06:26:34 EDT 2017
6) Rename OLD diskgroup to NEW diskgroup name :
renamedg phase=both dgname=DATA newdgname=CRS asm_diskstring='' verbose=true
Example :
[oracle@rac1 ~]$ renamedg phase=both dgname=CRS newdgname=VOS asm_diskstring='/dev/oracleasm/disks/*' verbose=true
Parsing parameters..
Parameters in effect:
         Old DG name       : CRS
         New DG name          : VOS
         Phases               :
                 Phase 1
                 Phase 2
         Discovery str        : /dev/oracleasm/disks/*
         Clean              : TRUE
         Raw only           : TRUE
renamedg operation: phase=both dgname=CRS newdgname=VOS asm_diskstring=/dev/oracleasm/disks/* verbose=true
Executing phase 1
Discovering the group
Performing discovery with string:/dev/oracleasm/disks/*
Identified disk UFS:/dev/oracleasm/disks/DISK8 with disk number:0 and timestamp (33050006 163859456)
Checking for hearbeat...
Re-discovering the group
Performing discovery with string:/dev/oracleasm/disks/*
Identified disk UFS:/dev/oracleasm/disks/DISK8 with disk number:0 and timestamp (33050006 163859456)
Checking if the diskgroup is mounted
Checking disk number:0
Checking if diskgroup is used by CSS
Generating configuration file..
Completed phase 1
Executing phase 2
Looking for /dev/oracleasm/disks/DISK8
Modifying the header
Completed phase 2
Terminating kgfd context 0x2b39e29690a0
SQL> set line 1000
set pages 599
col path format a30
SQL> select name,state,usable_file_mb,total_mb,free_mb,required_mirror_free_mb from v$asm_diskgroup;
NAME                           STATE       USABLE_FILE_MB   TOTAL_MB    FREE_MB REQUIRED_MIRROR_FREE_MB
------------------------------ ----------- -------------- ---------- ----------
VOS                            DISMOUNTED               0          0          0                       0
DATA                           MOUNTED               9119      12268       9119                       0
NORM1                          MOUNTED               7044      15336      14400                     312
TEST                           MOUNTED                113        509        113                       0
SQL> select name,path,group_number,header_status,total_mb,free_mb from v$asm_disk;
NAME                           PATH                           GROUP_NUMBER HEADER_STATU   TOTAL_MB    FREE_MB
------------------------------ ------------------------------ ------------ ------------
                                  ORCL:DISK8                                0 MEMBER                0          0
DISK1                          ORCL:DISK1                                2 MEMBER             3067       2274
DISK2                          ORCL:DISK2                                2 MEMBER             3067       2278
DISK3                          ORCL:DISK3                                2 MEMBER             3067       2284
DISK4                          ORCL:DISK4                                2 MEMBER             3067       2283
DISK5                          ORCL:DISK5                                3 MEMBER             5112       4800
DISK6                          ORCL:DISK6                                3 MEMBER             5112       4800
DISK7                          ORCL:DISK7                                3 MEMBER             5112       4800
TEMP                           ORCL:TEMP                                 4 MEMBER              509        113
7) Mount the renamed diskgroup on All the nodes:
Login as SYSASM using SQLPLUS into ASM instance and run below commands:
SQL>alter diskgroup VOS mount; -- on each node
Example:
SQL> alter diskgroup VOS mount;
Diskgroup altered.
SQL> select name,state,usable_file_mb,total_mb,free_mb,required_mirror_free_mb from v$asm_diskgroup;
NAME                           STATE       USABLE_FILE_MB   TOTAL_MB    FREE_MB REQUIRED_MIRROR_FREE_MB
------------------------------ ----------- -------------- ---------- ---------- -----------------------
VOS                            MOUNTED                130        494        130                       0
DATA                           MOUNTED               9119      12268       9119                       0
NORM1                          MOUNTED               7044      15336      14400                     312
TEST                           MOUNTED                113        509        113                       0
8) Move OCR and Vote file from TEMP Diskgroup to Renamed Diskgroup :
$ORACLE_HOME/bin/ocrconfig -add +VOS
$ORACLE_HOME/bin/ocrconfig -delete +TEST
$ORACLE_HOME/bin/crsctl replace votedisk +VOS
Example :
[root@rac1 ~]# $ORACLE_HOME/bin/ocrconfig -add +VOS
[root@rac1 ~]# $ORACLE_HOME/bin/ocrconfig -delete +TEST
[root@rac1 ~]# $ORACLE_HOME/bin/crsctl replace votedisk +VOS
Successful addition of voting disk 2654f89dfbe34ffcbf823d24c6502a62.
Successful deletion of voting disk 60eb341b8b744fe7bf85a5d513153bcc.
Successfully replaced voting disk group with +VOS.
CRS-4266: Voting file(s) successfully replaced
[root@rac1 ~]# date
Fri Mar 24 06:59:13 EDT 2017
9) Change ASM SPFILE location from <TEMP diskgroup> to Renamed Diskgroup:
SQL> create spfile='+VOS' from pfile='/tmp/init.txt' ;
File created.
SQL> !asmcmd spget
+VOS/rac-cluster/asmparameterfile/registry.253.939452479
10) Restart CRS on all nodes to startup CRS using new SPFILE from TEMP diskgroup :
crsctl stop crs
crsctl start crs
11) Drop the Intermediate Diskgroup TEST :
Login as SYSASM using SQLPLUS into ASM instance on one node and run below commands::
SQL>drop diskgroup test including contents;
NOTE: Diskgroup TEMP must be mounted in order to be able to drop it.You need to mount it (if it is not already mounted at CRS startup) and then run "drop diskgroup.."
Example :
SQL> drop diskgroup test including contents;
Diskgroup dropped.
12) Need to Remove the Diskgroup Resources TEMP and <OLD Diskgroup Name> from Oracle Clusterware :
srvctl remove diskgroup -g data
srvctl remove diskgroup -g TEMP
Example :-
[root@test ~]# $ORACLE_HOME/bin/srvctl remove diskgroup -g TEST
PRCR-1001 : Resource ora.TEST.dg does not exist
[root@test ~]# $ORACLE_HOME/bin/srvctl remove diskgroup -g CRS
NOTE: Normally diskgroup TEST as resource should be removed by "drop diskgroup.." command, hence you need to run above command only if the resource is not already dropped.
In case of CRS diskgroup resource you need to explicitly remove it using srvctl command as the diskgroup was just renamed not dropped.
13) Ensure ALL Cluster resources are started successfully using below sample commands :
$ORACLE_HOME/bin/crsctl stat res -init -t
$ORACLE_HOME/bin/crsctl check cluster -all
$ORACLE_HOME/bin/crsctl stat res -t

Viewing all articles
Browse latest Browse all 1640

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>