Tuesday, October 30, 2012

OCR recovery from CRS internal backup and export backup

Recovery case of OCR disk from ocr own backup.

$ crs_stat -t
Name           Type           Target    State     Host
------------------------------------------------------------
ora.ibm.db     application    ONLINE    ONLINE    labtest02
ora....m1.inst application    ONLINE    ONLINE    labtest01
ora....m2.inst application    ONLINE    ONLINE    labtest02
ora....SM1.asm application    ONLINE    ONLINE    labtest01
ora....01.lsnr application    ONLINE    ONLINE    labtest01
ora....t01.gsd application    ONLINE    ONLINE    labtest01
ora....t01.ons application    ONLINE    ONLINE    labtest01
ora....t01.vip application    ONLINE    ONLINE    labtest01
ora....SM2.asm application    ONLINE    ONLINE    labtest02
ora....02.lsnr application    ONLINE    ONLINE    labtest02
ora....t02.gsd application    ONLINE    ONLINE    labtest02
ora....t02.ons application    ONLINE    ONLINE    labtest02
ora....t02.vip application    ONLINE    ONLINE    labtest02
$
$
$ ocrcheck
Status of Oracle Cluster Registry is as follows :
         Version                  :          2
         Total space (kbytes)     :     307112
         Used space (kbytes)      :       3812
         Available space (kbytes) :     303300
         ID                       :  992671071
         Device/File Name         : /dev/rhdiskpower1
                                    Device/File integrity check succeeded
         Device/File Name         : /dev/rhdiskpower2
                                    Device/File integrity check succeeded

         Cluster registry integrity check succeeded

$ orcconfig -showbackup
ksh: orcconfig:  not found
$ ocrconfig -showbackup

labtest02     2010/02/06 11:40:44     /u01/app/oracle/product/10.2.0/crs/cdata/crs

labtest02     2010/02/06 07:40:44     /u01/app/oracle/product/10.2.0/crs/cdata/crs

labtest02     2010/02/06 03:40:43     /u01/app/oracle/product/10.2.0/crs/cdata/crs

labtest02     2010/02/05 07:40:41     /u01/app/oracle/product/10.2.0/crs/cdata/crs

labtest02     2010/01/26 04:53:33     /u01/app/oracle/product/10.2.0/crs/cdata/crs
##################

Now we format ocr disk...

$ sudo su -
Password:
#
# pwd
/
# dd if=/dev/zero of=/dev/rhdiskpower1 bs=8192 count=25000
25000+0 records in
25000+0 records out
# dd if=/dev/zero of=/dev/rhdiskpower1 bs=8192 count=25000
25000+0 records in
25000+0 records out
# dd if=/dev/zero of=/dev/rhdiskpower2 bs=8192 count=25000
25000+0 records in
25000+0 records out
######################


$ crs_stat -t
Name           Type           Target    State     Host
------------------------------------------------------------
ora.ibm.db     application    ONLINE    ONLINE    labtest02
ora....m1.inst application    ONLINE    ONLINE    labtest01
ora....m2.inst application    ONLINE    ONLINE    labtest02
ora....SM1.asm application    ONLINE    ONLINE    labtest01
ora....01.lsnr application    ONLINE    ONLINE    labtest01
ora....t01.gsd application    ONLINE    ONLINE    labtest01
ora....t01.ons application    ONLINE    ONLINE    labtest01
ora....t01.vip application    ONLINE    ONLINE    labtest01
ora....SM2.asm application    ONLINE    ONLINE    labtest02
ora....02.lsnr application    ONLINE    ONLINE    labtest02
ora....t02.gsd application    ONLINE    ONLINE    labtest02
ora....t02.ons application    ONLINE    ONLINE    labtest02
ora....t02.vip application    ONLINE    ONLINE    labtest02
$ uname -n
labtest01
$ srvctl stop listener -n labtest01
PRKH-1010 : Unable to communicate with CRS services.
  [OCR Error(Native: prsr_initCLSS:[21])]
$ crs_stat -t
CRS-0184: Cannot communicate with the CRS daemon.

$ ocrconfig -restore /u01/app/oracle/product/10.2.0/crs/cdata/crs/day.ocr
PROT-20: Insufficient permission to proceed. Require privileged user

###################
 with root privilage:-

# cd /u01/app/oracle/product/10.2.0/crs
# cd bin
# ./ocrconfig -restore /u01/app/oracle/product/10.2.0/crs/cdata/crs/day.ocr
# echo $?
0
# ./crsctl start crs
Attempting to start CRS stack
The CRS stack will be started shortly

######################

$ crs_stat -t
CRS-0184: Cannot communicate with the CRS daemon.

$  crs_stat -t
CRS-0184: Cannot communicate with the CRS daemon.

$ crs_stat -t
CRS-0184: Cannot communicate with the CRS daemon.

$ crs_stat -t
CRS-0184: Cannot communicate with the CRS daemon.

$ crs_stat -t
Name           Type           Target    State     Host
------------------------------------------------------------
ora.debs.db    application    ONLINE    ONLINE    labtest02
ora....debs.cs application    ONLINE    ONLINE    labtest01
ora....bs1.srv application    ONLINE    OFFLINE
ora....s1.inst application    ONLINE    OFFLINE
ora....s2.inst application    ONLINE    OFFLINE
ora....SM1.asm application    ONLINE    ONLINE    labtest01
ora....01.lsnr application    ONLINE    ONLINE    labtest01
ora....t01.gsd application    ONLINE    ONLINE    labtest01
ora....t01.ons application    ONLINE    ONLINE    labtest01
ora....t01.vip application    ONLINE    ONLINE    labtest01
ora....SM2.asm application    ONLINE    ONLINE    labtest02
ora....02.lsnr application    ONLINE    ONLINE    labtest02
ora....t02.gsd application    ONLINE    ONLINE    labtest02
ora....t02.ons application    ONLINE    ONLINE    labtest02
ora....t02.vip application    ONLINE    ONLINE    labtest02
ora....andh.db application    ONLINE    ONLINE    labtest01
ora....h1.inst application    ONLINE    OFFLINE
ora....h2.inst application    ONLINE    OFFLINE
$ ocrcheck
Status of Oracle Cluster Registry is as follows :
         Version                  :          2
         Total space (kbytes)     :     307112
         Used space (kbytes)      :       5128
         Available space (kbytes) :     301984
         ID                       :  992671071
         Device/File Name         : /dev/rhdiskpower1
                                    Device/File integrity check succeeded
         Device/File Name         : /dev/rhdiskpower2
                                    Device/File integrity check succeeded

         Cluster registry integrity check succeeded

$ sqlplus

SQL*Plus: Release 10.2.0.1.0 - Production on Sat Feb 6 14:44:27 2012

Copyright (c) 1982, 2005, Oracle.  All rights reserved.

Enter user-name: / as sysdba

Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bit Production
With the Partitioning, Real Application Clusters, OLAP and Data Mining options

SQL> select open_mode from v$database;

OPEN_MODE
----------
READ WRITE

SQL>

********************************************************************

From OCR export backup:

$ crs_stat -t
Name           Type           Target    State     Host
------------------------------------------------------------
ora.debs.db    application    OFFLINE   OFFLINE
ora....debs.cs application    OFFLINE   OFFLINE
ora....bs1.srv application    ONLINE    OFFLINE
ora....s1.inst application    ONLINE    OFFLINE
ora....s2.inst application    ONLINE    OFFLINE
ora....SM1.asm application    ONLINE    ONLINE    labtest01
ora....01.lsnr application    ONLINE    ONLINE    labtest01
ora....t01.gsd application    ONLINE    ONLINE    labtest01
ora....t01.ons application    ONLINE    ONLINE    labtest01
ora....t01.vip application    ONLINE    ONLINE    labtest01
ora....SM2.asm application    ONLINE    ONLINE    labtest02
ora....02.lsnr application    ONLINE    ONLINE    labtest02
ora....t02.gsd application    ONLINE    ONLINE    labtest02
ora....t02.ons application    ONLINE    ONLINE    labtest02
ora....t02.vip application    ONLINE    ONLINE    labtest02
ora....andh.db application    OFFLINE   OFFLINE
ora....h1.inst application    ONLINE    OFFLINE
ora....h2.inst application    ONLINE    OFFLINE
$


$ ocrcheck
Status of Oracle Cluster Registry is as follows :
         Version                  :          2
         Total space (kbytes)     :     307112
         Used space (kbytes)      :       5136
         Available space (kbytes) :     301976
         ID                       :  992671071
         Device/File Name         : /dev/rhdiskpower1
                                    Device/File integrity check succeeded
         Device/File Name         : /dev/rhdiskpower2
                                    Device/File integrity check succeeded

         Cluster registry integrity check succeeded

$ ls -lt /u01
total 0
drwxr-xr-x    2 oracle   oinstall        256 Jan 20 16:20 cron_script
drwxrwx---    3 oracle   oinstall        256 Jan 12 16:17 app
drwxr-xr-x    2 root     system          256 Jan  7 16:10 lost+found
$ cd /u01/app
$ ls
oracle
$ mkdir ocr
$ ls
ocr     oracle
$ ls -lt
total 0
drwxr-xr-x    2 oracle   oinstall        256 Feb  6 15:09 ocr
drwxrwx---    3 oracle   oinstall        256 Jan 12 16:17 oracle
$ cd ocr
$ pwd
/u01/app/ocr
$ ocrconfig -export /u01/app/ocr/ocr-export.dmp
PROT-20: Insufficient permission to proceed. Require privileged user
######################
# pwd
/u01/app/oracle/product/10.2.0/crs/bin
# ./ocrconfig -export /u01/app/ocr/ocr-export.dmp

# dd if=/dev/zero of=/dev/rhdiskpower1 bs=8192 count=25000
25000+0 records in
25000+0 records out
# dd if=/dev/zero of=/dev/rhdiskpower2 bs=8192 count=25000
25000+0 records in
25000+0 records out
# ./ocrconfig -import /u01/app/ocr/ocr-export.dmp
# ./crsctl start crs
Attempting to start CRS stack
The CRS stack will be started shortly

#################
$ crs_stat -t
CRS-0184: Cannot communicate with the CRS daemon.

$ crs_stat -t
Name           Type           Target    State     Host
------------------------------------------------------------
ora.debs.db    application    OFFLINE   OFFLINE
ora....debs.cs application    OFFLINE   OFFLINE
ora....bs1.srv application    ONLINE    OFFLINE
ora....s1.inst application    ONLINE    OFFLINE
ora....s2.inst application    ONLINE    OFFLINE
ora....SM1.asm application    ONLINE    ONLINE    labtest01
ora....01.lsnr application    ONLINE    ONLINE    labtest01
ora....t01.gsd application    ONLINE    ONLINE    labtest01
ora....t01.ons application    ONLINE    ONLINE    labtest01
ora....t01.vip application    ONLINE    ONLINE    labtest01
ora....SM2.asm application    ONLINE    ONLINE    labtest02
ora....02.lsnr application    ONLINE    ONLINE    labtest02
ora....t02.gsd application    ONLINE    ONLINE    labtest02
ora....t02.ons application    ONLINE    ONLINE    labtest02
ora....t02.vip application    ONLINE    ONLINE    labtest02
ora....andh.db application    OFFLINE   OFFLINE
ora....h1.inst application    ONLINE    OFFLINE
ora....h2.inst application    ONLINE    OFFLINE