lab15b cloning disk group

Download Lab15b Cloning Disk Group

If you can't read please download the document

Upload: akhmad-afandi-bariq

Post on 28-Sep-2015

223 views

Category:

Documents


5 download

DESCRIPTION

Exadata cloning disk

TRANSCRIPT

  • ASM HANDS-ON TRAININGLab 15 Cloning An ASM Disk Group On The Same Server

    Alejandro Vargas | Principal Support ConsultantOracle Advanced Customer Services

    INDEX

    Summary ....................................................................................................................................................................... 2 Prepare The Environment ............................................................................................................................................. 4 Remove The Database From The Normal Redundancy Diskgroup ............................................................................. 5 Drop The Normal Redundancy Diskgroup .................................................................................................................... 6 Recreate the ASM Volumes .......................................................................................................................................... 9 Add ASM Disk VOLBLK4 To The FRADG Diskgroup ................................................................................................ 11 Create a New External Redundancy Diskgroup ......................................................................................................... 11 Check That The Database Is Operational ................................................................................................................... 21 Execute a Consistent Database Shutdown ................................................................................................................. 22 Create A Clone Of The Database ASM Disks ............................................................................................................ 22 Add Path To Kfed On User Root Profile ..................................................................................................................... 23 Check the headers of the copied pairs with kfed ........................................................................................................ 24 Rename The Cloned ASM Disks ................................................................................................................................ 27 Check the new headers with kfed ............................................................................................................................... 28 Connect To ASM Instance And Mount DG DATADGCLN .......................................................................................... 29 Prepare The Clone Database To Be Restarted .......................................................................................................... 30 Recreate The Controlfile And Rename The Cloned Database ................................................................................... 34

    1/37

  • ASM HANDS-ON TRAININGLab 15 Cloning An ASM Disk Group On The Same Server

    Summary

    Some customers require having several clones of the same database running on the same server. That was simple to do when the database was based on File System, and is still simple to do with the help of Rman.

    But there are very large databases, which are usually cloned using storage tools like bcv, srdf or snapshots that cannot consider Rman as a viable possibility.

    For these customers there is the possibility to implement the procedure we will test on this lab.

    These are the steps required to complete the process:

    1. Prepare a set of storage devices with enough space to hold a copy of the diskgroup to be copied2. Shutdown the source database3. Make a bit by bit copy of the source database on the target devices4. Add kfed path to the path of user root 5. Execute the rename diskgroup script6. Rename ASM disks of the cloned devices7. Rescan ASM disks8. Start the ASM instance and mount the new diskgroup9. Recreate the controlfile and rename the database based on the cloned diskgroup10.Open the clone with the resetlogs option

    On this lab we will be using several scripts located on /home/oracle/ASM-SCRIPTS/CHECK-ASM, they are available through a menu that can be invoked using the alias asmchk. You need to paste the name of the script to run on the prompt and the script will be executed, after execution you will need to press enter again to get back to the menu and again enter to exit.

    This is a very simple interface, can be taken on a disk on key or sent by email and provide you a set of useful ASM queries.

    2/37

  • ASM HANDS-ON TRAININGLab 15 Cloning An ASM Disk Group On The Same Server

    ASM checkup scripts :

    > asm_alias > asm_client > asm_dg_dsks > asm_dg_files > asm_diskgroup_compatibility2 > asm_diskgroup_compatibility > asm_diskgroup_stat > asm_disk_io > asm_disk > asm_disk_stat > asm_dsk_in_use > asm_file_path > asm_file > asm_instance > asm_operation > asm_oper > asm_rebal > asm_sga > asm_template > asm_version > chg_rebal > chk_blockdev > chkdg > chkdisk2 > crdg2 > mount_all

    Script to execute ...

    3/37

  • ASM HANDS-ON TRAININGLab 15 Cloning An ASM Disk Group On The Same Server

    Prepare The Environment

    To perform this test we will migrate our database to an external redundancy Diskgroup, as we dont have enough disks to do the move we will just remove diskgroup DATADGNR and restore the database into a new external redundancy diskgroup DATADG

    Backup The Database

    We will start the process making a fresh backup of the database

    [oracle@asmxpt ~/RMAN-SCRIPTS]$ rman target / @backup-incr-lev0-plus-recover.rmnRecovery Manager: Release 11.1.0.7.0 - Production on Tue Feb 17 16:03:10 2009

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

    connected to target database: SATI11 (DBID=124143874)

    RMAN> # backup-incr-lev0-plus-recover.rmn2> # ---------------------------------3> # This script on the first run makes a level 0 backup if no one exists4> # In the second run makes an incremental level 15> # On every subsequent run:6> # 1) Applies the previous level 1 to the backupset and7> # 2) Creates a new level 1 backup8> RUN9> {10> ALLOCATE CHANNEL disk1 DEVICE TYPE DISK ;

    4/37

  • ASM HANDS-ON TRAININGLab 15 Cloning An ASM Disk Group On The Same Server

    11> ALLOCATE CHANNEL disk2 DEVICE TYPE DISK ;12> ALLOCATE CHANNEL disk3 DEVICE TYPE DISK ;13> ALLOCATE CHANNEL disk4 DEVICE TYPE DISK ;14> RECOVER COPY OF DATABASE15> WITH TAG 'INCREMENTAL_DAILY_UPDATED' ;16> BACKUP INCREMENTAL LEVEL 117> FOR RECOVER OF COPY WITH TAG 'INCREMENTAL_DAILY_UPDATED'18> DATABASE PLUS ARCHIVELOG ;19> BACKUP CURRENT CONTROLFILE;20> crosscheck backupset;21> crosscheck archivelog all;22> delete noprompt obsolete;23> delete noprompt expired backupset;24> delete noprompt expired archivelog all;25> }26> # -------------------------------------27> # eof backup-incr-lev0-plus-recover.rmn28>using target database control file instead of recovery catalog......

    Remove The Database From The Normal Redundancy Diskgroup

    To remove the database from the DATADGNR diskgroup we will bring it down and go to the next step drop disk group. Removing the diskgroup with the including contents option will actually remove all database files but not the database related entries on the environment.

    SQL> select name from v$database;

    5/37

  • ASM HANDS-ON TRAININGLab 15 Cloning An ASM Disk Group On The Same Server

    NAME---------SATI11

    SQL> shutdown abort;ORACLE instance shut down.

    Drop The Normal Redundancy Diskgroup

    On this step we will remove diskgroup DATADGNR including the database located on it, and we will execute some checkups to assure that the diskgroup and its contents was correctly dropped.

    First we will check which ASM disks are assigned to it

    GROUP_NUMBER NAME PATH------------ ------------------------------ ------------------------------------------- 1 DATADGNR ORCL:VOL1 1 DATADGNR ORCL:VOL2 1 DATADGNR ORCL:VOL3B 1 DATADGNR ORCL:VOL4 1 DATADGNR ORCL:VOL5 2 FRADG ORCL:VOLBLK1 2 FRADG ORCL:VOLBLK3

    And the mapping to physical devices

    [oracle@asmxpt ~]$ asmapASM disk based on Minor,Major Size (Mb)=============== ============= =========== =========

    6/37

  • ASM HANDS-ON TRAININGLab 15 Cloning An ASM Disk Group On The Same Server

    VOL1 /dev/sdb1 [8, 17] 2,047VOL2 /dev/sdc1 [8, 33] 2,047VOL3B /dev/sdd1 [8, 49] 2,047VOL4 /dev/sde1 [8, 65] 2,047VOL5 /dev/sdg1 [8, 97] 2,047VOLBLK1 /dev/sdf1 [8, 81] 2,047VOLBLK3 /dev/sdh1 [8, 113] 2,047

    Next we connect to the ASM instance and execute the drop diskgroup command

    SQL> drop diskgroup datadgnr including contents;Diskgroup dropped.

    Asmcmd lsdg show that only FRADG remains in place

    oracle@asmxpt ~]$ asmcmd lsdgState Type Rebal Sector Block AU Total_MB Free_MB Req_mir_free_MB Usable_file_MB Offline_disks NameMOUNTED EXTERN N 512 4096 1048576 4094 1756 0 1756 0 FRADG/

    Checking which ASM disks are actually in use we can see that only FRADG disk group is being used

    Script to execute ... asm_dsk_in_useFULL_ALIAS_PATH--------------------------------------------------------------------------------+FRADG/SATI11+FRADG/SATI11/CHANGETRACKING+FRADG/SATI11/CHANGETRACKING/ctf.259.678750225+FRADG/SATI11/ARCHIVELOG+FRADG/SATI11/ARCHIVELOG/2009_02_18+FRADG/SATI11/ARCHIVELOG/2009_02_18/thread_1_seq_4.292.679111271

    7/37

  • ASM HANDS-ON TRAININGLab 15 Cloning An ASM Disk Group On The Same Server

    +FRADG/SATI11/ARCHIVELOG/2009_02_18/thread_1_seq_5.289.679130509+FRADG/SATI11/ARCHIVELOG/2009_02_18/thread_1_seq_6.296.679130557+FRADG/SATI11/ARCHIVELOG/2009_02_18/thread_1_seq_7.298.679137227+FRADG/SATI11/ARCHIVELOG/2009_02_17+FRADG/SATI11/ARCHIVELOG/2009_02_17/thread_1_seq_2.299.679075709+FRADG/SATI11/ARCHIVELOG/2009_02_17/thread_1_seq_3.293.679101533+FRADG/SATI11/BACKUPSET+FRADG/SATI11/BACKUPSET/2009_02_18+FRADG/SATI11/BACKUPSET/2009_02_18/annnf0_TAG20090218T072151_0.309.679130513+FRADG/SATI11/BACKUPSET/2009_02_18/annnf0_TAG20090218T072151_0.310.679130515+FRADG/SATI11/BACKUPSET/2009_02_18/annnf0_TAG20090218T072151_0.311.679130517+FRADG/SATI11/BACKUPSET/2009_02_18/annnf0_TAG20090218T072151_0.267.679130519+FRADG/SATI11/BACKUPSET/2009_02_18/nnndn1_TAG20090218T072215_0.285.679130537+FRADG/SATI11/BACKUPSET/2009_02_18/nnndn1_TAG20090218T072215_0.287.679130543+FRADG/SATI11/BACKUPSET/2009_02_18/nnndn1_TAG20090218T072215_0.288.679130543+FRADG/SATI11/BACKUPSET/2009_02_18/nnndn1_TAG20090218T072215_0.290.679130553+FRADG/SATI11/BACKUPSET/2009_02_18/annnf0_TAG20090218T072237_0.297.679130557+FRADG/SATI11/BACKUPSET/2009_02_17+FRADG/SATI11/BACKUPSET/2009_02_17/annnf0_TAG20090217T160830_0.294.679075711+FRADG/SATI11/DATAFILE+FRADG/SATI11/DATAFILE/USERS.265.678773315+FRADG/SATI11/DATAFILE/SYSTEM.262.678773299+FRADG/SATI11/DATAFILE/SYSAUX.263.678773303+FRADG/SATI11/DATAFILE/UNDOTBS1.264.678773305+FRADG/SATI11/AUTOBACKUP+FRADG/SATI11/AUTOBACKUP/2009_02_12+FRADG/SATI11/AUTOBACKUP/2009_02_18+FRADG/SATI11/AUTOBACKUP/2009_02_18/s_679130566.300.679130569

    Checking ASM disks we can see all disks that belonged to DATADGNR with mount_status=closed and header_status=former

    8/37

  • ASM HANDS-ON TRAININGLab 15 Cloning An ASM Disk Group On The Same Server

    Executing asm_diskDISK_NUMBER MOUNT_S HEADER_STATU MODE_ST STATE PATH----------- ------- ------------ ------- -------- ------------------------------ 0 CLOSED FORMER ONLINE NORMAL ORCL:VOL4 1 CLOSED FORMER ONLINE NORMAL ORCL:VOL3B 2 CLOSED FORMER ONLINE NORMAL ORCL:VOL1 3 CLOSED FORMER ONLINE NORMAL ORCL:VOL2 4 CLOSED FORMER ONLINE NORMAL ORCL:VOL5 0 CACHED MEMBER ONLINE NORMAL ORCL:VOLBLK1 1 CACHED MEMBER ONLINE NORMAL ORCL:VOLBLK3

    Recreate the ASM Volumes

    On this step we will just remove the old ASM disks used by the diskgroup DATADGNR and change their names for this exercise.

    [oracle@asmxpt CHECK-ASM]$ asmap

    ASM disk based on Minor,Major Size (Mb)=============== ============= =========== =========VOL1 /dev/sdb1 [8, 17] 2,047VOL2 /dev/sdc1 [8, 33] 2,047VOL3B /dev/sdd1 [8, 49] 2,047VOL4 /dev/sde1 [8, 65] 2,047VOL5 /dev/sdg1 [8, 97] 2,047VOLBLK1 /dev/sdf1 [8, 81] 2,047VOLBLK3 /dev/sdh1 [8, 113] 2,047

    9/37

  • ASM HANDS-ON TRAININGLab 15 Cloning An ASM Disk Group On The Same Server

    Connect as root and remove VOL1, VOL2, VOL3B, VOL4 and VOL5[oracle@asmxpt CHECK-ASM]$ su -Password:[root@asmxpt ~]# oracleasm deletedisk VOL1Removing ASM disk "VOL1": [ OK ][root@asmxpt ~]# oracleasm deletedisk VOL2Removing ASM disk "VOL2": [ OK ][root@asmxpt ~]# oracleasm deletedisk VOL3BRemoving ASM disk "VOL3B": [ OK ][root@asmxpt ~]# oracleasm deletedisk VOL4Removing ASM disk "VOL4": [ OK ][root@asmxpt ~]# oracleasm deletedisk VOL5Removing ASM disk "VOL5": [ OK ][root@asmxpt ~]#

    Connect as root and create ASM disks VOL1ER, VOL2ER, VOL1CLN, VOL2CLN and VOLBLK4

    [root@asmxpt ~]# oracleasm createdisk VOL1ER /dev/sdb1Marking disk "/dev/sdb1" as an ASM disk: [ OK ][root@asmxpt ~]# oracleasm createdisk VOL2ER /dev/sdc1Marking disk "/dev/sdc1" as an ASM disk: [ OK ][root@asmxpt ~]# oracleasm createdisk VOL1CLN /dev/sdd1Marking disk "/dev/sdd1" as an ASM disk: [ OK ][root@asmxpt ~]# oracleasm createdisk VOL2CLN /dev/sde1Marking disk "/dev/sde1" as an ASM disk: [ OK ][root@asmxpt ~]# oracleasm createdisk VOLBLK4 /dev/sdg1Marking disk "/dev/sdg1" as an ASM disk: [ OK ]

    Check the new ASM disks

    Executing asm_disk

    10/37

  • ASM HANDS-ON TRAININGLab 15 Cloning An ASM Disk Group On The Same Server

    DISK_NUMBER MOUNT_S HEADER_STATU MODE_ST STATE PATH----------- ------- ------------ ------- -------- ------------------------------ 5 CLOSED PROVISIONED ONLINE NORMAL ORCL:VOL1CLN 6 CLOSED PROVISIONED ONLINE NORMAL ORCL:VOL1ER 7 CLOSED PROVISIONED ONLINE NORMAL ORCL:VOL2CLN 8 CLOSED PROVISIONED ONLINE NORMAL ORCL:VOL2ER 9 CLOSED PROVISIONED ONLINE NORMAL ORCL:VOLBLK4 0 CACHED MEMBER ONLINE NORMAL ORCL:VOLBLK1 1 CACHED MEMBER ONLINE NORMAL ORCL:VOLBLK3

    Add ASM Disk VOLBLK4 To The FRADG Diskgroup

    In this step we will restore VOLBLK4 to the FRADG diskgroup, later we will use the same diskgroup as Flash Recovery Area for both the source and the clone database.

    SQL> alter diskgroup fradg add disk 'ORCL:VOLBLK4' SIZE 2047M;Diskgroup altered.

    Create a New External Redundancy Diskgroup

    Connect to the ASM instance as Oracle and create a new diskgroup DATADGER on VOL1ER and VOL2ER

    SQL> CREATE DISKGROUP DATADGER EXTERNAL REDUNDANCY DISK 'ORCL:VOL1ER','ORCL:VOL2ER';Diskgroup created.

    11/37

  • ASM HANDS-ON TRAININGLab 15 Cloning An ASM Disk Group On The Same Server

    Restore DATADGNR metadata to the new DATADGER Disk Group

    In this step we will prepare the metadata of the DATADGER diskgroup for the restore. We will use the md_restore command to generate a script that we will edit to match our new disk group

    [oracle@asmxpt sati11]$ asmcmd md_restore -b /u01/app/oracle/BACKUP/sati11/asm_md_backup -t nodg -f rest_asm_md.sql -g 'DATADGNR'Current Diskgroup being restored: DATADGNR

    This command generated the following script, we will need to edit it and replace DATADGNR by DATADGER

    alter diskgroup /*ASMCMD AMBR*/DATADGER alter template TEMPFILE attributes (MIRROR COARSE);alter diskgroup /*ASMCMD AMBR*/DATADGER alter template DUMPSET attributes (MIRROR COARSE);alter diskgroup /*ASMCMD AMBR*/DATADGER alter template XTRANSPORT attributes (MIRROR COARSE);alter diskgroup /*ASMCMD AMBR*/DATADGER alter template DATAFILE attributes (MIRROR COARSE);alter diskgroup /*ASMCMD AMBR*/DATADGER alter template ARCHIVELOG attributes (MIRROR COARSE);alter diskgroup /*ASMCMD AMBR*/DATADGER alter template ASM_STALE attributes (HIGH COARSE);alter diskgroup /*ASMCMD AMBR*/DATADGER alter template CHANGETRACKING attributes (MIRROR COARSE);alter diskgroup /*ASMCMD AMBR*/DATADGER alter template ONLINELOG attributes (MIRROR FINE);alter diskgroup /*ASMCMD AMBR*/DATADGER alter template FLASHBACK attributes (MIRROR FINE);alter diskgroup /*ASMCMD AMBR*/DATADGER alter template AUTOBACKUP attributes (MIRROR COARSE);alter diskgroup /*ASMCMD AMBR*/DATADGER alter template DATAGUARDCONFIG attributes (MIRROR COARSE);alter diskgroup /*ASMCMD AMBR*/DATADGER alter template PARAMETERFILE attributes (MIRROR COARSE);alter diskgroup /*ASMCMD AMBR*/DATADGER alter template CONTROLFILE attributes (HIGH FINE);alter diskgroup /*ASMCMD AMBR*/DATADGER alter template BACKUPSET attributes (MIRROR COARSE);alter diskgroup /*ASMCMD AMBR */ DATADGER add directory '+DATADGER/SATI11';alter diskgroup /*ASMCMD AMBR */ DATADGER add directory '+DATADGER/SATI11/CONTROLFILE';alter diskgroup /*ASMCMD AMBR */ DATADGER add directory '+DATADGER/SATI11/ONLINELOG';alter diskgroup /*ASMCMD AMBR */ DATADGER add directory '+DATADGER/SATI11/DATAFILE';alter diskgroup /*ASMCMD AMBR */ DATADGER add directory '+DATADGER/SATI11/TEMPFILE';alter diskgroup /*ASMCMD AMBR */ DATADGER add directory '+DATADGER/SATI11/PARAMETERFILE';

    12/37

  • ASM HANDS-ON TRAININGLab 15 Cloning An ASM Disk Group On The Same Server

    The edited script contains only the create directory commands, other commands were related to Normal Redundancy and are not required when using External Redundancy

    alter diskgroup /*ASMCMD AMBR */ DATADGER add directory '+DATADGER/SATI11';alter diskgroup /*ASMCMD AMBR */ DATADGER add directory '+DATADGER/SATI11/CONTROLFILE';alter diskgroup /*ASMCMD AMBR */ DATADGER add directory '+DATADGER/SATI11/ONLINELOG';alter diskgroup /*ASMCMD AMBR */ DATADGER add directory '+DATADGER/SATI11/DATAFILE';alter diskgroup /*ASMCMD AMBR */ DATADGER add directory '+DATADGER/SATI11/TEMPFILE';alter diskgroup /*ASMCMD AMBR */ DATADGER add directory '+DATADGER/SATI11/PARAMETERFILE';

    Connect to the ASM instance and execute the script

    SQL> alter diskgroup /*ASMCMD AMBR */ DATADGER add directory '+DATADGER/SATI11';Diskgroup altered.

    SQL> alter diskgroup /*ASMCMD AMBR */ DATADGER add directory '+DATADGER/SATI11/CONTROLFILE';Diskgroup altered.

    SQL> alter diskgroup /*ASMCMD AMBR */ DATADGER add directory '+DATADGER/SATI11/ONLINELOG';Diskgroup altered.

    SQL> alter diskgroup /*ASMCMD AMBR */ DATADGER add directory '+DATADGER/SATI11/DATAFILE';Diskgroup altered.

    SQL> alter diskgroup /*ASMCMD AMBR */ DATADGER add directory '+DATADGER/SATI11/TEMPFILE';Diskgroup altered.

    SQL> alter diskgroup /*ASMCMD AMBR */ DATADGER add directory '+DATADGER/SATI11/PARAMETERFILE';Diskgroup altered.

    Restore the Database Into The New External Redundancy Diskgroup

    13/37

  • ASM HANDS-ON TRAININGLab 15 Cloning An ASM Disk Group On The Same Server

    In this step we will restore the database to the new diskgroup. We will start the database from a pfile prepared for the case, all occurrences of DATADGNR were changed to DATADGER

    sati11.__db_cache_size=71303168sati11.__java_pool_size=12582912sati11.__large_pool_size=4194304sati11.__oracle_base='/u01/app/oracle/11g_db'#ORACLE_BASE set from environmentsati11.__pga_aggregate_target=121634816sati11.__sga_target=230686720sati11.__shared_io_pool_size=0sati11.__shared_pool_size=134217728sati11.__streams_pool_size=0*.audit_file_dest='/u01/app/oracle/admin/sati11/adump'*.audit_trail='none'*.compatible='11.1.0.0.0'*.control_files='+DATADGER/sati11/controlfile/current.257.678885579','+DATADGER/sati11/controlfile/current.265.678885581'#Restore Controlfile*.db_block_size=8192*.db_create_file_dest='+DATADGER'*.db_create_online_log_dest_1='+DATADGER'*.db_create_online_log_dest_2='+DATADGER'*.db_domain=''*.db_name='sati11'*.db_recovery_file_dest='+FRADG'*.db_recovery_file_dest_size=6341787648*.diagnostic_dest='/u01/app/oracle'*.dispatchers='(PROTOCOL=TCP) (SERVICE=sati11XDB)'*.memory_target=352321536*.open_cursors=300*.processes=150

    14/37

  • ASM HANDS-ON TRAININGLab 15 Cloning An ASM Disk Group On The Same Server

    *.remote_login_passwordfile='EXCLUSIVE'*.undo_tablespace='UNDOTBS1'

    Startup the database in no mount mode with this pfile and copy it to ASM.

    SQL> startup nomount pfile='/u01/app/oracle/BACKUP/sati11/initsati11.ora';ORACLE instance started.

    Total System Global Area 351522816 bytesFixed Size 1313344 bytesVariable Size 272631232 bytesDatabase Buffers 71303168 bytesRedo Buffers 6275072 bytes

    SQL> create spfile='+DATADGER/SATI11/PARAMETERFILE/spfilesati11.ora' from pfile='/u01/app/oracle/BACKUP/sati11/initsati11.ora';File created.

    Change also the initsati11.ora on ORACLE_HOME/dbs to point to the new disk group

    [oracle@asmxpt dbs]$ vi /u01/app/oracle/11g_db/dbs/initsati11.oraSPFILE='+DATADGER/SATI11/PARAMETERFILE/spfilesati11.ora'

    Restart the database in nomount mode

    ORACLE instance shut down.SQL> startup nomount;ORACLE instance started.

    Total System Global Area 351522816 bytes

    15/37

  • ASM HANDS-ON TRAININGLab 15 Cloning An ASM Disk Group On The Same Server

    Fixed Size 1313344 bytesVariable Size 272631232 bytesDatabase Buffers 71303168 bytesRedo Buffers 6275072 bytes

    Start an Rman session and restore the controlfile

    [oracle@asmxpt sati11]$ rman target /

    Recovery Manager: Release 11.1.0.7.0 - Production on Wed Feb 18 11:04:45 2009

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

    connected to target database: SATI11 (not mounted)

    RMAN> restore controlfile from autobackup;Starting restore at 18-FEB-09using target database control file instead of recovery catalogallocated channel: ORA_DISK_1channel ORA_DISK_1: SID=150 device type=DISK

    recovery area destination: +FRADGdatabase name (or database unique name) used for search: SATI11channel ORA_DISK_1: AUTOBACKUP +fradg/SATI11/AUTOBACKUP/2009_02_18/s_679130566.300.679130569 found in the recovery areaAUTOBACKUP search with format "%F" not attempted because DBID was not setchannel ORA_DISK_1: restoring control file from AUTOBACKUP +fradg/SATI11/AUTOBACKUP/2009_02_18/s_679130566.300.679130569channel ORA_DISK_1: control file restore from AUTOBACKUP completeoutput file name=+DATADGER/sati11/controlfile/current.257.679143905

    16/37

  • ASM HANDS-ON TRAININGLab 15 Cloning An ASM Disk Group On The Same Server

    output file name=+DATADGER/sati11/controlfile/current.258.679143907Finished restore at 18-FEB-09

    Mount and restore the database

    RMAN> alter database mount;database mountedreleased channel: ORA_DISK_1

    RMAN> restore database;Starting restore at 18-FEB-09Starting implicit crosscheck backup at 18-FEB-09allocated channel: ORA_DISK_1channel ORA_DISK_1: SID=150 device type=DISKCrosschecked 20 objectsFinished implicit crosscheck backup at 18-FEB-09

    Starting implicit crosscheck copy at 18-FEB-09using channel ORA_DISK_1Crosschecked 4 objectsFinished implicit crosscheck copy at 18-FEB-09

    searching for all files in the recovery areacataloging files...cataloging done

    List of Cataloged Files=======================File Name: +fradg/SATI11/ARCHIVELOG/2009_02_18/thread_1_seq_7.298.679137227

    17/37

  • ASM HANDS-ON TRAININGLab 15 Cloning An ASM Disk Group On The Same Server

    File Name: +fradg/SATI11/AUTOBACKUP/2009_02_18/s_679130566.300.679130569

    using channel ORA_DISK_1

    channel ORA_DISK_1: restoring datafile 00001input datafile copy RECID=34 STAMP=679130501 file name=+FRADG/sati11/datafile/system.262.678773299destination for restore of datafile 00001: +DATADGNR/sati11/datafile/system.259.679073411channel ORA_DISK_1: copied datafile copy of datafile 00001output file name=+DATADGER/sati11/datafile/system.259.679144027 RECID=0 STAMP=0channel ORA_DISK_1: restoring datafile 00002input datafile copy RECID=37 STAMP=679130504 file name=+FRADG/sati11/datafile/sysaux.263.678773303destination for restore of datafile 00002: +DATADGNR/sati11/datafile/sysaux.260.679073515channel ORA_DISK_1: copied datafile copy of datafile 00002output file name=+DATADGER/sati11/datafile/sysaux.260.679144103 RECID=0 STAMP=0channel ORA_DISK_1: restoring datafile 00003input datafile copy RECID=36 STAMP=679130502 file name=+FRADG/sati11/datafile/undotbs1.264.678773305destination for restore of datafile 00003: +DATADGNR/sati11/datafile/undotbs1.261.679073621channel ORA_DISK_1: copied datafile copy of datafile 00003output file name=+DATADGER/sati11/datafile/undotbs1.261.679144167 RECID=0 STAMP=0channel ORA_DISK_1: restoring datafile 00004input datafile copy RECID=35 STAMP=679130502 file name=+FRADG/sati11/datafile/users.265.678773315destination for restore of datafile 00004: +DATADGNR/sati11/datafile/users.262.679073697channel ORA_DISK_1: copied datafile copy of datafile 00004output file name=+DATADGER/sati11/datafile/users.262.679144213 RECID=0 STAMP=0Finished restore at 18-FEB-09

    18/37

  • ASM HANDS-ON TRAININGLab 15 Cloning An ASM Disk Group On The Same Server

    Recover the database, note that when all available archived logs are applied you will get error 06054 media recovery requesting unknown archived log that is because these sequence was not archived. After that you can open the database with the resetlogs option.

    RMAN> recover database;Starting recover at 18-FEB-09using channel ORA_DISK_1channel ORA_DISK_1: starting incremental datafile backup set restorechannel ORA_DISK_1: specifying datafile(s) to restore from backup setdestination for restore of datafile 00001: +DATADGER/sati11/datafile/system.259.679144027channel ORA_DISK_1: reading from backup piece +FRADG/sati11/backupset/2009_02_18/nnndn1_tag20090218t072215_0.285.679130537channel ORA_DISK_1: piece handle=+FRADG/sati11/backupset/2009_02_18/nnndn1_tag20090218t072215_0.285.679130537 tag=TAG20090218T072215channel ORA_DISK_1: restored backup piece 1channel ORA_DISK_1: restore complete, elapsed time: 00:00:03channel ORA_DISK_1: starting incremental datafile backup set restorechannel ORA_DISK_1: specifying datafile(s) to restore from backup setdestination for restore of datafile 00003: +DATADGER/sati11/datafile/undotbs1.261.679144167channel ORA_DISK_1: reading from backup piece +FRADG/sati11/backupset/2009_02_18/nnndn1_tag20090218t072215_0.288.679130543channel ORA_DISK_1: piece handle=+FRADG/sati11/backupset/2009_02_18/nnndn1_tag20090218t072215_0.288.679130543 tag=TAG20090218T072215channel ORA_DISK_1: restored backup piece 1channel ORA_DISK_1: restore complete, elapsed time: 00:00:07channel ORA_DISK_1: starting incremental datafile backup set restorechannel ORA_DISK_1: specifying datafile(s) to restore from backup set

    19/37

  • ASM HANDS-ON TRAININGLab 15 Cloning An ASM Disk Group On The Same Server

    destination for restore of datafile 00004: +DATADGER/sati11/datafile/users.262.679144213channel ORA_DISK_1: reading from backup piece +FRADG/sati11/backupset/2009_02_18/nnndn1_tag20090218t072215_0.290.679130553channel ORA_DISK_1: piece handle=+FRADG/sati11/backupset/2009_02_18/nnndn1_tag20090218t072215_0.290.679130553 tag=TAG20090218T072215channel ORA_DISK_1: restored backup piece 1channel ORA_DISK_1: restore complete, elapsed time: 00:00:01channel ORA_DISK_1: starting incremental datafile backup set restorechannel ORA_DISK_1: specifying datafile(s) to restore from backup setdestination for restore of datafile 00002: +DATADGER/sati11/datafile/sysaux.260.679144103channel ORA_DISK_1: reading from backup piece +FRADG/sati11/backupset/2009_02_18/nnndn1_tag20090218t072215_0.287.679130543channel ORA_DISK_1: piece handle=+FRADG/sati11/backupset/2009_02_18/nnndn1_tag20090218t072215_0.287.679130543 tag=TAG20090218T072215channel ORA_DISK_1: restored backup piece 1channel ORA_DISK_1: restore complete, elapsed time: 00:00:07

    starting media recovery

    archived log for thread 1 with sequence 6 is already on disk as file +FRADG/sati11/archivelog/2009_02_18/thread_1_seq_6.296.679130557archived log for thread 1 with sequence 7 is already on disk as file +FRADG/sati11/archivelog/2009_02_18/thread_1_seq_7.298.679137227archived log file name=+FRADG/sati11/archivelog/2009_02_18/thread_1_seq_6.296.679130557 thread=1 sequence=6archived log file name=+FRADG/sati11/archivelog/2009_02_18/thread_1_seq_7.298.679137227 thread=1 sequence=7unable to find archived logarchived log thread=1 sequence=8

    20/37

  • ASM HANDS-ON TRAININGLab 15 Cloning An ASM Disk Group On The Same Server

    RMAN-00571: ===========================================================RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============RMAN-00571: ===========================================================RMAN-03002: failure of recover command at 02/18/2009 11:27:07RMAN-06054: media recovery requesting unknown archived log for thread 1 with sequence 8 and starting SCN of 1028859

    Open the database with the resetlogs option

    RMAN> alter database open resetlogs;database opened

    Check That The Database Is Operational

    To check we will run script runload that create and populate a table, to stop execute stopload from a second window.

    [oracle@asmxpt ~]$ ./runloadSQL*Plus: Release 11.1.0.7.0 - Production on Wed Feb 18 11:57:35 2009

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

    Connected to:Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - ProductionWith the Partitioning, OLAP, Data Mining and Real Application Testing options

    SQL> SQL>Table dropped.

    SQL> 2

    21/37

  • ASM HANDS-ON TRAININGLab 15 Cloning An ASM Disk Group On The Same Server

    Table created.

    SQL>31 rows created.

    SQL>USERNAME PASSWORD ACCOUNT_STATUS------------------------------ ------------------------------ --------------------------------SYSTEM OPENSYS OPENMGMT_VIEW OPEN

    Execute a Consistent Database Shutdown

    Do shutdown immediate to start the clone process. Note that the database must be down only on this kind of test, on normal operation with storage tools that database will be set to backup mode for a minute to break the link between the source database and the clone, so no downtime is required

    SQL> shutdown immediateDatabase closed.Database dismounted.ORACLE instance shut down.

    Create A Clone Of The Database ASM Disks

    To create the clone we will connect as root and use the command dd we will define as output file the LUNs we created before. We use nohup and execute the command in the background to avoid problems like a broken session to interfere with the execution.

    VOL1CLN /dev/sdd1 [8, 49] 2,047VOL1ER /dev/sdb1 [8, 17] 2,047

    22/37

  • ASM HANDS-ON TRAININGLab 15 Cloning An ASM Disk Group On The Same Server

    VOL2CLN /dev/sde1 [8, 65] 2,047VOL2ER /dev/sdc1 [8, 33] 2,047

    [root@asmxpt ~]# nohup dd if=/dev/sdb1 of=/dev/sdd1 bs=1024k &[1] 1058[root@asmxpt ~]# nohup: appending output to `nohup.out'

    [1]+ Done nohup dd if=/dev/sdb1 of=/dev/sdd1 bs=1024k

    [root@asmxpt ~]# nohup dd if=/dev/sdc1 of=/dev/sde1 bs=1024k &[1] 1308[root@asmxpt ~]# nohup: appending output to `nohup.out'

    [1]+ Done nohup dd if=/dev/sdc1 of=/dev/sde1 bs=1024k

    Add Path To Kfed On User Root ProfileThe procedure to change the headers needs to be executed as root, because if that we need to make kfed available to root also

    [oracle@asmxpt ~]$ which kfed/u01/app/oracle/11g_db/bin/kfed[oracle@asmxpt ~]$ su -Password:

    [root@asmxpt ~]# vi .bash_profile # .bash_profile

    # Get the aliases and functionsif [ -f ~/.bashrc ]; then . ~/.bashrc

    23/37

  • ASM HANDS-ON TRAININGLab 15 Cloning An ASM Disk Group On The Same Server

    fi

    # User specific environment and startup programs

    PATH=$PATH:$HOME/bin:/sbin:/usr/sbin:/etc/init.d:/u01/app/oracle/11g_db/binBASH_ENV=$HOME/.bashrcUSERNAME="root"export USERNAME BASH_ENV PATH

    Check the headers of the copied pairs with kfed

    When checking the headers we can see they are identical. This is the reason ASM cannot mount a cloned ASM disk as is.

    [root@asmxpt ~]# kfed read /dev/sdb1kfbh.endian: 1 ; 0x000: 0x01kfbh.hard: 130 ; 0x001: 0x82kfbh.type: 1 ; 0x002: KFBTYP_DISKHEADkfbh.datfmt: 1 ; 0x003: 0x01kfbh.block.blk: 0 ; 0x004: T=0 NUMB=0x0kfbh.block.obj: 2147483648 ; 0x008: TYPE=0x8 NUMB=0x0kfbh.check: 3351119151 ; 0x00c: 0xc7be052fkfbh.fcn.base: 0 ; 0x010: 0x00000000kfbh.fcn.wrap: 0 ; 0x014: 0x00000000kfbh.spare1: 0 ; 0x018: 0x00000000kfbh.spare2: 0 ; 0x01c: 0x00000000kfdhdb.driver.provstr: ORCLDISKVOL1ER ; 0x000: length=14kfdhdb.driver.reserved[0]: 827084630 ; 0x008: 0x314c4f56kfdhdb.driver.reserved[1]: 21061 ; 0x00c: 0x00005245kfdhdb.driver.reserved[2]: 0 ; 0x010: 0x00000000kfdhdb.driver.reserved[3]: 0 ; 0x014: 0x00000000kfdhdb.driver.reserved[4]: 0 ; 0x018: 0x00000000kfdhdb.driver.reserved[5]: 0 ; 0x01c: 0x00000000kfdhdb.compat: 168820736 ; 0x020: 0x0a100000kfdhdb.dsknum: 0 ; 0x024: 0x0000kfdhdb.grptyp: 1 ; 0x026: KFDGTP_EXTERNALkfdhdb.hdrsts: 3 ; 0x027: KFDHDR_MEMBERkfdhdb.dskname: VOL1ER ; 0x028: length=6

    [root@asmxpt ~]# kfed read /dev/sdd1kfbh.endian: 1 ; 0x000: 0x01kfbh.hard: 130 ; 0x001: 0x82kfbh.type: 1 ; 0x002: KFBTYP_DISKHEADkfbh.datfmt: 1 ; 0x003: 0x01kfbh.block.blk: 0 ; 0x004: T=0 NUMB=0x0kfbh.block.obj: 2147483648 ; 0x008: TYPE=0x8 NUMB=0x0kfbh.check: 3351119151 ; 0x00c: 0xc7be052fkfbh.fcn.base: 0 ; 0x010: 0x00000000kfbh.fcn.wrap: 0 ; 0x014: 0x00000000kfbh.spare1: 0 ; 0x018: 0x00000000kfbh.spare2: 0 ; 0x01c: 0x00000000kfdhdb.driver.provstr: ORCLDISKVOL1ER ; 0x000: length=14kfdhdb.driver.reserved[0]: 827084630 ; 0x008: 0x314c4f56kfdhdb.driver.reserved[1]: 21061 ; 0x00c: 0x00005245kfdhdb.driver.reserved[2]: 0 ; 0x010: 0x00000000kfdhdb.driver.reserved[3]: 0 ; 0x014: 0x00000000kfdhdb.driver.reserved[4]: 0 ; 0x018: 0x00000000kfdhdb.driver.reserved[5]: 0 ; 0x01c: 0x00000000kfdhdb.compat: 168820736 ; 0x020: 0x0a100000kfdhdb.dsknum: 0 ; 0x024: 0x0000kfdhdb.grptyp: 1 ; 0x026: KFDGTP_EXTERNALkfdhdb.hdrsts: 3 ; 0x027: KFDHDR_MEMBERkfdhdb.dskname: VOL1ER ; 0x028: length=6

    24/37

  • ASM HANDS-ON TRAININGLab 15 Cloning An ASM Disk Group On The Same Server

    kfdhdb.grpname: DATADGER ; 0x048: length=8kfdhdb.fgname: VOL1ER ; 0x068: length=6kfdhdb.capname: ; 0x088: length=0kfdhdb.crestmp.hi: 32918090 ; 0x0a8: HOUR=0xa DAYS=0x12 MNTH=0x2 YEAR=0x7d9kfdhdb.crestmp.lo: 1886414848 ; 0x0ac: USEC=0x0 MSEC=0x1a SECS=0x7 MINS=0x1ckfdhdb.mntstmp.hi: 32918090 ; 0x0b0: HOUR=0xa DAYS=0x12 MNTH=0x2 YEAR=0x7d9kfdhdb.mntstmp.lo: 1896701952 ; 0x0b4: USEC=0x0 MSEC=0x358 SECS=0x10 MINS=0x1ckfdhdb.secsize: 512 ; 0x0b8: 0x0200kfdhdb.blksize: 4096 ; 0x0ba: 0x1000kfdhdb.ausize: 1048576 ; 0x0bc: 0x00100000kfdhdb.mfact: 113792 ; 0x0c0: 0x0001bc80kfdhdb.dsksize: 2047 ; 0x0c4: 0x000007ff

    kfdhdb.grpname: DATADGER ; 0x048: length=8kfdhdb.fgname: VOL1ER ; 0x068: length=6kfdhdb.capname: ; 0x088: length=0kfdhdb.crestmp.hi: 32918090 ; 0x0a8: HOUR=0xa DAYS=0x12 MNTH=0x2 YEAR=0x7d9kfdhdb.crestmp.lo: 1886414848 ; 0x0ac: USEC=0x0 MSEC=0x1a SECS=0x7 MINS=0x1ckfdhdb.mntstmp.hi: 32918090 ; 0x0b0: HOUR=0xa DAYS=0x12 MNTH=0x2 YEAR=0x7d9kfdhdb.mntstmp.lo: 1896701952 ; 0x0b4: USEC=0x0 MSEC=0x358 SECS=0x10 MINS=0x1ckfdhdb.secsize: 512 ; 0x0b8: 0x0200kfdhdb.blksize: 4096 ; 0x0ba: 0x1000kfdhdb.ausize: 1048576 ; 0x0bc: 0x00100000kfdhdb.mfact: 113792 ; 0x0c0: 0x0001bc80kfdhdb.dsksize: 2047 ; 0x0c4: 0x000007ff

    [root@asmxpt ~]# kfed read /dev/sdc1kfbh.endian: 1 ; 0x000: 0x01kfbh.hard: 130 ; 0x001: 0x82kfbh.type: 1 ; 0x002: KFBTYP_DISKHEADkfbh.datfmt: 1 ; 0x003: 0x01kfbh.block.blk: 0 ; 0x004: T=0 NUMB=0x0kfbh.block.obj: 2147483649 ; 0x008: TYPE=0x8 NUMB=0x1kfbh.check: 3300787501 ; 0x00c: 0xc4be052dkfbh.fcn.base: 0 ; 0x010: 0x00000000kfbh.fcn.wrap: 0 ; 0x014: 0x00000000kfbh.spare1: 0 ; 0x018: 0x00000000kfbh.spare2: 0 ; 0x01c: 0x00000000kfdhdb.driver.provstr: ORCLDISKVOL2ER ; 0x000: length=14kfdhdb.driver.reserved[0]: 843861846 ; 0x008: 0x324c4f56kfdhdb.driver.reserved[1]: 21061 ; 0x00c: 0x00005245kfdhdb.driver.reserved[2]: 0 ; 0x010: 0x00000000kfdhdb.driver.reserved[3]: 0 ; 0x014: 0x00000000kfdhdb.driver.reserved[4]: 0 ; 0x018: 0x00000000kfdhdb.driver.reserved[5]: 0 ; 0x01c: 0x00000000kfdhdb.compat: 168820736 ; 0x020: 0x0a100000kfdhdb.dsknum: 1 ; 0x024: 0x0001kfdhdb.grptyp: 1 ; 0x026: KFDGTP_EXTERNALkfdhdb.hdrsts: 3 ; 0x027: KFDHDR_MEMBERkfdhdb.dskname: VOL2ER ; 0x028: length=6kfdhdb.grpname: DATADGER ; 0x048: length=8kfdhdb.fgname: VOL2ER ; 0x068: length=6kfdhdb.capname: ; 0x088: length=0kfdhdb.crestmp.hi: 32918090 ; 0x0a8: HOUR=0xa DAYS=0x12 MNTH=0x2 YEAR=0x7d9kfdhdb.crestmp.lo: 1886414848 ; 0x0ac: USEC=0x0 MSEC=0x1a SECS=0x7 MINS=0x1c

    [root@asmxpt ~]# kfed read /dev/sde1kfbh.endian: 1 ; 0x000: 0x01kfbh.hard: 130 ; 0x001: 0x82kfbh.type: 1 ; 0x002: KFBTYP_DISKHEADkfbh.datfmt: 1 ; 0x003: 0x01kfbh.block.blk: 0 ; 0x004: T=0 NUMB=0x0kfbh.block.obj: 2147483649 ; 0x008: TYPE=0x8 NUMB=0x1kfbh.check: 3300787501 ; 0x00c: 0xc4be052dkfbh.fcn.base: 0 ; 0x010: 0x00000000kfbh.fcn.wrap: 0 ; 0x014: 0x00000000kfbh.spare1: 0 ; 0x018: 0x00000000kfbh.spare2: 0 ; 0x01c: 0x00000000kfdhdb.driver.provstr: ORCLDISKVOL2ER ; 0x000: length=14kfdhdb.driver.reserved[0]: 843861846 ; 0x008: 0x324c4f56kfdhdb.driver.reserved[1]: 21061 ; 0x00c: 0x00005245kfdhdb.driver.reserved[2]: 0 ; 0x010: 0x00000000kfdhdb.driver.reserved[3]: 0 ; 0x014: 0x00000000kfdhdb.driver.reserved[4]: 0 ; 0x018: 0x00000000kfdhdb.driver.reserved[5]: 0 ; 0x01c: 0x00000000kfdhdb.compat: 168820736 ; 0x020: 0x0a100000kfdhdb.dsknum: 1 ; 0x024: 0x0001kfdhdb.grptyp: 1 ; 0x026: KFDGTP_EXTERNALkfdhdb.hdrsts: 3 ; 0x027: KFDHDR_MEMBERkfdhdb.dskname: VOL2ER ; 0x028: length=6kfdhdb.grpname: DATADGER ; 0x048: length=8kfdhdb.fgname: VOL2ER ; 0x068: length=6kfdhdb.capname: ; 0x088: length=0kfdhdb.crestmp.hi: 32918090 ; 0x0a8: HOUR=0xa DAYS=0x12 MNTH=0x2 YEAR=0x7d9kfdhdb.crestmp.lo: 1886414848 ; 0x0ac: USEC=0x0 MSEC=0x1a SECS=0x7 MINS=0x1c

    25/37

  • ASM HANDS-ON TRAININGLab 15 Cloning An ASM Disk Group On The Same Server

    kfdhdb.mntstmp.hi: 32918090 ; 0x0b0: HOUR=0xa DAYS=0x12 MNTH=0x2 YEAR=0x7d9kfdhdb.mntstmp.lo: 1896701952 ; 0x0b4: USEC=0x0 MSEC=0x358 SECS=0x10 MINS=0x1ckfdhdb.secsize: 512 ; 0x0b8: 0x0200kfdhdb.blksize: 4096 ; 0x0ba: 0x1000kfdhdb.ausize: 1048576 ; 0x0bc: 0x00100000kfdhdb.mfact: 113792 ; 0x0c0: 0x0001bc80kfdhdb.dsksize: 2047 ; 0x0c4: 0x000007ff

    kfdhdb.mntstmp.hi: 32918090 ; 0x0b0: HOUR=0xa DAYS=0x12 MNTH=0x2 YEAR=0x7d9kfdhdb.mntstmp.lo: 1896701952 ; 0x0b4: USEC=0x0 MSEC=0x358 SECS=0x10 MINS=0x1ckfdhdb.secsize: 512 ; 0x0b8: 0x0200kfdhdb.blksize: 4096 ; 0x0ba: 0x1000kfdhdb.ausize: 1048576 ; 0x0bc: 0x00100000kfdhdb.mfact: 113792 ; 0x0c0: 0x0001bc80kfdhdb.dsksize: 2047 ; 0x0c4: 0x000007ff

    Execute The Script To Rename The Disk Group Using Kfed

    On this step we will change the ASM headers of the cloned disks, actually renaming them to an alternative new diskgroup name.

    Executing the script with the h option provides a help screen

    [oracle@asmxpt ~/ASM-SCRIPTS]$ su -Password:[root@asmxpt ~]# cd /home/oracle/ASM-SCRIPTS[root@asmxpt ASM-SCRIPTS]# ./diskgroup_rename.pl hdiskgroup_rename - rename disk(s)

    USAGE: disk_rename [OPTION] NEWNAME DISK1...[DISK2..DISKN]

    This utility assigns the name NEWNAME to the disks that arepassed as parameters

    OPTIONS:

    -y Say Yes to all questions-h Display this help message

    26/37

  • ASM HANDS-ON TRAININGLab 15 Cloning An ASM Disk Group On The Same Server

    This script invokes kfed to rewrite the disk header of an ASMdisk. It will first ensure that all the disks are valid ASM disksand then proceed to rename them.If there is any problem with any of the disks, all the operationsare aborted, and nothing is changed. Possible errors are: thedisk does not contain a valid header, the disk is being used byanother process eg. ASM,

    This script requires kfed binary to be installed on the host.If kfed binary doesn't exist in ORACLE_HOME/bin directory,it can be relinked as follows

    cd $ORACLE_HOME/rdbms/libgmake -f ins_rdbms.mk ikfedMake sure that kfed is in the path

    Rename The Cloned ASM Disks

    The syntax required is : diskgroup_rename.pl

    [root@asmxpt ASM-SCRIPTS]# ./diskgroup_rename.pl DATADGCLN /dev/sdd1 /dev/sde1renaming disks to: DATADGCLNcurrent name for /dev/sdd1: DATADGERcurrent name for /dev/sde1: DATADGERDo you want to continue?(Yes,[No])Yesnew name for /dev/sdd1: DATADGCLNnew name for /dev/sde1: DATADGCLN

    27/37

  • ASM HANDS-ON TRAININGLab 15 Cloning An ASM Disk Group On The Same Server

    Check the new headers with kfed

    We can seed that the diskgroup name was updated, and that still there are pointers to the old ASM disks VOL1ER and VOL2ER, we will change that on the next step

    [root@asmxpt ASM-SCRIPTS]# kfed read /dev/sdd1kfbh.endian: 1 ; 0x000: 0x01kfbh.hard: 130 ; 0x001: 0x82kfbh.type: 1 ; 0x002: KFBTYP_DISKHEADkfbh.datfmt: 1 ; 0x003: 0x01kfbh.block.blk: 0 ; 0x004: T=0 NUMB=0x0kfbh.block.obj: 2147483648 ; 0x008: TYPE=0x8 NUMB=0x0kfbh.check: 3652715873 ; 0x00c: 0xd9b80561kfbh.fcn.base: 0 ; 0x010: 0x00000000kfbh.fcn.wrap: 0 ; 0x014: 0x00000000kfbh.spare1: 0 ; 0x018: 0x00000000kfbh.spare2: 0 ; 0x01c: 0x00000000kfdhdb.driver.provstr: ORCLDISKVOL1ER ; 0x000: length=14kfdhdb.driver.reserved[0]: 827084630 ; 0x008: 0x314c4f56kfdhdb.driver.reserved[1]: 21061 ; 0x00c: 0x00005245kfdhdb.driver.reserved[2]: 0 ; 0x010: 0x00000000kfdhdb.driver.reserved[3]: 0 ; 0x014: 0x00000000kfdhdb.driver.reserved[4]: 0 ; 0x018: 0x00000000kfdhdb.driver.reserved[5]: 0 ; 0x01c: 0x00000000kfdhdb.compat: 168820736 ; 0x020: 0x0a100000kfdhdb.dsknum: 0 ; 0x024: 0x0000kfdhdb.grptyp: 1 ; 0x026: KFDGTP_EXTERNALkfdhdb.hdrsts: 3 ; 0x027: KFDHDR_MEMBERkfdhdb.dskname: VOL1ER ; 0x028: length=6kfdhdb.grpname: DATADGCLN ; 0x048: length=9kfdhdb.fgname: VOL1ER ; 0x068: length=6kfdhdb.capname: ; 0x088: length=0

    [root@asmxpt ASM-SCRIPTS]# kfed read /dev/sde1kfbh.endian: 1 ; 0x000: 0x01kfbh.hard: 130 ; 0x001: 0x82kfbh.type: 1 ; 0x002: KFBTYP_DISKHEADkfbh.datfmt: 1 ; 0x003: 0x01kfbh.block.blk: 0 ; 0x004: T=0 NUMB=0x0kfbh.block.obj: 2147483649 ; 0x008: TYPE=0x8 NUMB=0x1kfbh.check: 3669493091 ; 0x00c: 0xdab80563kfbh.fcn.base: 0 ; 0x010: 0x00000000kfbh.fcn.wrap: 0 ; 0x014: 0x00000000kfbh.spare1: 0 ; 0x018: 0x00000000kfbh.spare2: 0 ; 0x01c: 0x00000000kfdhdb.driver.provstr: ORCLDISKVOL2ER ; 0x000: length=14kfdhdb.driver.reserved[0]: 843861846 ; 0x008: 0x324c4f56kfdhdb.driver.reserved[1]: 21061 ; 0x00c: 0x00005245kfdhdb.driver.reserved[2]: 0 ; 0x010: 0x00000000kfdhdb.driver.reserved[3]: 0 ; 0x014: 0x00000000kfdhdb.driver.reserved[4]: 0 ; 0x018: 0x00000000kfdhdb.driver.reserved[5]: 0 ; 0x01c: 0x00000000kfdhdb.compat: 168820736 ; 0x020: 0x0a100000kfdhdb.dsknum: 1 ; 0x024: 0x0001kfdhdb.grptyp: 1 ; 0x026: KFDGTP_EXTERNALkfdhdb.hdrsts: 3 ; 0x027: KFDHDR_MEMBERkfdhdb.dskname: VOL2ER ; 0x028: length=6kfdhdb.grpname: DATADGCLN ; 0x048: length=9kfdhdb.fgname: VOL2ER ; 0x068: length=6kfdhdb.capname: ; 0x088: length=0

    Rename the ASM disks of the cloned devices

    The next step is to rename the ASM disks defined on the cloned devices.

    [root@asmxpt ASM-SCRIPTS]# oracleasm force-renamedisk /dev/sdd1 VOLCLN1Renaming disk "/dev/sdd1" to "VOLCLN1": [ OK ]

    28/37

  • ASM HANDS-ON TRAININGLab 15 Cloning An ASM Disk Group On The Same Server

    [root@asmxpt ASM-SCRIPTS]# oracleasm force-renamedisk /dev/sde1 VOLCLN2Renaming disk "/dev/sde1" to "VOLCLN2": [ OK ][root@asmxpt disks]# oracleasm scandisksScanning system for ASM disks: [ OK ][root@asmxpt disks]# oracleasm listdisksVOL1ERVOL2ERVOLBLK1VOLBLK3VOLBLK4VOLCLN1VOLCLN2

    Check The Diskgroup On The ASM Instance

    Executing asm_dg_dsksGROUP_NUMBER NAME PATH------------ ------------------------------ ------------- 1 DATADGER ORCL:VOL1ER 1 DATADGER ORCL:VOL2ER 2 FRADG ORCL:VOLBLK1 2 FRADG ORCL:VOLBLK3 2 FRADG ORCL:VOLBLK4 0 DATADGCLN ORCL:VOLCLN1 0 DATADGCLN ORCL:VOLCLN2

    Connect To ASM Instance And Mount DG DATADGCLN

    29/37

  • ASM HANDS-ON TRAININGLab 15 Cloning An ASM Disk Group On The Same Server

    Once the disk group is mounted ASM adds it to the list of diskgroups to be mounted on startup, check that also

    SQL> alter diskgroup datadgcln mount;Diskgroup altered.

    SQL> show parameters asm_diskgroupsNAME TYPE VALUE------------------------------------ ----------- ------------------------------asm_diskgroups string FRADG, DATADGER, DATADGCLN

    Prepare The Clone Database To Be Restarted

    At this point we have the source database cloned and its diskgroup mounted by the ASM instance. In order to open it on the same server as the source database we will need to setup parameter files, dump directories and also rename the clone database by creating a new controlfile.

    We will open the source database and use it as a model to generate the required directories and files. The new database name in this case will be sati12

    SQL> set pages 50000 lines 200SQL> select name,value from v$parameter where name in ('background_dump_dest','user_dump_dest','core_dump_dest');NAME VALUE------------------------------ ----------------------------------------------------------------------background_dump_dest /u01/app/oracle/diag/rdbms/sati11/sati11/traceuser_dump_dest /u01/app/oracle/diag/rdbms/sati11/sati11/trace

    30/37

  • ASM HANDS-ON TRAININGLab 15 Cloning An ASM Disk Group On The Same Server

    core_dump_dest /u01/app/oracle/diag/rdbms/sati11/sati11/cdump

    From another window create the dump directories

    [oracle@asmxpt ~]$ mkdir -p /u01/app/oracle/diag/rdbms/sati12/sati12/trace[oracle@asmxpt ~]$ mkdir -p /u01/app/oracle/diag/rdbms/sati12/sati12/cdump[oracle@asmxpt ~]$ mkdir -p /u01/app/oracle/admin/sati12/adump[oracle@asmxpt ~]$ mkdir -p /u01/app/oracle/diag/rdbms/sati12/sati12/alert[oracle@asmxpt ~]$ mkdir -p /u01/app/oracle/diag/rdbms/sati12/sati12/hm[oracle@asmxpt ~]$ mkdir -p /u01/app/oracle/diag/rdbms/sati12/sati12/incident[oracle@asmxpt ~]$ mkdir -p /u01/app/oracle/diag/rdbms/sati12/sati12/incpkg[oracle@asmxpt ~]$ mkdir -p /u01/app/oracle/diag/rdbms/sati12/sati12/ir[oracle@asmxpt ~]$ mkdir -p /u01/app/oracle/diag/rdbms/sati12/sati12/lck[oracle@asmxpt ~]$ mkdir -p /u01/app/oracle/diag/rdbms/sati12/sati12/metada[oracle@asmxpt ~]$ mkdir -p /u01/app/oracle/diag/rdbms/sati12/sati12/stage[oracle@asmxpt ~]$ mkdir -p /u01/app/oracle/diag/rdbms/sati12/sati12/sweep

    Create a pfile from the source and edit it to match the new database, by default the pfile is created on ORACLE_HOME/dbs

    SQL> create pfile='initsati12.ora' from spfile;File created.

    SQL> alter database backup controlfile to trace;Database altered.

    Edit the pfile, change dump directories and diskgroups

    sati11.__db_cache_size=41943040

    31/37

  • ASM HANDS-ON TRAININGLab 15 Cloning An ASM Disk Group On The Same Server

    sati11.__java_pool_size=12582912sati11.__large_pool_size=4194304sati11.__oracle_base='/u01/app/oracle'#ORACLE_BASE set from environmentsati11.__pga_aggregate_target=150994944sati11.__sga_target=201326592sati11.__shared_io_pool_size=0sati11.__shared_pool_size=134217728sati11.__streams_pool_size=0*.audit_file_dest='/u01/app/oracle/admin/sati12/adump'*.audit_trail='none'*.compatible='11.1.0.0.0'*.control_files='+DATADGCLN','+DATADGCLN'*.db_block_size=8192*.db_create_file_dest='+DATADGCLN'*.db_create_online_log_dest_1='+DATADGCLN'*.db_create_online_log_dest_2='+DATADGCLN'*.db_domain=''*.db_name='sati11'*.db_recovery_file_dest='+FRADG'*.db_recovery_file_dest_size=6341787648*.diagnostic_dest='/u01/app/oracle'*.dispatchers='(PROTOCOL=TCP) (SERVICE=sati12XDB)'*.memory_target=352321536*.open_cursors=300*.processes=150*.remote_login_passwordfile='EXCLUSIVE'*.undo_tablespace='UNDOTBS1'

    Edit the create controlfile script change diskgroup

    STARTUP NOMOUNT

    32/37

  • ASM HANDS-ON TRAININGLab 15 Cloning An ASM Disk Group On The Same Server

    CREATE CONTROLFILE SET DATABASE "SATI12" RESETLOGS ARCHIVELOG MAXLOGFILES 16 MAXLOGMEMBERS 3 MAXDATAFILES 100 MAXINSTANCES 8 MAXLOGHISTORY 292LOGFILE GROUP 1 ( '+DATADGCLN/sati11/onlinelog/group_1.263.679145243', '+DATADGCLN/sati11/onlinelog/group_1.264.679145245' ) SIZE 50M, GROUP 2 ( '+DATADGCLN/sati11/onlinelog/group_2.265.679145247', '+DATADGCLN/sati11/onlinelog/group_2.266.679145249' ) SIZE 50M, GROUP 3 ( '+DATADGCLN/sati11/onlinelog/group_3.267.679145253', '+DATADGCLN/sati11/onlinelog/group_3.268.679145255' ) SIZE 50M-- STANDBY LOGFILEDATAFILE '+DATADGCLN/sati11/datafile/system.259.679144027', '+DATADGCLN/sati11/datafile/sysaux.260.679144103', '+DATADGCLN/sati11/datafile/undotbs1.261.679144167', '+DATADGCLN/sati11/datafile/users.262.679144213'CHARACTER SET WE8MSWIN1252;ALTER DATABASE ENABLE BLOCK CHANGE TRACKING;ALTER DATABASE OPEN RESETLOGS;ALTER TABLESPACE TEMP ADD TEMPFILE '+DATADGCLN/sati11/tempfile/temp.269.679145263' SIZE 20971520 REUSE AUTOEXTEND ON NEXT 655360 MAXSIZE 33554431M;

    33/37

  • ASM HANDS-ON TRAININGLab 15 Cloning An ASM Disk Group On The Same Server

    Recreate The Controlfile And Rename The Cloned Database

    Point the environment to the new instance and start it up with no mount option, execute the create controlfile script

    ORACLE_BASE=/u01/app/oracleORACLE_HOME=/u01/app/oracle/11g_dbORACLE_SID=sati12SQL> startup nomountORACLE instance started.

    Total System Global Area 351522816 bytesFixed Size 1313344 bytesVariable Size 213910976 bytesDatabase Buffers 130023424 bytesRedo Buffers 6275072 bytes

    SQL> @/tmp/CRCTL_sati12SQL> CREATE CONTROLFILE SET DATABASE "SATI12" RESETLOGS ARCHIVELOG 2 MAXLOGFILES 16 3 MAXLOGMEMBERS 3 4 MAXDATAFILES 100 5 MAXINSTANCES 8 6 MAXLOGHISTORY 292 7 LOGFILE 8 GROUP 1 ( 9 '+DATADGCLN/sati11/onlinelog/group_1.263.679145243', 10 '+DATADGCLN/sati11/onlinelog/group_1.264.679145245' 11 ) SIZE 50M,

    34/37

  • ASM HANDS-ON TRAININGLab 15 Cloning An ASM Disk Group On The Same Server

    12 GROUP 2 ( 13 '+DATADGCLN/sati11/onlinelog/group_2.265.679145247', 14 '+DATADGCLN/sati11/onlinelog/group_2.266.679145249' 15 ) SIZE 50M, 16 GROUP 3 ( 17 '+DATADGCLN/sati11/onlinelog/group_3.267.679145253', 18 '+DATADGCLN/sati11/onlinelog/group_3.268.679145255' 19 ) SIZE 50M 20 -- STANDBY LOGFILE 21 DATAFILE 22 '+DATADGCLN/sati11/datafile/system.259.679144027', 23 '+DATADGCLN/sati11/datafile/sysaux.260.679144103', 24 '+DATADGCLN/sati11/datafile/undotbs1.261.679144167', 25 '+DATADGCLN/sati11/datafile/users.262.679144213' 26 CHARACTER SET WE8MSWIN1252 27 ;

    Control file created.

    SQL> ALTER DATABASE ENABLE BLOCK CHANGE TRACKING;Database altered.

    SQL> ALTER DATABASE OPEN RESETLOGS;Database altered.

    SQL> ALTER TABLESPACE TEMP ADD TEMPFILE '+DATADGCLN/sati11/tempfile/temp.269.679145263' SIZE 20971520 REUSE AUTOEXTEND ON NEXT 655360 MAXSIZE 33554431M;Tablespace altered.

    35/37

  • ASM HANDS-ON TRAININGLab 15 Cloning An ASM Disk Group On The Same Server

    Check That Cloned Database Sati12 is Operational

    To check we will run script runload12 that populate and select in a loop from a small table

    [oracle@asmxpt ~]$ ./runload12SQL*Plus: Release 11.1.0.7.0 - Production on Wed Feb 18 15:23:55 2009

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

    Connected to:Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - ProductionWith the Partitioning, OLAP, Data Mining and Real Application Testing options

    SQL> SQL>NAME---------SATI12SQL>Table dropped.SQL> 2Table created.SQL>31 rows created.SQL>USERNAME PASSWORD ACCOUNT_STATUS

    36/37

  • ASM HANDS-ON TRAININGLab 15 Cloning An ASM Disk Group On The Same Server

    ------------------------------ ------------------------------ --------------------------------SYSTEM OPENSYS OPENMGMT_VIEW OPENSYSMAN OPENDBSNMP OPENAVARGAS OPEN

    The new ASM Diskgroup

    ASMCMD> lsdgState Type Rebal Sector Block AU Total_MB Free_MB Req_mir_free_MB Usable_file_MB Offline_disks NameMOUNTED EXTERN N 512 4096 1048576 4094 1677 0 1677 0 DATADGCLN/MOUNTED EXTERN N 512 4096 1048576 4094 1721 0 1721 0 DATADGER/MOUNTED EXTERN N 512 4096 1048576 6141 3781 0 3781 0 FRADG/

    ASMCMD> ls -l DATADGCLN/SATI11/Type Redund Striped Time Sys Name N CONTROLFILE/ N DATAFILE/ N ONLINELOG/ N PARAMETERFILE/ N TEMPFILE/ASMCMD> ls -l DATADGCLN/SATI12/Type Redund Striped Time Sys Name Y CHANGETRACKING/ Y CONTROLFILE/

    ASMCMD> ls -l DATADGCLN/SATI11/DATAFILEType Redund Striped Time Sys NameDATAFILE UNPROT COARSE FEB 18 16:00:00 Y SYSAUX.260.679144103DATAFILE UNPROT COARSE FEB 18 16:00:00 Y SYSTEM.259.679144027DATAFILE UNPROT COARSE FEB 18 16:00:00 Y UNDOTBS1.261.679144167DATAFILE UNPROT COARSE FEB 18 16:00:00 Y USERS.262.679144213

    End of Lab15

    37/37

    SummaryPrepare The EnvironmentRemove The Database From The Normal Redundancy DiskgroupDrop The Normal Redundancy DiskgroupRecreate the ASM VolumesAdd ASM Disk VOLBLK4 To The FRADG DiskgroupCreate a New External Redundancy DiskgroupCheck That The Database Is OperationalExecute a Consistent Database ShutdownCreate A Clone Of The Database ASM DisksAdd Path To Kfed On User Root ProfileCheck the headers of the copied pairs with kfedRename The Cloned ASM DisksCheck the new headers with kfedConnect To ASM Instance And Mount DG DATADGCLNPrepare The Clone Database To Be RestartedRecreate The Controlfile And Rename The Cloned Database