Академический Документы
Профессиональный Документы
Культура Документы
Michael Messina, Management Consultant Rolta-TUSC Database Services Last Updated: 07/16/2010
Table of Contents
DATA RECOVERY ADVISOR................................................................................................................... 2 FAILURE EXAMPLE ...................................................................................................................................... 2 LIST FAILURES ............................................................................................................................................ 2 LIST FAILURE DETAIL ................................................................................................................................. 3 ADVISE FOR AUTOMATED REPAIR OPTIONS ................................................................................................ 3 FAILURE REPAIR PREVIEW .......................................................................................................................... 4 REPAIR FAILURE.......................................................................................................................................... 4 RMAN PROACTIVE HEALTH CHECK .................................................................................................. 5 DATABASE................................................................................................................................................... 5 TABLESPACE ............................................................................................................................................... 7 DATAFILE .................................................................................................................................................... 7 BLOCK RECOVERY ENHANCEMENT .................................................................................................. 8 FLASHBACK LOGS ....................................................................................................................................... 8 BLOCK RECOVERY (PHYSICAL STANDBY) ................................................................................................... 8 ARCHIVED LOG DELETION POLICY ENHANCEMENTS ................................................................ 8 NEW COMPRESSION TYPE (ZLIB) ........................................................................................................ 9 PARALLEL BACKUP OF SAME DATAFILE ......................................................................................... 9 EXAMPLE..................................................................................................................................................... 9 NETWORK AWARE / ACTIVE DATABASE DUPLICATION ........................................................... 10 VIRTUAL PRIVATE CATALOG ............................................................................................................. 11 OPTIMIZED UNDO BACKUP ................................................................................................................. 12 READ-ONLY TRANSPORTABLE TABLESPACES BACKUP ........................................................... 12
Rolta-TUSC Confidential
Page 1
Failure Example
$ sqlplus / AS SYSDBA SQL*Plus: Release 11.1.0.6.0 - Production on Tue Nov 27 15:13:53 2007 Copyright (c) 1982, 2007, Oracle. All rights reserved. Connected to an idle instance. SQL> startup ORACLE instance started. Total System Global Area 535662592 bytes Fixed Size 1334380 bytes Variable Size 209716116 bytes Database Buffers 318767104 bytes Redo Buffers 5844992 bytes Database mounted. ORA-01157: cannot identify/lock data file 4 - see DBWR trace file ORA-01110: data file 4: 'C:\ORACLE\ORADATA\ORCL11G\USERS01.DBF' SQL> exit $ rman target=/ Recovery Manager: Release 11.1.0.6.0 - Production on Tue Nov 27 15:17:51 2007 Copyright (c) 1982, 2007, Oracle. All rights reserved. connected to target database: ORCL11G (DBID=744414708, not open)
List Failures
RMAN> list failure ; using target database control file instead of recovery catalog List of Database Failures ========================= RMAN 11gR1 New Features Rolta-TUSC Confidential Page 2
Failure ID Priority Status Time Detected Summary ---------- -------- --------- ------------- ------222 HIGH OPEN 27-NOV-07 One or more non-system datafiles are missing If there are no failures then Oracle will return a message: using target database control file instead of recovery catalog no failures found that match specification The message indicates that I have a non-system tablespace datafile missing. A missing datafile is considered critical and therefore Priority is high. Since it is a non-system tablespace datafile the database can stay up with the tablespace this datafile goes with offline.
Rolta-TUSC Confidential
Page 3
225 HIGH OPEN 27-NOV-07 Datafile 4: 'C:\ORACLE\ORADATA\ORC L11G\USERS01.DBF' is missing Impact: Some objects in tablespace USERS might be unavailable analyzing automatic repair options; this may take some time allocated channel: ORA_DISK_1 channel ORA_DISK_1: SID=152 device type=DISK analyzing automatic repair options complete Mandatory Manual Actions ======================== no manual actions available Optional Manual Actions ======================= 1. If file C:\ORACLE\ORADATA\ORCL11G\USERS01.DBF was unintentionally renamed or moved, restore it Automated Repair Options ======================== Option Repair Description ------ -----------------1 Restore and recover datafile 4 Strategy: The repair includes complete media recovery with no data loss Repair script: c:\oracle\diag\rdbms\orcl11g\orcl11g\hm\reco_1022222764.hm
Repair Failure
RMAN> repair failure ; Strategy: The repair includes complete media recovery with no data loss Repair script: c:\oracle\diag\rdbms\orcl11g\orcl11g\hm\reco_1022222764.hm contents of repair script: # restore and recover datafile restore datafile 4; recover datafile 4; RMAN 11gR1 New Features Rolta-TUSC Confidential Page 4
Do you really want to execute the above repair (enter YES or NO)? YES executing repair script Starting restore at 27-NOV-07 using channel ORA_DISK_1 channel ORA_DISK_1: starting datafile backup set restore channel ORA_DISK_1: specifying datafile(s) to restore from backup set channel ORA_DISK_1: restoring datafile 00004 to C:\ORACLE\ORADATA\ORCL11G\USERS0 1.DBF channel ORA_DISK_1: reading from backup piece C:\ORACLE\FLASH_RECOVERY_AREA\ORCL 11G\BACKUPSET\2007_11_27\O1_MF_NNNDF_TAG20071127T144712_3NRX264W_.BKP channel ORA_DISK_1: piece handle=C:\ORACLE\FLASH_RECOVERY_AREA\ORCL11G\BACKUPSET \2007_11_27\O1_MF_NNNDF_TAG20071127T144712_3NRX264W_.BKP tag=TAG20071127T144712 channel ORA_DISK_1: restored backup piece 1 channel ORA_DISK_1: restore complete, elapsed time: 00:00:25 Finished restore at 27-NOV-07 Starting recover at 27-NOV-07 using channel ORA_DISK_1 starting media recovery media recovery complete, elapsed time: 00:00:01 Finished recover at 27-NOV-07 repair failure complete Do you want to open the database (enter YES or NO)? YES database opened
Database
RMAN> validate database ; Starting validate at 27-NOV-07 allocated channel: ORA_DISK_1 channel ORA_DISK_1: SID=138 device type=DISK channel ORA_DISK_1: starting validation of datafile channel ORA_DISK_1: specifying datafile(s) for validation input datafile file number=00001 name=C:\ORACLE\ORADATA\ORCL11G\SYSTEM01.DBF RMAN 11gR1 New Features Rolta-TUSC Confidential Page 5
input datafile file number=00002 name=C:\ORACLE\ORADATA\ORCL11G\SYSAUX01.DBF input datafile file number=00004 name=C:\ORACLE\ORADATA\ORCL11G\USERS01.DBF input datafile file number=00006 name=C:\ORACLE\ORADATA\ORCL11G\UNDOTBS02.DBF input datafile file number=00005 name=C:\ORACLE\ORADATA\ORCL11G\EXAMPLE01.DBF channel ORA_DISK_1: validation complete, elapsed time: 00:03:25 List of Datafiles ================= File Status Marked Corrupt Empty Blocks Blocks Examined High SCN ---- ------ -------------- ------------ --------------- ---------1 OK 0 11278 512000 13548003 File Name: C:\ORACLE\ORADATA\ORCL11G\SYSTEM01.DBF Block Type Blocks Failing Blocks Processed ---------- -------------- ---------------Data 0 487268 Index 0 11166 Other 0 2288 File Status Marked Corrupt Empty Blocks Blocks Examined High SCN ---- ------ -------------- ------------ --------------- ---------2 OK 0 26072 75512 13548017 File Name: C:\ORACLE\ORADATA\ORCL11G\SYSAUX01.DBF Block Type Blocks Failing Blocks Processed ---------- -------------- ---------------Data 0 12195 Index 0 10225 Other 0 27020 File Status Marked Corrupt Empty Blocks Blocks Examined High SCN ---- ------ -------------- ------------ --------------- ---------4 OK 0 51199 64000 13457224 File Name: C:\ORACLE\ORADATA\ORCL11G\USERS01.DBF Block Type Blocks Failing Blocks Processed ---------- -------------- ---------------Data 0 12357 Index 0 33 Other 0 411 File Status Marked Corrupt Empty Blocks Blocks Examined High SCN ---- ------ -------------- ------------ --------------- ---------5 OK 0 1719 12800 13345172 File Name: C:\ORACLE\ORADATA\ORCL11G\EXAMPLE01.DBF Block Type Blocks Failing Blocks Processed ---------- -------------- ---------------Data 0 4406 Index 0 1264 Other 0 5411 File Status Marked Corrupt Empty Blocks Blocks Examined High SCN ---- ------ -------------- ------------ --------------- ---------6 OK 0 23908 64000 13548017 File Name: C:\ORACLE\ORADATA\ORCL11G\UNDOTBS02.DBF Block Type Blocks Failing Blocks Processed ---------- -------------- ---------------RMAN 11gR1 New Features Rolta-TUSC Confidential Page 6
0 0 0
0 0 40092
channel ORA_DISK_1: starting validation of datafile channel ORA_DISK_1: specifying datafile(s) for validation including current control file for validation including current SPFILE in backup set channel ORA_DISK_1: validation complete, elapsed time: 00:00:01 List of Control File and SPFILE =============================== File Type Status Blocks Failing Blocks Examined ------------ ------ -------------- --------------SPFILE OK 0 2 Control File OK 0 624 Finished validate at 27-NOV-07
Tablespace
RMAN> validate tablespace users ; Starting validate at 27-NOV-07 using target database control file instead of recovery catalog allocated channel: ORA_DISK_1 channel ORA_DISK_1: SID=128 device type=DISK channel ORA_DISK_1: starting validation of datafile channel ORA_DISK_1: specifying datafile(s) for validation input datafile file number=00004 name=C:\ORACLE\ORADATA\ORCL11G\USERS01.DBF channel ORA_DISK_1: validation complete, elapsed time: 00:00:15 List of Datafiles ================= File Status Marked Corrupt Empty Blocks Blocks Examined High SCN ---- ------ -------------- ------------ --------------- ---------4 OK 0 51199 64000 13457224 File Name: C:\ORACLE\ORADATA\ORCL11G\USERS01.DBF Block Type Blocks Failing Blocks Processed ---------- -------------- ---------------Data 0 12357 Index 0 33 Other 0 411 Finished validate at 27-NOV-07
Datafile
RMAN> validate datafile 4 block 1 ; Starting validate at 27-NOV-07 using channel ORA_DISK_1 channel ORA_DISK_1: starting validation of datafile channel ORA_DISK_1: specifying datafile(s) for validation input datafile file number=00004 name=C:\ORACLE\ORADATA\ORCL11G\USERS01.DBF channel ORA_DISK_1: validation complete, elapsed time: 00:00:01 RMAN 11gR1 New Features Rolta-TUSC Confidential Page 7
List of Datafiles ================= File Status Marked Corrupt Empty Blocks Blocks Examined High SCN ---- ------ -------------- ------------ --------------- ---------4 OK 0 0 1 0 File Name: C:\ORACLE\ORADATA\ORCL11G\USERS01.DBF Block Type Blocks Failing Blocks Processed ---------- -------------- ---------------Data 0 0 Index 0 0 Other 0 1 Finished validate at 27-NOV-07
deviceSpecifier | NONE | SHIPPED TO [ALL] STANDBY} [ {APPLIED ON [ALL] STANDBY | BACKED UP integer TIMES TO DEVICE TYPE deviceSpecifier | NONE | SHIPPED TO [ALL] STANDBY}]...}
To change it to BZIP2:
RMAN> configure compression algorithm 'bzip2';
Example
RMAN> run { 2> allocate channel c1 type disk format '/backup1/%U'; 3> allocate channel c2 type disk format '/backup2/%U'; 4> backup 5> section size 50m 6> datafile 4; 7> }
Rolta-TUSC Confidential
Page 9
The RMAN command allocates two channels and backs up the users tablespace in on two channels in parallel. Each channel takes a 50MB section of the datafile and backs that up in parallel. This makes backup of larger files faster. When backed up this way, the backups show up as sections as well. Example of datafile 4 backup showing it in sections:
RMAN> list backup of datafile 4; List of Backup Pieces for backup set 901 Copy #1 BP Key Pc# Status Piece Name -------------------------- ---------2007 1 AVAILABLE /backup1/9dhk7os1_1_1 2008 2 AVAILABLE /backup2/9dhk7os1_1_1 2009 3 AVAILABLE /backup1/9dhk7os1_1_3 2009 3 AVAILABLE /backup2/9dhk7os1_1_4
Rolta-TUSC Confidential
Page 10
Grant access on the relevant databases to the virtual private catalog user using RMAN
$ rman RMAN> CONNECT CATALOG rman/rman@rman ; RMAN> GRANT CATALOG FOR DATABASE db11g TO vpc_a; Grant succeeded.
Log into RMAN using the virtual private catalog owner and issue the CREATE VIRTUAL CATALOG command.
$ rman RMAN> CONNECT CATALOG vpc_a/vpc_a@rman ; RMAN> CREATE VIRTUAL CATALOG;
If the catalog is to going to be used for a database releases prior to Oracle 11g, log into SQL*Plus as the virtual private catalog owner and execute the CREATE_VIRTUAL_CATALOG procedure in the DBMS_RCVCAT package where "rman" represents the name of the base catalog owner in the rman database.
SQL> CONN vpc_a/vpc_a@rman SQL> EXEC rman.DBMS_RCVCAT.CREATE_VIRTUAL_CATALOG;
Connect to the virtual private catalog using the virtual private catalog owner instead of the main catalog owner.
CONNECT CATALOG vpc_a/vpc_a@rman ; rman target / catalog vpc_a/vpc_a@rman
Rolta-TUSC Confidential
Page 11
Rolta-TUSC Confidential
Page 12