Tuesday, 23 May 2017

Configuration Document - SAN Storage Migration for Oracle 11g RAC database with ASM
SAN Storage Migration for Oracle 11g RAC database with ASM
Introduction
We have a requirement to migrate our Storage from SORCE to TARGET as our organization migrating all our storage to TARGET.  Presently we have (NAME) storage. We have RAC database.
We prepared and implemented the below plan to achieve our migration.
Solution
Following steps needs to be executed to fulfill this requirement.
Cluster DB server Details
1: - Node 1 (5 GB RAM,60 GB HDD,1 Core) (OEL5.4)
2: - Node 2 (5 GB RAM,60 GB HDD,1 Core) (OEL5.4)
3: -  Storage (Software SAN) (Openfiler) (1 GB RAM,10+100 GB HDD,1 Core)
Before Migration 
·         Please note down the server configuration and also take the backup.
·         Note the server configuration and OS details.
·         Stop the application.
·         Backup the databases.
·         Make sure the corresponding hardware infrastructure (Eg: Host HBA, Storage Switches) is in place before migration.
·         Make sure that the storage has enough space to fit the legacy storage data.
·         Create the number of volumes and their sizes to be equal or greater on the storage.
·         Make sure that the new volumes are discovered, multipath is configured in the target nodes.
·         New Raw devices are configured and ASM stamping is done for the disks wherever appropriate.
·         Appropriate permissions set for the newly discovered Volumes.
Oracle RAC Database Cluster includes the below critical components.
·         Votedisk : The voting disk is a file that manages information about node membership.
·         OCR: It is a file that manages cluster and Oracle RAC database configuration information.
·         Datafiles : Datafiles are physical files of the operating system that store the data of all logical structures in the database.
Storage Migration of Oracle RAC database involves the following steps.
·         Migrating Oracle Cluster Registry (OCR) to the new storage device
·         Migrating Cluster heartbeat (Voting disk) to the new storage device
·         Migrating Database to the new storage.
Backup procedure for OCR, Voting Disk and Data
Before migrating the data to a new Storage, it is always recommended to backup the critical components of Oracle RAC using the below mentioned steps.
OCR Backup
Below command will help you to check backups
[root@rac1 ~]# ocrconfig -showbackup
 
rac1     2016/07/14 12:18:09    
 /u01/app/11.2.0/grid/cdata/rac-cluster/backup00.ocr
 
rac1     2016/07/14 08:18:06    
 /u01/app/11.2.0/grid/cdata/rac-cluster/backup01.ocr
 
rac1     2016/07/14 04:18:05     
/u01/app/11.2.0/grid/cdata/rac-cluster/backup02.ocr
 
rac1     2016/07/13 02:56:40     
/u01/app/11.2.0/grid/cdata/rac-cluster/day.ocr
 
rac1     2016/07/13 02:56:40    
 /u01/app/11.2.0/grid/cdata/rac-cluster/week.ocr
PROT-25: Manual backups for the Oracle Cluster Registry are not available
[root@rac1 ~]# ocrconfig -manualbackup
 
rac1     2016/07/14 13:15:45     
/u01/app/11.2.0/grid/cdata/rac-cluster/backup_20160714_131545.ocr
[root@rac1 ~]#

Voting Disk Backup:
Run below command to check the configured voting devices for backup.
[root@rac1 ~]# crsctl query css votedisk
##  STATE    File Universal Id                File Name Disk group
--  -----    -----------------                --------- ---------
 1. ONLINE   9366acf106e74f4bbfd6cf281ffc5b3d (ORCL:NOCR) [NOCR]
Located 1 voting disk(s).
[root@rac1 ~]#

Take a backup of any one of the above configured voting disk using the below command
root@rac1 ~]# dd if=/dev/rdsk/c0t6000402002F4550C627487C700000000d0s6
 of=/dev/rdsk/c0t6000402002F4550C627487C700000000d0s6.bkp

Database Backup:
Perform a full database backup including control files, redologs, database files, init files and password files using RMAN.


SQL> select name,TOTAL_MB,FREE_MB  from  v$asm_disk;
 
NAME                             TOTAL_MB    FREE_MB
------------------------------ ---------- ----------
DATA                                38148      26293
OCR                                  9537       4018
 
SQL> SELECT name FROM v$asm_diskgroup;
 
NAME
------------------------------
ADATA
OCR_VD
 
SQL> SELECT file_name FROM dba_data_files;
 
FILE_NAME
-----------------------------------------------------
+ADATA/prod/users01.dbf
+ADATA/prod/undotbs01.dbf
+ADATA/prod/sysaux01.dbf
+ADATA/prod/system01.dbf
+ADATA/prod/undotbs02.dbf

Set up an iSCSI Target and Initiator

iscsiadm -m discovery -t st -p 147.43.0.10

#service iscsi restart

Creating  ASM disks.

# oracleasm createdisk NDATA /dev/sdc1
 
# oracleasm createdisk NOCR /dev/sdc2

Creating Diskgroup

SQL> CREATE DISKGROUP NDATA
  EXTERNAL REDUNDANCY
  DISK 'NDATA';
 
SQL>CREATE DISKGROUP NOCR
  EXTERNAL REDUNDANCY
  DISK 'NOCR';

Stop RAC Database

$srvctl stop database -d prod

Startup mount

srvctl start database -d prod -o mount

SQL> SELECT name FROM v$asm_diskgroup;
 
NAME
------------------------------
ADATA
OCR_VD
NDATA
NOCR
 
SQL>
 
 
SQL> select name,TOTAL_MB,FREE_MB  from  v$asm_disk;
 
NAME                             TOTAL_MB    FREE_MB
------------------------------ ---------- ----------
DATA                                38148      36470
OCR                                  9537       9141
NDATA                               28610      28515
NOCR                                 9538       9443
 

Make a copy the Oracle ASM database file to be moved.

[oracle@rac1 ~]$ rman target /
 
RMAN> COPY DATAFILE '+ADATA/prod/system01.dbf' TO '+NDATA';
RMAN> COPY DATAFILE '+ADATA/prod/users01.dbf' TO '+NDATA';
RMAN> COPY DATAFILE '+ADATA/prod/undotbs01.dbf' TO '+NDATA';
RMAN> COPY DATAFILE '+ADATA/prod/sysaux01.dbf' TO '+NDATA';
RMAN> COPY DATAFILE '+ADATA/prod/undotbs02.dbf' TO '+NDATA';

Alter the Database

SQL> ALTER DATABASE RENAME FILE '+ADATA/prod/system01.dbf' TO 
'+NDATA/prod/datafile/system.256.917015899' ;
 
Database altered.
 
SQL> ALTER DATABASE RENAME FILE '+ADATA/prod/users01.dbf' TO 
'+NDATA/prod/datafile/users.257.917016043';
 
Database altered.
 
SQL> ALTER DATABASE RENAME FILE '+ADATA/prod/undotbs01.dbf' TO 
'+NDATA/prod/datafile/undotbs1.258.917016077';
 
Database altered.
 
SQL> ALTER DATABASE RENAME FILE '+ADATA/prod/sysaux01.dbf' TO 
'+NDATA/prod/datafile/sysaux.259.917016145';
 
Database altered.
 
SQL> ALTER DATABASE RENAME FILE '+ADATA/prod/undotbs02.dbf' TO 
'+NDATA/prod/datafile/undotbs2.260.917016877';
 
Database altered.


Switch Datafiles by RMAN

[oracle@rac1 ~]$ rman target /
 
Recovery Manager: Release 11.2.0.3.0 - Production on Tue Jul 12 15:02:52 2016
 
Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.
 
connected to target database: PROD (DBID=275885043, not open)
 
RMAN> SWITCH DATAFILE '+NDATA/prod/datafile/system.256.917015899' TO COPY;
 
using target database control file instead of recovery catalog
datafile 1 switched to datafile copy "+NDATA/prod/datafile/system.256.917015899"
 
RMAN> SWITCH DATAFILE '+NDATA/prod/datafile/users.257.917016043' TO COPY;
 
datafile 4 switched to datafile copy "+NDATA/prod/datafile/users.257.917016043"
 
RMAN> SWITCH DATAFILE '+NDATA/prod/datafile/undotbs1.258.917016077' TO COPY;
 
datafile 3 switched to datafile copy 
"+NDATA/prod/datafile/undotbs1.258.917016077"
 
RMAN> SWITCH DATAFILE '+NDATA/prod/datafile/sysaux.259.917016145' TO COPY;
 
datafile 2 switched to datafile copy "+NDATA/prod/datafile/sysaux.259.917016145"
 
RMAN> SWITCH DATAFILE '+NDATA/prod/datafile/undotbs2.260.917016877' TO COPY;
 
datafile 5 switched to datafile copy 
"+NDATA/prod/datafile/undotbs2.260.917016877"
 
RMAN>

Recovery the new ASM database file.

RECOVER DATAFILE '+NDATA/prod/datafile/system.256.917015899’;
RECOVER DATAFILE '+NDATA/prod/datafile/users.257.917016043’;
RECOVER DATAFILE '+NDATA/prod/datafile/undotbs1.258.917016077’;
RECOVER DATAFILE '+NDATA/prod/datafile/sysaux.259.917016145’;
RECOVER DATAFILE '+NDATA/prod/datafile/undotbs2.260.917016877’;
 


Now we going to move OCR and VD

We go with the rebalance power of 11 which is full throttle because it is planned maintenance.
ALTER DISKGROUP OCR_VD add DISK 'ORCL:NOCR' NAME NOCR REBALANCE POWER 11;

NOCR is a new disk in ASM we adding this to OCR_VD and after rebalancing. We can Check rebalance status from Enterprise Manager or v$ASM_OPERATION
When rebalance completes, drop the old disks.
Delete old disk from group.
ALTER DISKGROUP OCR_VD drop DISK 'ORCL:OCR' NAME OCR REBALANCE POWER 11;

Moving the tmp tablespace.
SQL> alter tablespace temp add tempfile '+ndata/prod/datafile/temp02.dbf' 
size 1000m reuse autoextend on next 20m maxsize 5G;
 
SQL> alter tablespace temp drop datafile  '+ADATA/prod/temp01.dbf';





Creating redo log
alter database add logfile thread 1 group 5 ('+ndata/prod/datafile/redo05.log')
 size  100M;
alter database add logfile thread 1 group 6 ('+ndata/prod/datafile/redo06.log')
 size 100M;
alter database add logfile thread 1 group 7 ('+ndata/prod/datafile/redo09.log')
 size 100M;
alter database add logfile thread 1 group 8 ('+ndata/prod/datafile/redo10.log')
 size 100M;

delete the old redo log
alter database drop logfile group 1;
alter database drop logfile group 2;
alter database drop logfile group 3;
alter database drop logfile group 4;

for the check all data moved or not go to ASMCMD
ASMCMD> lsof
DB_Name  Instance_Name  Path
+ASM     +ASM1          +nocr_vd.255.4294967295
prod     prod1          +ndata/prod/control01.ctl
prod     prod1          +ndata/prod/control02.ctl
prod     prod1          +ndata/prod/redo05.log
prod     prod1          +ndata/prod/redo06.log
prod     prod1          +ndata/prod/redo07.log
prod     prod1          +ndata/prod/redo08.log
prod     prod1          +ndata/prod/sysaux01.dbf
prod     prod1          +ndata/prod/system01.dbf
prod     prod1          +ndata/prod/temp01.dbf
prod     prod1          +ndata/prod/undotbs01.dbf
prod     prod1          +ndata/prod/undotbs02.dbf
prod     prod1          +ndata/prod/users01.dbf
ASMCMD>


Now SAN migration has been completed we can Shutdown the old SAN    

No comments:

Post a Comment