Support Singapore

Support Singapore YOG 2010

Monday, August 4, 2014

Migrate ASM From One Storage to Another Storage


 

 

 

 

 

 

 

ORACLE ZFS ->VNX 5400 MIGRATION

 

 

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

 

 

 

Document History
Version
Author
Description of Changes
Supported / Review by
Date
Status
1.0
Elamaran Elango
First Release
 
21-Aug-2014
Draft
 

 

 

 

 

 

 

 

 

 

 

 

 

 

Contents

 


 


 


 


 


 

 

 

 


1. Purpose:


 

The purpose of the change is to virtualize the Storage used at COMPANY for the databases and especially the critical Oracle APPS/APP databases hosted in ZFS Storage. As a part of this project, LUNS will be consolidated and will be named in such a way that we should be able to identify the LUNS from all the way up from

STORAGE->HOST->DB

 

2. Audience


 

This documentation is primarily intended for Database Administrators, IT Managers who administer Database Management Systems.

3. Procedure


Component for Migrations:

1.        SPFILE

2.        CONTROL FILE

3.        VOTING DISK

4.        OCR

5.        DATAFILES

6.        REDOLOG FILES

7.        TEMP FILES

8.        ARCHIVED REDO LOG

 

This documents will cover the production TEST  since it is the first one to be migrated. All the steps have been tested in UAT.

 

We  use ASM for Orace databases.

 

 

                Current Groups at the DB Level

                ASM_ARC

ASM_DATA01

ASM_DATA02

ASM_DATA03

ASM_DATA04

ASM_DATA05

ASM_DATA06

ASM_DATA07

ASM_OCRVOTE – This is Normal Redundancy Disk Group

ASM_OCR

ASM_REDO01

New Disk Groups will be  like below.

 

                ASM_VARCH

ASM_VDATA1

ASM_VDATA2

ASM_VDATA3

ASM_VDATA4

ASM_VREDO

ASM_VOCR – This will be Normal Redundancy Disk Group.

 

 

NEW DISK GROUPS WILL BE CREATED IN TEST with External Redundancy with  AU 1 M:

 

ASM_VARCH

ASM_VDATA1

ASM_VDATA2

ASM_VDATA3

ASM_VDATA4

ASM_VREDO

Backup the Current Database :

 

To Backup the DB :

 

Make the below changes in LISTENER.ora

 

 

DONT DROP ANY REDOLOG FILES UNTIL OPENING THE DATABASE WITH RESETLOGS.

 

GRID_HOME

1. Get the service_name from DB Parameter:

2. Check the TNSNAMES.ora in the Server GRID home for the SERVICE_NAME also.

2. Get the SCAN_name from the current listener.ora

3. Add the below entry in the GRID Listener

4. Reset the sysdba password.

 

************************** cluster environment********************************

SID_LIST_LISTENER =

  (SID_LIST =

    (SID_DESC =

      (GLOBAL_DBNAME = testsrv.ww005.Company.net)   --- Service Name

      (ORACLE_HOME = /oracle/app/oracle/1120/db)

      (SID_NAME = test_1)  --- INSTANCE NAME

    )

  )

SID_LIST_LISTENER_SCAN1 =

  (SID_LIST =

    (SID_DESC =

      (GLOBAL_DBNAME = testsrv.ww005.Company.net)

      (ORACLE_HOME = /oracle/app/oracle/1120/db)

      (SID_NAME = test_1)

    )

  )

SID_LIST_LISTENER_SCAN2  =

  (SID_LIST =

    (SID_DESC =

      (GLOBAL_DBNAME = testsrv.ww005.Company.net)

      (ORACLE_HOME = /oracle/app/oracle/1120/db)

      (SID_NAME = test_1)

    )

  )

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

 

5. SRVCTL STOP SCAN_LISTENER

6. SRCTL START SCAN_LISTENER

7. Sqlplus sys@test as sysdba

 

Run the Backup script

RMAN_COLD_full from networker backup software or any software

 

1.        Create DISKGROUPS for VOTING DISKS:

Using ASMCA

 

Check the Backups for OCR :

 

                ocrconfig -showbackup

 

Verify if the backup file is correct

               

                ocrdump -backupfile backup_file_name

 

Replace the VOTING DISK

 

Change ASM Disk Group for Voting Disk to the new ASM Disk Group:

 

crsctl query css votedisk

 

+ASM_VOCRVOTE – DISKGROUP should have been created before replacing.

 

crsctl replace votedisk +ASM_VOCRVOTE

 

crsctl query css votedisk

 

REPLACE THE OCR FILE LOCATION

 

$oracle_home/bin/Ocrcheck

 

Add the  new ASM Disk Group  to the OCR Disk Group (Note that New ASM Group +ASM_VOCRVOTE must be mounted on all the nodes in the RAC)

 

ocrconfig –add +ASM_VOCRVOTE

 

 

 

After you confirm that you will no longer use the old Disk Group for OCR, you can remove the previous ASM Disk Group (ASM_OCR)

 

ocrconfig –delete +ASM_OCRVOTE

 

 

Before stopping the CRS the databases have to be stopped

 

CRCTL STOP CRS

 

CRSCTL START CRS

 

Add the new diskgroup to the cluster resources.

 

Crsctl stat  res –init –t

Crsctl check cluster –all

Crsctl stat res –t

 

Crsctl stat  res –init –t

Crsctl check cluster –all

Crsctl stat res –t

 

 

 

ASM SPFILE RELOCATION :

 

Login as «sysasm »

 

SQL> create pfile=’/export/home/oracle/initasmpfile’ from spfile ;

 

SQL>Create spfile =’+ASM_VDATA01’ from ’/export/home/oracle/initasmpfile’

 

 

5. Migrate Database


 

SPFILE MOVE:

 

 

-- Backup the spfile:

 

·         SQL> CREATE file='/export/home/oracle/asm_migration2014/inittest_beforemigration.ora' from spfile;

 

-- Backup the Control File:

 

·         SQL> Alter database backup controlfile to '+ASM_VDATA1/test/controlbackup.ctl';

·         SQL> Alter database backup controlfile to trace;

 

 Verify the backed up files for SPFILE and CONTROLFILE location

                 

-- Set the control file location to the new disk group to spfile:

 

·         SQL>ALTER SYSTEM SET CONTROL_FILES='+ASM_VDATA1/test/control01.ctl','+ASM_VDATA2/test/control02.ctl' scope =spfile sid='*';

 

----Set archive log location

·         SQL > alter system set LOG_ARCHIVE_DEST_1= 'LOCATION=+ASM_VARCH' scope=spfile sid='*'

 

--Now create the pfile from spfile to reflect the new changes.

                 

·         SQL> create pfile='/export/home/oracle/asm_migration2014/inittest_aftermigration.ora' from spfile ;

 

--Create the spfile based on step above

                 

·         SQL> create spfile='+ASM_VDATA1/test/spfiletest.ora' from  pfile='/export/home/oracle/asm_migration2014/inittest_aftermigration.ora';

               

NOTE DOWN THE LCOATION IN THE NEW ASM DISK GROUP and change the INITFILE to point to new location

 

change the SPFILE location in the cluster

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 

bash-3.2$  srvctl config database

 

bash-3.2$

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 

 

srvctl modify database -d test -p '+ASM_VDATA1/test/spfiletest.ora'

 

>>>>>>>>>>>>>>>>>>>>>>>>>>>>APPSlprd>>>>>>>>>>>>>>>>>>>>>>>>>>>>

bash-3.2$ srvctl modify database -d test -p '+ASM_VDATA1/test/spfiletest.ora'

bash-3.2$ srvctl config database -d  test

 

 

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 

 

Check – if the database starts with new spfile: - Not mandatory

 restart database

 

DATAFILES/CONTROLFILE:

 

RMAN>shutdown immediate

RMAN> STARTUP NOMOUNT- this will start with new spfile

 

RMAN > restore controlfile to '+ASM_VDATA1/test/control01.ctl' from '+ASM_VDATA1/test/controlbackup.ctl';

 

RMAN > restore controlfile to '+ASM_VDATA2/test/control02.ctl' from '+ASM_VDATA1/test/controlbackup.ctl';

 

Control files are restored :

 

Run the below to copy the file via rman to move to new storage :

 

Nohup ./RMAN_BACKUP_DG.SH  > rman_backup_dg.log &

 

 

Sample  script:

 

run {

CONFIGURE DEVICE TYPE DISK PARALLELISM 10 BACKUP TYPE TO copy; - This is to speed the backup copy

e.g

Backup as copy datafile "+ASM_DATA01/test/datafile/appsidx.256.809013267" FORMAT "+ASM_VDATA1";

Backup as copy datafile "+ASM_DATA02/test/datafile/appsidx.260.809014683" FORMAT "+ASM_VDATA2";

}

 

 

Once the backup is completed, we need to update the controlfile with the new names:

 

 

nohup ./rman_switch.sh >rman_switch.log &

 

contents of the datafile switch

 

 SWITCH DATAFILE "+ASM_DATA01/test/datafile/appsdat.270.792265887" TO COPY;

 

 

 SWITCH DATAFILE "+ASM_DATA01/test/datafile/appsdat.285.807732001" TO COPY;

 

 

 SWITCH DATAFILE "+ASM_DATA01/test/datafile/appsidx.266.792265591" TO COPY;

 

 

 SWITCH DATAFILE "+ASM_DATA01/test/datafile/appsidx.271.792265961" TO COPY;

 

 

 SWITCH DATAFILE "+ASM_DATA01/test/datafile/appsidx.272.792266033" TO COPY;

 

 

 SWITCH DATAFILE "+ASM_DATA01/test/datafile/appsidx.273.792266107" TO COPY;

 

 

Verify for errors:

 

 

 

Try to open the database:

 

SQL>recover database using backup controlfile;

 

Apply the logs if required

 

 

 

alter database open ; or resetlogs option.

 

 

.4 change  tempfile to new location

SQL> select NAME,STATUS,bytes/1024/1024/1024  size_GB from  v$tempfile;

 

SQL> ALTER TABLESPACE TEMP ADD TEMPFILE  '+ASM_VDATA4' SIZE  30g ;

SQL> ALTER TABLESPACE TEMP ADD TEMPFILE  '+ASM_VDATA1' SIZE  20g ;---- APPS

SQL> ALTER DATABASE TEMPFILE '+ASM_DATA06/test/tempfile/temp.276.826393817' drop;

SQL> ALTER DATABASE TEMPFILE '+ASM_DATA01/test/temp01.dbf' drop;

 

 

 

 

 

 

 

 

 change redo LOG LOCATION

 find out how many members in redo log :

select  a.GROUP#, b.MEMBER,a.THREAD# ,a.ARCHIVED  FROM V$LOG a, V$LOGFILE  b where a.GROUP#=b.GROUP# order by a.GROUP#;

 

 add more member

 

alter database add logfile member  '+ASM_VREDO/test/redo01.log'   to group 1;

alter database add logfile member  '+ASM_VREDO/test/redo02.log'   to group 2;

alter database add logfile member  '+ASM_VREDO/test/redo03.log'   to group 3;

alter database add logfile member  '+ASM_VREDO/test/redo04.log'   to group 4;

alter database add logfile member  '+ASM_VREDO/test/redo05.log'   to group 5;

alter database add logfile member  '+ASM_VREDO/test/redo06.log'   to group 6;

 

select  a.GROUP#, b.MEMBER,a.THREAD# ,a.ARCHIVED ,a.status FROM V$LOG a, V$LOGFILE  b where a.GROUP#=b.GROUP# order by a.GROUP#, member;

 

 

 

 

--------------------------TEST-------------------------------------------------------------------

SQL> alter database add logfile member  '+ASM_VREDO/test/redo01.log'  to group 1;

SQL> alter database add logfile member  '+ASM_VREDO/test/redo02.log'  to group 2;

SQL> alter database add logfile member  '+ASM_VREDO/test/redo03.log'  to group 3;

SQL> alter database add logfile member  '+ASM_VREDO/test/redo04.log'  to group 4;

SQL> alter database add logfile member  '+ASM_VREDO/test/redo05.log'  to group 5;

SQL> alter database add logfile member  '+ASM_VREDO/test/redo06.log'  to group 6;

 

 

 

Drop the old files :

 

backup validate check logical database ;

 

SQL> alter database drop logfile member  '+ASM_REDO01/test/redo01.log',

SQL> alter database drop logfile member  '+ASM_REDO01/test/redo02.log,

SQL> alter database drop logfile member  '+ASM_REDO01/test/redo03.log,

SQL> alter database drop logfile member  '+ASM_REDO01/test/redo04.log,

SQL> alter database drop logfile member  '+ASM_REDO01/test/redo05.log,

SQL> alter database drop logfile member  '+ASM_REDO01/test/redo06.log

 

 

backup validate check logical database ;

 

The above command will validate all the logical and physical blocks of the DB:

 

 

 

Have a nice day!!!