jeudi 21 mai 2015

OCR / VOTING DISK MAINTENANCE OPERATIONS: MIGRATION FROM OCFS2 TO ASM


Introduction:

Starting with Oracle 11gR2, Oracle recommendation is to use Oracle ASM to store OCR and Voting Disks. With appropriate redundancy level of the ASM Disk Group being used, Oracle can create required number of Voting Disks as part of installation.


Be sure to:

  • Have the root password.
  • A valid spfile of ASM

One RAC with two nodes on Node_a and Node_b.
OS : Linux

Impact:

The service will be stopped; no connection to the database is possible during this operation.

I. Backups : Make sure there is a recent copy of the OCR/Voting disk before making any changes

1.1  OCR

 

As the root user:


root@Node_a # ocrconfig -manualbackup

/logiciels/oracle/grid/cdata/node-cluster/backup_20130409_145249.ocr
 

1.2  Voting

root@Node_a # dd if=/oracle/ocfs2/storage/vdsk of=vdsk_bkp

41025+0 records in
41025+0 records out
21004800 bytes (21 MB) copied, 0.526757 seconds, 39.9 MB/s
/oracle/ocfs2/storage
total 44384
-rw-r----- 1 root    dba  272756736 Apr 10 14:51 ocr
-rw-r----- 1 oragrid dba   21004800 Feb 12 09:32 vdsk
-rw-r--r-- 1 root    root  21004800 Apr 12 15:21 vdsk_bkp

II.  Preparing the ASM Disk Group: +CRS & +FRA


The approach is:

  1. Create Two ASM Diskgroup :+CRS ,+FRA     
  2. Migrate ocr, voting disks and archive logs to ASM in the new ASM disks : +CRS & +FRA

2.1 Check the status of OCR/Voting

         Version                  :          3
         Total space (kbytes)     :     262120
         Used space (kbytes)      :       3044
         Available space (kbytes) :     259076
         ID                       :  647776079
         Device/File Name         : /oracle/ocfs2/storage/ocr
                                    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 bypassed due to non-privileged user
root@Node_a # crsctl query css votedisk
##  STATE    File Universal Id                File Name Disk group
--  -----    -----------------                --------- ---------
 1. ONLINE   11d68d19685d4f20bf026eeb463d23aa (/oracle/ocfs2/storage/vdsk)
Located 1 voting disk(s).
 

2.2  Format new SAN disks

root@uvbacko890a # fdisk /dev/sdm
Device contains neither a valid DOS partition table, nor Sun, SGI or OSFdisklabel building a new DOS disklabel. Changes will remain in memory only, until you decide to write them. After that, of course, the previous
content won't be recoverable.
 
The number of cylinders for this disk is set to 1305.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
   (e.g., DOS FDISK, OS/2 FDISK)
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-1305, default 1)
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-1305, default 1305):
Using default value 1305
Command (m for help): p
 
Disk /dev/sdm: 10.7 GB, 10737418240 bytes
255 heads, 63 sectors/track, 1305 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
   Device Boot      Start         End      Blocks   Id  System
/dev/sdm1               1        1305    10482381   83  Linux
 
Command (m for help): w
The partition table has been altered!
 
Calling ioctl() to re-read partition table.
Syncing disks.
Idem for /dev/sdn
Idem for /dev/sdo
Idem for /dev/sds
 
 
On the first node:
root@Node_a# /etc/init.d/oracleasm createdisk DISK8 /dev/sdm1
Marking disk "DISK8" as an ASM disk:                       [  OK  ]
root@Node_a # /etc/init.d/oracleasm createdisk DISK9 /dev/sdn1
Marking disk "DISK9" as an ASM disk:                       [  OK  ]
root@Node_a # /etc/init.d/oracleasm createdisk DISK10 /dev/sdo1
Marking disk "DISK10" as an ASM disk:                       [  OK  ]
root@Node_a # /etc/init.d/oracleasm createdisk DISK10 /dev/sds1
 
 
Marking disk "DISK11" as an ASM disk:                       [  OK  ]
 
 
On the seconde node:
/etc/init.d/oracleasm scandisks
 
Check:
On the first:
root@Node_a # /etc/init.d/oracleasm listdisks
DISK1
DISK2
DISK3
DISK4
DISK5
DISK6
DISK7
DISK8
DISK9
DISK10
DISK11
 
 On the second:
root@Node_ba # /etc/init.d/oracleasm listdisks
DISK1
DISK2
DISK3
DISK4
DISK5
DISK6
DISK7
DISK8
DISK9
DISK10
DISK11

 

2.3 Create the ASM disk +CRS

Locate the asmca binary (for example /logiciels/oracle/grid/bin/)
cd /logiciels/oracle/grid/bin
            export DISPLAY=XXXXXXX.212:0.0
./asmca
(Normaly the disk DISK10 should have the same size as DISK8 and DISK9)

 


 
Idem for +FRA
All Disks

 


 

2.4 Check: On each node, as oragrid user

 
 
SQL> select state,name,type from v$asm_diskgroup;
 
STATE       NAME                           TYPE
----------- ------------------------------ ------
MOUNTED     DATA_ASM                       EXTERN
MOUNTED     CRS                            NORMAL
MOUNTED     FRA                            EXTERN

2.5 Check that the new disk group is mount :

On each node:
SQL> select state,name,type from v$asm_diskgroup;
STATE       NAME                           TYPE
----------- ------------------------------ ------
MOUNTED     DATA_ASM                       EXTERN
MOUNTED     CRS                            NORMAL
MOUNTED     FRA                            EXTERN


2.5 Case when a disk group is not mount

If for example on the second node, the status of CRS is not MOUNT, like:
SQL> select state,name,type from v$asm_diskgroup;
STATE       NAME                           TYPE
----------- ------------------------------ ------
MOUNTED     DATA_ASM                       EXTERN
MOUNTED     FRA                            EXTERN
DISMOUNTED  CRS

Then check the status of the resource and start it:

NAME           TARGET  STATE        SERVER      STATE_DETAILS

Local Resources

ora.CRS.dg
               ONLINE  ONLINE       Node_a
               OFFLINE OFFLINE      Node_b
ora.DATA_ASM.dg
               ……
To start ora.CRS.dg on Node_b:
oragrid@Node_b:/oracle/ocfs2/storage> crsctl start resource ora.CRS.dg -n Node_b


III. OCR Disk

3.1 Add an OCRMIRROR device when only OCR device is defined:

On one node

root# ocrconfig -add +CRS


3.2 Remove the old non-ASM shared OCR

root# ocrconfig -delete /oracle/ocfs2/storage/ocr

3.3 Check the status of OCR



Status of Oracle Cluster Registry is as follows:
         Version                  :          3
         Total space (kbytes)     :     262120
         Used space (kbytes)      :       3028
         Available space (kbytes) :     259092
         ID                       :  647776079
         Device/File Name         :       +CRS
                                    Device/File integrity check succeeded
         Device/File integrity check succeeded
                                    Device/File not configured
                                    Device/File not configured
                                    Device/File not configured

         Cluster registry integrity check succeeded
         Logical corruption check succeeded

IV. Voting Disk

4.1 Check the status of the Voting disk

 
root@Node_a # crsctl query css votedisk

##  STATE    File Universal Id                File Name Disk group
--  -----    -----------------                --------- ---------
 1. ONLINE   11d68d19685d4f20bf026eeb463d23aa (/oracle/ocfs2/storage/vdsk) []
Located 1 voting disk(s).

4.2 Migrate Voting disk to ASM

root@Node_a #  crsctl replace votedisk +CRS

/logiciels/oracle/grid/log/Node_a/client

root@Node_a # crsctl replace votedisk +CRS
Successful addition of voting disk 22a1974019a04feabfddb6f6ff819926.
Successful addition of voting disk 35d5a0f35db94f07bf5774a36cae4435.
Successful addition of voting disk a09b4c45c86f4fbdbf30f0cdc0ebe446.
Successful deletion of voting disk 475d55cb7dda4f00bf32bf7b3da8cbfc.
Successfully replaced voting disk group with +CRS.
CRS-4266: Voting file(s) successfully replaced

4.3 Check the status of Voting disk

One one node, as oragrid user:

root@Node_a # crsctl query css votedisk

##  STATE    File Universal Id                File Name Disk group
--  -----    -----------------                --------- ---------
1. ONLINE   22a1974019a04feabfddb6f6ff819926 (ORCL:DISK10) [CRS]
      2. ONLINE   35d5a0f35db94f07bf5774a36cae4435 (ORCL:DISK8)  [CRS]
      3. ONLINE   a09b4c45c86f4fbdbf30f0cdc0ebe446 (ORCL:DISK9)  [CRS]
 

mardi 17 mars 2015

RMAN: backup fails ANU2503E "Backup object already exists on TSM (Doc ID 443900.1)

Problem:


Sending backups to SBT fails with the follwoing error :


RMAN-03009: failure of backup command on ORA_SBT_TAPE_1 channel at 02/19/2015 10:35:07
ORA-19506: failed to create sequential file, name="igpu49hm_1_2", parms=""
ORA-27028: skgfqcre: sbtbackup returned error
ORA-19511: Error received from media manager layer, error text:
ANU2503E Backup object '/adsmorc//igpu49hm_1_2' already exists on TSM Server.
ORA-19600: input file is backup piece (+DGFRA/my_db/backupset/2015_01_31/annnf0_arch_id0_20150131_1807_0.3915.870458935)
ORA-19601: output file is backup piece (igpu49hm_1_2)

 Investigation:


 Based on the metalink note Doc ID 443900.1 :
 The basic problem is that when perform a backup using a disk channel, which does not use TDPO at all.Then allocate a channel with "sbt_tape" and perform a backup of the 'backup recovery area'. The problem is that the name of the backup piece when going to tape will take the same name as the backup piece already on disk.

In this case, this attempted to backup the same backup piece using TDPO twice. This caused the second backup attempt to fail, since this already had an image with the same name.

Since, TDPO does not choose the image name, but rather it's determined and passed by rman. TDPO will not allow duplicate backup images to be created to prevent overwriting an existing backup.

VERITAS is unwavering on allowing a backup_id within the catalog to be overwritten or reused. It will NOT happen. 



Solution:

Use the %t backup format option , so that the TDPO backup_id that is generated is unique for each copy.
so :

 run {
 allocate channel oem_disk_backup device type disk;
 recover copy of database with tag 'ORA$OEM_LEVEL_0';
 backup incremental level 1 cumulative copies=1 for recover of copy with tag 'ORA$OEM_LEVEL_0' database;
 release channel oem_disk_backup;
 allocate channel oem_sbt_backup1 type 'SBT_TAPE' format '"MY_FORMAT"_%d_d%s_p%p_%U_%t.bkp' maxpiecesize 100G parms='ENV=(TDPO_OPTFILE=/usr/tivoli/tsm/client/oracle/bin64/tdpo.opt)';
 backup archivelog all not backed up;
 backup recovery area;
 backup backupset all not backed up since time 'SYSDATE-1';
 }
RUN


Or just to send some backupieces :

{

CONFIGURE CONTROLFILE AUTOBACKUP OFF;

BACKUP DEVICE type SBT backupset 19941,19942,19943,19944,19945,19946,19947,19948,19949,19950,19951,19952,19953,19954,19955,19956,19957,19958,19959,19960,19961,19962,
 19963,19964,19965,19966,19967,19968,19969,19970,19971,19972,19973,19974,19975,19976,19977,19978,19979,19980,19981,19982,19983,19984,19985,19986,19987,19988,19989
format="MY_FORMAT_%U" ;

}

RMAN : ORA-00245: control file backup operation failed

Problem

The RMAN backup of a database in RAC environnement fails with the error: ORA-00245: control file backup operation failed.
 

Solution

What is a snapshot controlfile  ?
A snapshot controlfile is a read consistent copy of a database controlfile which RMAN creates because the controlfile is changed constantly.

The snapshot controlfile must be on a location shared by all RAC nodes in a cluster (it must be accessable by all nodes on which instances for an RAC database can run).
 
 

RMAN> show all;

CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/apps/oracle/11202/rdb/rac/dbs/snapcf_MY_DB.f'; # default
 
 

1 . Find a shared location

for example : +DGDATA/MY_DB/CONTROLFILE/
 
2. Change the location
RMAN> CONFIGURE SNAPSHOT CONTROLFILE NAME TO '+DGDATA/MY_DB/CONTROLFILE/snapcf_MY_DB.f';

RMAN : ORA-01210: data file header is media corrupt

Problem:


Following a restore of a cold backup, we can not open the database (resetlogs) because of the error :
ORA-01210: data file header is media corrupt


ORA-01110: data file 50: '/apps/oracledata/MY_DB/indx0001/arc_event_index_069.dbf'
ORA-01122: database file 50 failed verification check
ORA-01110: data file 50:
'/apps/oracledata/MY_DB/indx0001/arc_event_index_069.dbf'
ORA-01210: data file header is media corrupt




 
 
 

Solution :

 1. Transform the database to archivelog mode to avoid


ORA-01145: offline immediate disallowed unless media recovery enabled

2. Put the datafile in offline mode



SQL> alter database datafile '/apps/oracledata/MY_DB/indx0001/arc_event_index_069.dbf' offline;

Database altered.

 


3. Move the datafile ..


SQL> !mv /apps/oracledata/ARC1EUP0/indx0001/arc_event_index_069.dbf /apps/oracledata/ARC1EUP0/indx0001/arc_event_index_069.dbf.old

 

 

4. Restore the datafile


RMAN> restore datafile 50;
Starting restore at 13-MAR-15
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=82 device type=DISK
allocated channel: ORA_DISK_2
channel ORA_DISK_2: SID=102 device type=DISK
allocated channel: ORA_DISK_3
channel ORA_DISK_3: SID=122 device type=DISK
allocated channel: ORA_DISK_4
channel ORA_DISK_4: SID=142 device type=DISK
channel ORA_DISK_1: starting datafile backup set restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_DISK_1: restoring datafile 00050 to /apps/oracledata/ARC1EUP0/indx0001/arc_event_index_069.dbf
channel ORA_DISK_1: reading from backup piece /apps/orafra/MY_DB/backupset/2015_02_20/o1_mf_nnnd0_COLD_I0_20150220_181_bggxzomh_.bkp
channel ORA_DISK_1: piece handle=/apps/orafra/MY_DB/backupset/2015_02_20/o1_mf_nnnd0_COLD_I0_20150220_181_bggxzomh_.bkp tag=COLD_I0_20150220_181
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: reading from backup piece /apps/orafra/MY_DB/backupset/2015_02_20/o1_mf_nnnd0_COLD_I0_20150220_181_bggyof1t_.bkp
channel ORA_DISK_1: piece handle=/apps/orafra/MY_DB/backupset/2015_02_20/o1_mf_nnnd0_COLD_I0_20150220_181_bggyof1t_.bkp tag=COLD_I0_20150220_181
channel ORA_DISK_1: restored backup piece 2
channel ORA_DISK_1: restore complete, elapsed time: 00:19:50
Finished restore at 13-MAR-15

 

 

 


5. Open the database


SQL> alter database open resetlogs;

Database altered.