You are on page 1of 19

http://skrajend.blogspot.in/2007/06/asm-rman-backup-configuration.html ASM Initialization Parameters Initialization Parameter Description Defines the instance as an ASM instance.

This is the onlyrequired parameter to identify an ASM instance; the remainder can be left at their defaults Defines the service provider name for which this ASM instance manages disk groups. +ASM is the default value, and should not be modified unless multiple ASM instances are on the same node Controls rebalance operation speed. Values range from 1 to 11, with 11 being the fastest. If omitted, this value defaults to 1. The number of slaves is derived from the parallelization level specified in a manual rebalance command (POWER), or by the ASM_POWER_LIMIT parameter An operating system dependent value; used by ASM to limit the set of disks considered for discovery Describes the list of ASM disk group names to be mounted by an ASM instance at startup, or whenever the ALTER DISKGROUP ALL MOUNT command is used The LARGE POOL size. This must be set to a minimum of 8MB, but Oracle recommends setting this to 16MB

INSTANCE_TYPE

DB_UNIQUE_NAME

ASM_POWER_LIMIT

ASM_DISKSTRING

ASM_DISK_GROUPS

LARGE_POOL_SIZE

ASM Adding a New DiskGroup **The below Steps for creating Disk are Not Standard** **They are Faking Hardware Steps** [root@lab01 oracle]# cd /asmdisks/ [root@lab01 asmdisks]# dd if=/dev/zero of=/asmdisks/disk6 bs=1024k count=1000 1000+0 records in 1000+0 records out [root@lab01 asmdisks]# dd if=/dev/zero of=/asmdisks/disk7 bs=1024k count=1000 1000+0 records in 1000+0 records out [root@lab01 asmdisks]# /sbin/losetup /dev/loop6 /asmdisks/disk6 [root@lab01 asmdisks]# /sbin/losetup /dev/loop7 /asmdisks/disk7 [root@lab01 asmdisks]# /etc/init.d/oracleasm createdisk ASMD6 /dev/loop6 Marking disk "/dev/loop6" as an ASM disk: [ OK ] [root@lab01 asmdisks]# /etc/init.d/oracleasm createdisk ASMD7 /dev/loop7 Marking disk "/dev/loop7" as an ASM disk: [ OK ] [root@lab01 asmdisks]# **The above Steps for creating Disk are Not Standard** **They are Faking Hardware Steps** SQL> select group_number,disk_number,name,state,mode_status,mount_status,total_mb,free_mb from v$asm_disk;

G# D# NAME STATE MODE_ST MOUNT_S TOTAL_MB FREE_MB -- -- ----- -------- ------- ------- ---------- ---------0 0 NORMAL ONLINE CLOSED 1000 0 0 1 NORMAL ONLINE CLOSED 1000 0 1 0 ASMD1 NORMAL ONLINE CACHED 1000 516 1 1 ASMD2 NORMAL ONLINE CACHED 1000 509 1 2 ASMD3 NORMAL ONLINE CACHED 1000 509 1 3 ASMD4 NORMAL ONLINE CACHED 1000 514 1 4 ASMD5 NORMAL ONLINE CACHED 1000 516 7 rows selected. SQL> SQL> CREATE DISKGROUP DG1 NORMAL REDUNDANCY FAILGROUP failure_group_1 DISK 'ORCL:ASMD6' FAILGROUP failure_group_2 DISK 'ORCL:ASMD7'; 2 3 Diskgroup created. SQL> ASM Alert Log File SQL> CREATE DISKGROUP DG1 NORMAL REDUNDANCY FAILGROUP failure_group_1 DISK 'ORCL:ASMD6' FAILGROUP failure_group_2 DISK 'ORCL:ASMD7' Sat Mar 17 21:46:42 2007 NOTE: initializing header on grp 2 disk ASMD6 NOTE: initializing header on grp 2 disk ASMD7 Sat Mar 17 21:46:42 2007 NOTE: PST update: grp = 2 Sat Mar 17 21:46:42 2007 NOTE: group DG1: initial PST locations: disk 0000 (PST copy 0) NOTE: group DG1: initial PST locations: disk 0001 (PST copy 1) Sat Mar 17 21:46:42 2007 NOTE: cache registered group DG1 number=2 incarn=0x54a10c2f NOTE: cache opening disk 0 of grp 2: ASMD6 label:ASMD6 NOTE: cache opening disk 1 of grp 2: ASMD7 label:ASMD7 NOTE: cache creating group 2/0x54A10C2F (DG1) NOTE: cache mounting group 2/0x54A10C2F (DG1) succeeded NOTE: allocating F1X0 on grp 2 disk ASMD6 NOTE: allocating F1X0 on grp 2 disk ASMD7 NOTE: diskgroup must now be re-mounted prior to first use NOTE: cache dismounting group 2/0x54A10C2F (DG1) Sat Mar 17 21:46:53 2007 SUCCESS: diskgroup DG1 was created NOTE: cache registered group DG1 number=2 incarn=0xaf310c31 Sat Mar 17 21:46:53 2007 NOTE: Hbeat: instance first (grp 2) Sat Mar 17 21:46:57 2007 NOTE: start heartbeating (grp 2) NOTE: cache opening disk 0 of grp 2: ASMD6 label:ASMD6 Sat Mar 17 21:46:57 2007 NOTE: F1X0 found on disk 0 fcn 0.0 NOTE: cache opening disk 1 of grp 2: ASMD7 label:ASMD7 NOTE: F1X0 found on disk 1 fcn 0.0 NOTE: cache mounting (first) group 2/0xAF310C31 (DG1)

NOTE: cache recovered group 2 to fcn 0.0 Sat Mar 17 21:46:57 2007 NOTE: opening chunk 1 at fcn 0.0 ABA NOTE: seq=2 blk=0 Sat Mar 17 21:46:57 2007 NOTE: cache mounting group 2/0xAF310C31 (DG1) succeeded SUCCESS: diskgroup DG1 was mounted Sat Mar 17 21:46:59 2007 NOTE: recovering COD for group 2/0xaf310c31 (DG1) SUCCESS: completed COD recovery for group 2/0xaf310c31 (DG1) SQL> select group_number,disk_number,name,state,mode_status,mount_status,total_mb,free_mb from v$asm_disk; G# D# NAME STATE MODE_ST MOUNT_S TOTAL_MB FREE_MB -- -- ----- -------- ------- ------- ---------- ---------1 0 ASMD1 NORMAL ONLINE CACHED 1000 516 1 1 ASMD2 NORMAL ONLINE CACHED 1000 509 1 2 ASMD3 NORMAL ONLINE CACHED 1000 509 1 3 ASMD4 NORMAL ONLINE CACHED 1000 514 1 4 ASMD5 NORMAL ONLINE CACHED 1000 516 2 0 ASMD6 NORMAL ONLINE CACHED 1000 949 2 1 ASMD7 NORMAL ONLINE CACHED 1000 949 7 rows selected. SQL> SQL> select name,redundancy,failgroup,path from v$asm_disk where group_number=2; NAME REDUNDA FAILGROUP PATH ----- ------- ---------------- -------------------ASMD6 UNKNOWN FAILURE_GROUP_1 ORCL:ASMD6 ASMD7 UNKNOWN FAILURE_GROUP_2 ORCL:ASMD7 SQL> SQL> CREATE TABLESPACE T1 DATAFILE '+DG1'; Tablespace created. SQL> AlertLog Content Sat Mar 17 21:53:25 2007 CREATE TABLESPACE T1 DATAFILE '+DG1' Sat Mar 17 21:53:29 2007 SUCCESS: diskgroup DG1 was mounted Sat Mar 17 21:53:48 2007 SUCCESS: diskgroup DG1 was dismounted Sat Mar 17 21:53:48 2007 SUCCESS: diskgroup DG1 was mounted SUCCESS: diskgroup DG1 was dismounted SUCCESS: diskgroup DG1 was mounted Sat Mar 17 21:53:49 2007 Completed: CREATE TABLESPACE T1 DATAFILE '+DG1' SQL> select group_number,disk_number,name,state,mode_status,mount_status,total_mb,free_mb from v$asm_disk where group_number=2;

G# D# NAME STATE MODE_ST MOUNT_S TOTAL_MB FREE_MB -- -- ----- -------- ------- ------- ---------- ---------2 0 ASMD6 NORMAL ONLINE CACHED 1000 846 2 1 ASMD7 NORMAL ONLINE CACHED 1000 846 SQL> SQL> select name from v$datafile where ts# in ( select ts# from v$tablespace where name='T1'); NAME -------------------------------------------------------------------------------+DG1/odb/datafile/t1.256.617493211 SQL> SQL> create user u1 identified by u1 default tablespace t1; SQL> grant connect,resource to u1; SQL> connect u1/u1 SQL> create table tt1 as select * from user_objects; Table created. SQL> # - Posted by Senthil Rajendran - 3/17/07; 10:00:44 PM - Comment [0] V$ASM and useful Queries Query to find the Database that uses the disk group managed by the ASM Instance. SQL> select instance_name,db_name,status from v$asm_client; INSTANCE DB_NAME STATUS -------- -------- -----------ODB ODB CONNECTED SQL> Query to find the Disk that are discovered by the ASM Instance SQL> select group_number,disk_number,name,state,mode_status,mount_status,total_mb,free_mb from v$asm_disk; G# D# NAME STATE MODE_ST MOUNT_S TOTAL_MB FREE_MB -- -- ----- -------- ------- ------- -------- ------1 0 ASMD1 NORMAL ONLINE CACHED 1000 516 1 1 ASMD2 NORMAL ONLINE CACHED 1000 509 1 2 ASMD3 NORMAL ONLINE CACHED 1000 509 1 3 ASMD4 NORMAL ONLINE CACHED 1000 514 1 4 ASMD5 NORMAL ONLINE CACHED 1000 516 Query to find the Redundancy and FailGroup for Disks SQL> select name,redundancy,failgroup,path from v$asm_disk; NAME REDUNDA FAILGROUP PATH ----- ------- ---------- ---------ASMD1 UNKNOWN ASMD1 ORCL:ASMD1 ASMD2 UNKNOWN ASMD2 ORCL:ASMD2 ASMD3 UNKNOWN ASMD3 ORCL:ASMD3 ASMD4 UNKNOWN ASMD4 ORCL:ASMD4 ASMD5 UNKNOWN ASMD5 ORCL:ASMD5 SQL>

Query to view the Disk Group and its details SQL> select group_number,name,state,type,total_mb,free_mb,usable_file_mb,unbalanced from v$asm_diskgroup; G# NAME STATE TYPE TOTAL_MB FREE_MB USABLE_FILE_MB U -- ----- -------- ------ -------- -------- -------------- 1 DATA MOUNTED NORMAL 5000 2564 782 N SQL> Query to view the ASM File Details SQL> select group_number,file_number,bytes,space,type,redundancy,striped from v$asm_file; GROUP_# FILE# BYTES SPACE TYPE REDUND STRIPE ------ ----- --------- ---------- -------------- ------ -----1 256 503324672 1011875840 DATAFILE MIRROR COARSE 1 257 241180672 487587840 DATAFILE MIRROR COARSE 1 258 26222592 54525952 DATAFILE MIRROR COARSE 1 259 5251072 12582912 DATAFILE MIRROR COARSE 1 260 7061504 25165824 CONTROLFILE HIGH FINE 1 261 7061504 25165824 CONTROLFILE HIGH FINE 1 262 52429312 120586240 ONLINELOG MIRROR FINE 1 263 52429312 120586240 ONLINELOG MIRROR FINE 1 264 52429312 120586240 ONLINELOG MIRROR FINE 1 265 52429312 120586240 ONLINELOG MIRROR FINE 1 266 52429312 120586240 ONLINELOG MIRROR FINE 1 267 52429312 120586240 ONLINELOG MIRROR FINE 1 268 20979712 44040192 TEMPFILE MIRROR COARSE 1 269 2560 2097152 PARAMETERFIL MIRROR COARSE 14 rows selected. SQL> ASM: Migrating Non-ASM Tablespace to ASM Tablespace Introduction: Here we will see how to migrate a Non-ASM Tablespace to ASM Tablespace. SQL> create tablespace test1 datafile '/home2/oracle/ora10g/datafile/test1a.dbf' size 20m autoextend on next 10m maxsize 100m, '/home2/oracle/ora10g/datafile/test1b.dbf' size 20m autoextend on next 10m maxsize 100m extent management local; Tablespace created. SQL> select name from v$datafile where ts# in 2 (select ts# from v$tablespace where name='TEST1'); NAME -------------------------------------------------------------------------------/home2/oracle/ora10g/datafile/test1a.dbf /home2/oracle/ora10g/datafile/test1b.dbf SQL> SQL> create user test1 identified by test1 default tablespace test1;

User created. SQL> grant connect,resource to test1; Grant succeeded. SQL> connect test1/test1 Connected. SQL> create table t1 as select * from all_tables; Table created. SQL> select * from tab; TNAME TABTYPE CLUSTERID ------------------------------ ------- ---------T1 TABLE SQL> SQL> select name from v$datafile; NAME -------------------------------------------------------------------------------+DATA/odb/datafile/system.256.617411373 +DATA/odb/datafile/undotbs1.258.617411379 +DATA/odb/datafile/sysaux.257.617411377 +DATA/odb/datafile/users.259.617411381 +DG1/odb/datafile/t1.256.617493211 /home2/oracle/ora10g/datafile/test1a.dbf /home2/oracle/ora10g/datafile/test1b.dbf 7 rows selected. SQL>

-bash-2.05b$ rman nocatalog target / RMAN> sql "alter tablespace test1 offline"; sql statement: alter tablespace test1 offline RMAN> backup as copy tablespace test1 format '+DG1'; Starting backup at 20-MAR-07 allocated channel: ORA_DISK_1 channel ORA_DISK_1: sid=148 devtype=DISK channel ORA_DISK_1: starting datafile copy input datafile fno=00006 name=/home2/oracle/ora10g/datafile/test1a.dbf output filename=+DG1/odb/datafile/test1.261.617749583 tag=TAG20070320T210622 recid=1 stamp=617749585 channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:07 channel ORA_DISK_1: starting datafile copy input datafile fno=00007 name=/home2/oracle/ora10g/datafile/test1b.dbf output filename=+DG1/odb/datafile/test1.262.617749589 tag=TAG20070320T210622 recid=2 stamp=617749592 channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:07 Finished backup at 20-MAR-07

RMAN> switch tablespace test1 to copy; datafile 6 switched to datafile copy "+DG1/odb/datafile/test1.261.617749583" datafile 7 switched to datafile copy "+DG1/odb/datafile/test1.262.617749589" RMAN> sql "alter tablespace test1 online"; sql statement: alter tablespace test1 online RMAN> exit Recovery Manager complete. -bash-2.05b$ sqlplus "/ as sysdba" SQL*Plus: Release 10.2.0.1.0 - Production on Tue Mar 20 21:07:32 2007 SQL> select name from v$datafile; NAME -------------------------------------------------------------------------------+DATA/odb/datafile/system.256.617411373 +DATA/odb/datafile/undotbs1.258.617411379 +DATA/odb/datafile/sysaux.257.617411377 +DATA/odb/datafile/users.259.617411381 +DG1/odb/datafile/t1.256.617493211 +DG1/odb/datafile/test1.261.617749583 +DG1/odb/datafile/test1.262.617749589 7 rows selected. SQL> connect test1/test1 Connected. SQL> select count(*) from t1; COUNT(*) ---------91 SQL>

ASM Instance Operational Procedure Operational Procedure for ASM Instance Startup Sequence 1. Start the ASM Instance 2. Start the ASM Enabled Database 3. Start the Listener for ASM Enabled Database Source the Environment Variable ORACLE_HOME Export ORACLE_SID=+ASM Login as sys dba and issue STARTUP Command $ sqlplus "/ as sysdba" SQL*Plus: Release 10.2.0.1.0 - Production on Sat Mar 17 19:41:49 2007 Copyright (c) 1982, 2005, Oracle. All rights reserved. Connected to an idle instance. SQL> startup ASM instance started Total System Global Area 83886080 bytes Fixed Size 1217836 bytes

Variable Size 57502420 bytes ASM Cache 25165824 bytes ASM diskgroups mounted SQL> Background Process: $ ps -ef | grep -i asm ora10g 4682 1 0 19:42 ? 00:00:00 asm_pmon_+ASM ora10g 4684 1 0 19:42 ? 00:00:00 asm_psp0_+ASM ora10g 4686 1 0 19:42 ? 00:00:00 asm_mman_+ASM ora10g 4688 1 0 19:42 ? 00:00:00 asm_dbw0_+ASM ora10g 4690 1 0 19:42 ? 00:00:00 asm_lgwr_+ASM ora10g 4692 1 0 19:42 ? 00:00:00 asm_ckpt_+ASM ora10g 4694 1 0 19:42 ? 00:00:00 asm_smon_+ASM ora10g 4696 1 0 19:42 ? 00:00:00 asm_rbal_+ASM ora10g 4698 1 0 19:42 ? 00:00:00 asm_gmon_+ASM ora10g 4703 4651 0 19:50 pts/0 00:00:00 grep -i asm $ Additional Processes: RBAL - ReBalancer , its duty is to rebalance the activity for ASM Disk Groups Starting the ASM Dependent Database Export ORACLE_SID=ODB Login as sys dba and issue STARTUP Command $ export ORACLE_SID=ODB $ sqlplus "/ as sysdba" SQL*Plus: Release 10.2.0.1.0 - Production on Sat Mar 17 19:59:23 2007 Copyright (c) 1982, 2005, Oracle. All rights reserved. Connected to an idle instance. SQL> startup ORACLE instance started. Total System Global Area 167772160 bytes Fixed Size 1218316 bytes Variable Size 71305460 bytes Database Buffers 92274688 bytes Redo Buffers 2973696 bytes Database mounted. Database opened. SQL> Starting the Listener of the ASM Dependent Database $ lsnrctl start ODB Shutdown Operation is the reverse of the Startup 1. Stop the Listener 2. Stop the ASM Enabled Database 3. Stop the ASM Instance Summary Startup and Shutdown of ASM Instances ASM instance are started and stopped in a similar way to normal database instances. The options for the STARTUP command are: FORCE - Performs a SHUTDOWN ABORT before restarting the ASM instance. MOUNT - Starts the ASM instance and mounts the disk groups specified by the ASM_DISKGROUPS parameter. NOMOUNT - Starts the ASM instance without mounting any disk groups.

OPEN - This is not a valid option for an ASM instance. The options for the SHUTDOWN command are: NORMAL - The ASM instance waits for all connected ASM instances and SQL sessions to exit then shuts down. IMMEDIATE - The ASM instance waits for any SQL transactions to complete then shuts down. It doesn't wait for sessions to exit. TRANSACTIONAL - Same as IMMEDIATE. ABORT - The ASM instance shuts down instantly.

ASM : RMAN Backup Configuration Introduction : The following will guide one to take a backup of ASM Enabled Database using RMAN. The following are the steps involved; Setting Up a Database for RMAN Setting Up Recovery Area for RMAN Setting Up a Database for RMAN Configuring the Backup Retention Policy Retention Policy is of two options: Window-Based Retention Policy Redundancy-Based Retention Policy Configuring a Recovery Window-Based Retention Policy: The recovery window parameters specifies the number of days between the current time and the earliest point of recoverability. CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 7 DAYS; The above can recover the database to any point withing the last week. RMAN does not automatically delete backups rendered obsolute by the recovery window. Instead RMAN marks them as OBSOLUTE in the REPORT OBSOLUTE output. RMAN retains all archived logs and incremental backups that are needed to recover the nonobsolete backups. Configuring a Redundancy-Based Retention Policy: The redundancy parameter specified the number of backups that has to be maintained for the Datafile & Controlfile by RMAN. RMAN will mark the backups to be obsoluted , if the number of backups for a specific datafile or control file exceeds the Redundancy Setting. RMAN keeps a track of which ones to retain and which are obsoluted. CONFIGURE RETENTION POLICY TO REDUNDANCY 2; The above will set RMAN to have only 2 backups of the datafile or controlfile. If a backup is taken after that then the older one will be obsoluted. RMAN retains all archived logs and incremental backups that are needed to recover the nonobsolete backups. Configuring Control File and Server Parameter File Autobackup RMAN can be configured to automatically back up the control file and server parameter file whenever the database structure metadata in the control file changes and whenever a backup record is added. The autobackup enables RMAN to recover the database even if the current control file, catalog, and server parameter file are lost. Enabling : CONFIGURE CONTROLFILE AUTOBACKUP ON;

Disabling: CONFIGURE CONTROLFILE AUTOBACKUP OFF; The following command will configure RMAN the autobackup to write to an ASM DiskGroup ASM Instance : (To create the disk group ) CREATE DISKGROUP CONTROL NORMAL REDUNDANCY FAILGROUP failure_group_1 DISK 'ORCL:ASMD6' FAILGROUP failure_group_2 DISK 'ORCL:ASMD7'; RMAN : CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '+CONTROL'; Optimizing the RMAN Backup: Backup file optimization can be used to prevent repeat backups of read-only tablespaces and archive logs: Read-only and offline-clean data files are only backed up once per recovery window. The command BACKUP ARCHIVELOG ALL only backs up logs that are not already on tape. The command BACKUP BACKUPSET ALL copies to tape all backup sets that do not already exist on tape. Backup optimization is configured using: CONFIGURE BACKUP OPTIMIZATION [ON | OFF | CLEAR]; Once you are done with the RMAN Configuration now we have to Setup the Flash Recovery Area. Setting Up Recovery Area for RMAN The flash recovery area feature lets you set up a location on disk where the database can create and manage a variety of backup and recovery-related files. Using a flash recovery area simplifies the ongoing administration of your database by automatically naming files, retaining them as long as they are needed for restore and recovery activities, and deleting them when they are no longer needed to restore your database and space is needed for some other backup and recovery-related purpose. Choosing a Location for the Flash Recovery Area: When setting up a flash recovery area , we need to specify a location. The Location can be a Directory or ASM Disk Group to hold the files. Files That Can Be Stored in the Flash Recovery Area: Files are classified as permanent and transient. Permanent are the control files and online redolog files , all the other rest of the files are transient as RMAN will delete the files when they become obsoulte based on the retentition policy defined. Planning the Size of the Flash Recovery Area: The size should be large enough to hold the following; A copy of all datafiles Incremental backups, as used by your chosen backup strategy Online redo logs Archived redo logs not yet backed up to tape Control files Control file autobackups (which include copies of the control file and SPFILE) Setting Initialization Parameters for the Flash Recovery Area Two key initialization Parameters are involved in setting up the flash recovery area. DB_RECOVERY_FILE_DEST_SIZE - which specifies the disk quota, or maximum space to use for flash recovery area files for this database DB_RECOVERY_FILE_DEST - which specifies the location of the flash recovery area

10

In our case we are going to use a Disk Group for the Destination which is of 2GB; ASM Instance: CREATE DISKGROUP ARCH EXTERNAL REDUNDANCY DISK 'ORCL:ASMD8','ORCL:ASMD9','ORCL:ASMD10','ORCL:ASMD11'; ASM Enabled Instance: SQL> show parameter db_recovery_file_dest NAME TYPE VALUE ------------------------------------ --db_recovery_file_dest string +ARCH db_recovery_file_dest_size big integer 2G SQL> LAB: Connect to the ASM Instance and Create the DiskGroup for the Control File Autobackup SQL> CREATE DISKGROUP CONTROL NORMAL REDUNDANCY FAILGROUP failure_group_1 DISK 'ORCL:ASMD6' FAILGROUP failure_group_2 DISK 'ORCL:ASMD7'; Diskgroup created. SQL> SQL> CREATE DISKGROUP ARCH EXTERNAL REDUNDANCY DISK 'ORCL:ASMD8','ORCL:ASMD9','ORCL:ASMD10','ORCL:ASMD11'; Diskgroup created. SQL> Connect to RMAN and configure the Settings RMAN> CONFIGURE RETENTION POLICY TO REDUNDANCY 2; new RMAN configuration parameters: CONFIGURE RETENTION POLICY TO REDUNDANCY 2; new RMAN configuration parameters are successfully stored RMAN> CONFIGURE CONTROLFILE AUTOBACKUP ON; new RMAN configuration parameters: CONFIGURE CONTROLFILE AUTOBACKUP ON; new RMAN configuration parameters are successfully stored RMAN> RMAN> CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '+CONTROL'; new RMAN configuration parameters: CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '+CONTROL'; new RMAN configuration parameters are successfully stored

11

RMAN> RMAN> CONFIGURE BACKUP OPTIMIZATION ON; new RMAN configuration parameters: CONFIGURE BACKUP OPTIMIZATION ON; new RMAN configuration parameters are successfully stored RMAN> RMAN> BACKUP DATABASE PLUS ARCHIVELOG; Starting backup at 30-MAR-07 current log archived allocated channel: ORA_DISK_1 channel ORA_DISK_1: sid=151 devtype=DISK channel ORA_DISK_1: starting archive log backupset channel ORA_DISK_1: specifying archive log(s) in backup set input archive log thread=1 sequence=6 recid=1 stamp=617555015 input archive log thread=1 sequence=7 recid=2 stamp=617743035 input archive log thread=1 sequence=8 recid=3 stamp=617744460 input archive log thread=1 sequence=9 recid=4 stamp=617747694 input archive log thread=1 sequence=10 recid=5 stamp=618009531 input archive log thread=1 sequence=11 recid=6 stamp=618356756 input archive log thread=1 sequence=12 recid=7 stamp=618357083 input archive log thread=1 sequence=13 recid=8 stamp=618360354 input archive log thread=1 sequence=14 recid=9 stamp=618360687 input archive log thread=1 sequence=15 recid=10 stamp=618567572 input archive log thread=1 sequence=16 recid=11 stamp=618571214 channel ORA_DISK_1: starting piece 1 at 30-MAR-07 channel ORA_DISK_1: finished piece 1 at 30-MAR-07 piece handle=+ARCH/odb/backupset/2007_03_30/annnf0_tag20070330t092016_0.287.618571219 tag=TAG20070330T092016 comment=NONE channel ORA_DISK_1: backup set complete, elapsed time: 00:01:29 Finished backup at 30-MAR-07 Starting backup at 30-MAR-07 using channel ORA_DISK_1 channel ORA_DISK_1: starting full datafile backupset channel ORA_DISK_1: specifying datafile(s) in backupset input datafile fno=00001 name=+DATA/odb/datafile/system.256.617411373 input datafile fno=00003 name=+DATA/odb/datafile/sysaux.257.617411377 input datafile fno=00002 name=+DATA/odb/datafile/undotbs1.258.617411379 input datafile fno=00004 name=+DATA/odb/datafile/users.259.617411381 channel ORA_DISK_1: starting piece 1 at 30-MAR-07 channel ORA_DISK_1: finished piece 1 at 30-MAR-07 piece handle=+ARCH/odb/backupset/2007_03_30/nnndf0_tag20070330t092148_0.286.618571311 tag=TAG20070330T092148 comment=NONE channel ORA_DISK_1: backup set complete, elapsed time: 00:03:50 Finished backup at 30-MAR-07 Starting backup at 30-MAR-07 current log archived using channel ORA_DISK_1 channel ORA_DISK_1: starting archive log backupset channel ORA_DISK_1: specifying archive log(s) in backup set input archive log thread=1 sequence=17 recid=12 stamp=618571546

12

channel ORA_DISK_1: starting piece 1 at 30-MAR-07 channel ORA_DISK_1: finished piece 1 at 30-MAR-07 piece handle=+ARCH/odb/backupset/2007_03_30/annnf0_tag20070330t092547_0.283.618571549 tag=TAG20070330T092547 comment=NONE channel ORA_DISK_1: backup set complete, elapsed time: 00:00:03 Finished backup at 30-MAR-07 Starting Control File and SPFILE Autobackup at 30-MAR-07 piece handle=+CONTROL/odb/autobackup/2007_03_30/s_618571551.256.618571557 comment=NONE Finished Control File and SPFILE Autobackup at 30-MAR-07 RMAN> ASM : Command Line Utility Introduction : Here we will see how to Instance ASM Command Line Utility and its features Pre-Requisite : Download a Copy of ASM Command Line Utility for ASM Release 10.1 Installation Steps: [root@in asm_command]# ls -lrt total 48 -rw-r--r-- 1 root root 48359 Mar 31 09:33 asmcmd_10.2.0.1.0.zip [root@in asm_command]# unzip asmcmd_10.2.0.1.0.zip Archive: asmcmd_10.2.0.1.0.zip inflating: README inflating: asmcmd inflating: asmcmd.bat inflating: asmcmdcore [root@in asm_command]# ls -lrt total 276 -r-xr-x--- 1 root root 3099 Aug 11 2005 asmcmd -r--r----- 1 root root 214856 Aug 11 2005 asmcmdcore -r-xr-x--- 1 root root 1728 Aug 11 2005 asmcmd.bat -rw-r--r-- 1 root root 1231 Aug 11 2005 README -rw-r--r-- 1 root root 48359 Mar 31 09:33 asmcmd_10.2.0.1.0.zip [root@in asm_command]# Usage Steps: ora10g$ export ORACLE_SID=+ASM ora10g$ asmcmd ASMCMD> Commands: 1. Command to List all the Files and Directories ASMCMD> ls ARCH/ CONTROL/ DATA/ ASMCMD> ASMCMD> ls -l State Type Rebal Unbal Name

13

MOUNTED EXTERN N N ARCH/ MOUNTED NORMAL N N CONTROL/ MOUNTED NORMAL N N DATA/ ASMCMD> ASMCMD> ls -lrt * Type Redund Striped Time Sys Name +ARCH/: Y ODB/ +CONTROL/: Y ODB/ +DATA/: Y DB_UNKNOWN/ Y ODB/ ASMCMD> 2. Command to Change Directory ASMCMD> cd +DATA 3. Command to List the Present Working Direcoty ASMCMD> pwd +DATA ASMCMD> Advanced Commands ASMCMD> cd ODB ASMCMD> ls -l Type Redund Striped Time Sys Name Y DB_UNKNOWN/ Y ODB/ ASMCMD> cd ODB ASMCMD> ls -l Type Redund Striped Time Sys Name Y CONTROLFILE/ Y DATAFILE/ Y ONLINELOG/ Y TEMPFILE/ N spfileodb.ora => +DATA/DB_UNKNOWN/PARAMETERFILE/SPFILE.269.617745979 ASMCMD> ASMCMD> ls * +DATA/ODB/CONTROLFILE/: Current.260.617411609 Current.261.617411607 +DATA/ODB/DATAFILE/: SYSAUX.257.617411377 SYSTEM.256.617411373 T1.271.617752879 T1.272.618010569 T1.273.618010785 UNDOTBS1.258.617411379

14

USERS.259.617411381 t.data_d-odb_i-2580585621_ts-t1_fno-5_0cidc5u7 t.data_d-odb_i-2580585621_ts-t1_fno-5_0didc651 t1_5_db_odb +DATA/ODB/ONLINELOG/: group_1.262.617411613 group_1.263.617411665 group_2.264.617411719 group_2.265.617411773 group_3.266.617411845 group_3.267.617411929 +DATA/ODB/TEMPFILE/: TEMP.268.617412065 spfileodb.ora ASMCMD> ASM : RMAN Restoration and Recovery Introduction: In the below steps we will Restore the Database which is ASM Enabled. LAB RMAN> list backup summary; List of Backups =============== Key TY LV S Device Type Completion Time #Pieces #Copies Compressed Tag ------- -- -- - ----------- --------------- ------- ------- ---------- --9 B A A DISK 30-MAR-07 1 1 NO TAG20070330T092016 10 B F A DISK 30-MAR-07 1 1 NO TAG20070330T092148 11 B A A DISK 30-MAR-07 1 1 NO TAG20070330T092547 12 B F A DISK 30-MAR-07 1 1 NO TAG20070330T092551 13 B A A DISK 30-MAR-07 1 1 NO TAG20070330T220423 14 B F A DISK 30-MAR-07 1 1 NO TAG20070330T220455 15 B A A DISK 30-MAR-07 1 1 NO TAG20070330T221048 16 B F A DISK 30-MAR-07 1 1 NO TAG20070330T221058 17 B A A DISK 31-MAR-07 1 1 NO TAG20070331T083321 18 B F A DISK 31-MAR-07 1 1 NO TAG20070331T083331 19 B A A DISK 31-MAR-07 1 1 NO TAG20070331T083742 20 B F A DISK 31-MAR-07 1 1 NO TAG20070331T083747 RMAN> SHUTDOWN the Database and Startup NoMount RMAN> restore database from tag='TAG20070330T092148'; Starting restore at 31-MAR-07 using channel ORA_DISK_1 channel ORA_DISK_1: starting datafile backupset restore channel ORA_DISK_1: specifying datafile(s) to restore from backup set restoring datafile 00001 to +DATA/odb/datafile/system.256.617411373 restoring datafile 00002 to +DATA/odb/datafile/undotbs1.258.617411379 restoring datafile 00003 to +DATA/odb/datafile/sysaux.257.617411377 restoring datafile 00004 to +DATA/odb/datafile/users.259.617411381 channel ORA_DISK_1: reading from backup piece

15

+ARCH/odb/backupset/2007_03_30/nnndf0_tag20070330t092148_0.286.618571311 channel ORA_DISK_1: restored backup piece 1 piece handle=+ARCH/odb/backupset/2007_03_30/nnndf0_tag20070330t092148_0.286.618571311 tag=TAG20070330T092148 channel ORA_DISK_1: restore complete, elapsed time: 00:02:33 Finished restore at 31-MAR-07 RMAN> RMAN> recover database delete archivelog maxsize 50m; Starting recover at 31-MAR-07 using channel ORA_DISK_1 starting media recovery archive log thread 1 sequence 19 is already on disk as file +ARCH/odb/archivelog/2007_03_30/thread_1_seq_19.291.618617445 archive log thread 1 sequence 20 is already on disk as file +ARCH/odb/archivelog/2007_03_31/thread_1_seq_20.293.618654795 archive log thread 1 sequence 21 is already on disk as file +ARCH/odb/archivelog/2007_03_31/thread_1_seq_21.265.618655059 channel ORA_DISK_1: starting archive log restore to default destination channel ORA_DISK_1: restoring archive log archive log thread=1 sequence=17 channel ORA_DISK_1: reading from backup piece +ARCH/odb/backupset/2007_03_30/annnf0_tag20070330t092547_0.283.618571549 channel ORA_DISK_1: restored backup piece 1 piece handle=+ARCH/odb/backupset/2007_03_30/annnf0_tag20070330t092547_0.283.618571549 tag=TAG20070330T092547 channel ORA_DISK_1: restore complete, elapsed time: 00:00:03 archive log filename=+ARCH/odb/archivelog/2007_03_31/thread_1_seq_17.263.618657391 thread=1 sequence=17 channel default: deleting archive log(s) archive log filename=+ARCH/odb/archivelog/2007_03_31/thread_1_seq_17.263.618657391 recid=17 stamp=618657393 channel ORA_DISK_1: starting archive log restore to default destination channel ORA_DISK_1: restoring archive log archive log thread=1 sequence=18 channel ORA_DISK_1: reading from backup piece +ARCH/odb/backupset/2007_03_30/annnf0_tag20070330t220423_0.280.618617069 channel ORA_DISK_1: restored backup piece 1 piece handle=+ARCH/odb/backupset/2007_03_30/annnf0_tag20070330t220423_0.280.618617069 tag=TAG20070330T220423 channel ORA_DISK_1: restore complete, elapsed time: 00:00:15 archive log filename=+ARCH/odb/archivelog/2007_03_31/thread_1_seq_18.263.618657397 thread=1 sequence=18 channel default: deleting archive log(s) archive log filename=+ARCH/odb/archivelog/2007_03_31/thread_1_seq_18.263.618657397 recid=18 stamp=618657407 archive log filename=+ARCH/odb/archivelog/2007_03_30/thread_1_seq_19.291.618617445 thread=1 sequence=19 media recovery complete, elapsed time: 00:00:53 Finished recover at 31-MAR-07 RMAN> RMAN> alter database open; database opened

16

RMAN>

ASM: Move DataFile from One DiskGroup to Another Introduction : We will use RMAN commands to move a ASM Based DataFile from One Disk to Another. RMAN> report schema; Report of database schema List of Permanent Datafiles =========================== File Size(MB) Tablespace RB segs Datafile Name ---- -------- -------------------- ------- -----------------------5 100 T1 ** +DG1/odb/datafile/t1.256.617493211 ... RMAN> sql 'alter database datafile 5 offline'; sql statement: alter database datafile 5 offline RMAN> copy datafile '+DG1/odb/datafile/t1.256.617493211' to '+DATA'; Starting backup at 20-MAR-07 using channel ORA_DISK_1 channel ORA_DISK_1: starting datafile copy input datafile fno=00005 name=+DG1/odb/datafile/t1.256.617493211 output filename=+DATA/odb/datafile/t1.270.617751709 tag=TAG20070320T214148 recid=5 stamp=617751751 channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:57 Finished backup at 20-MAR-07 RMAN> report schema; Report of database schema List of Permanent Datafiles =========================== File Size(MB) Tablespace RB segs Datafile Name ---- -------- -------------------- ------- -----------------------5 100 T1 ** +DG1/odb/datafile/t1.256.617493211 ... RMAN> switch datafile '+DG1/odb/datafile/t1.256.617493211' to COPY; datafile 5 switched to datafile copy "+DATA/odb/datafile/t1.270.617751709" RMAN> report schema; Report of database schema List of Permanent Datafiles =========================== File Size(MB) Tablespace RB segs Datafile Name ---- -------- -------------------- ------- -----------------------5 100 T1 ** +DATA/odb/datafile/t1.270.617751709 RMAN> sql 'alter database datafile 5 online'; sql statement: alter database datafile 5 online RMAN-00571: =========================================================== RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS =============== RMAN-00571: =========================================================== RMAN-03009: failure of sql command on default channel at 03/20/2007 21:47:02

17

RMAN-11003: failure during parse/execution of SQL statement: alter database datafile 5 online ORA-01113: file 5 needs media recovery ORA-01110: data file 5: '+DATA/odb/datafile/t1.270.617751709' RMAN> recover datafile '+DATA/odb/datafile/t1.270.617751709'; Starting recover at 20-MAR-07 using channel ORA_DISK_1 starting media recovery media recovery complete, elapsed time: 00:00:03 Finished recover at 20-MAR-07 RMAN> sql 'alter database datafile 5 online'; sql statement: alter database datafile 5 online RMAN> SQL> select name from v$datafile; NAME -------------------------------------------------------------------------------+DATA/odb/datafile/system.256.617411373 +DATA/odb/datafile/undotbs1.258.617411379 +DATA/odb/datafile/sysaux.257.617411377 +DATA/odb/datafile/users.259.617411381 +DATA/odb/datafile/t1.270.617751709 +DG1/odb/datafile/test1.261.617749583 +DG1/odb/datafile/test1.262.617749589 7 rows selected. SQL> Summary: Here we have taken the datafile offline;Using RMAN Copy command we have copied the datafile from its DiskGroup to the New DiskGroup. Then using SWITCH Command the DataFile is Renamed , Recovered and Onlined. RMAN Copy Command Syntax ( Release 9i) From Release 10g , some of the RMAN Commands are Deprecated. Like "COPY" Command is replaced by "BACKUP AS COPY" Deprecated RMAN Commands in 10g Let me explain how to go about the same step using BACKUP AS COPY option. RMAN> REPORT SCHEMA; File Size(MB) Tablespace RB segs Datafile Name .. 4 5 USERS ** +DATA/odb/datafile/users.259.617411381 +TEST is the new ASM Disk Group RMAN> BACKUP AS COPY DATAFILE 4 FORMAT '+TEST'; Starting backup at 18-APR-07 allocated channel: ORA_DISK_1 channel ORA_DISK_1: sid=149 devtype=DISK channel ORA_DISK_1: starting datafile copy input datafile fno=00004 name=+DATA/odb/datafile/users.259.617411381

18

output filename=+TEST/odb/datafile/users.256.620211179 tag=TAG20070418T085257 re cid=16 stamp=620211184 channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:08 Finished backup at 18-APR-07 Starting Control File and SPFILE Autobackup at 18-APR-07 piece handle=+CONTROL/odb/autobackup/2007_04_18/s_620211185.256.620211191 commen t=NONE Finished Control File and SPFILE Autobackup at 18-APR-07 RMAN> RMAN> switch datafile 4 to COPY; datafile 4 switched to datafile copy "+TEST/odb/datafile/users.256.620211179" RMAN> RMAN> REPORT SCHEMA; Report of database schema List of Permanent Datafiles =========================== File Size(MB) Tablespace RB segs Datafile Name ---- -------- -------------------- ------- -----------------------.. 4 5 USERS +TEST/odb/datafile/users.256.620211179 Summary: Here we have Backup As Copy Option to move a datafile from one Disk Group to Another.

19

You might also like