RMAN Catalog環境下異機全庫恢復例項

shilei1發表於2012-08-04


Step0  建立初始環境:

建立Linux 環境
安裝Oracle 10.2.0.1並打補丁到10.2.0.4
建立掛載點,並掛載NFS卷

mount -o rw,bg,hard,nointr,rsize=32768,wsize=32768,tcp,vers=3,timeo=600,actimeo=0 10.192.28.245:/data/rmandata /rmandata/
            
Step1 建立密碼檔案與初始化檔案:

rmancd \u01\product\oracle\dbs

rman$orapwd file=orapwytedi password=password entries=5

rman$cat > initytedi.ora
db_name=ytedi

rman$cat initytedi.ora 
db_name=ytedi

step2 恢復spfile:

rman$rman target / catalog rmaner/rmaner@catalog

Recovery Manager: Release 10.2.0.4.0 - Production on Tue Apr 10 17:12:18 2012

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

connected to target database (not started)
connected to recovery catalog database

RMAN> startup nomount;

Oracle instance started

Total System Global Area     113246208 bytes

Fixed Size                     1266080 bytes
Variable Size                 58723936 bytes
Database Buffers              50331648 bytes
Redo Buffers                   2924544 bytes

RMAN> 

RMAN> restore spfile;

Starting restore at 10-APR-12
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=36 devtype=DISK

channel ORA_DISK_1: starting datafile backupset restore
channel ORA_DISK_1: restoring SPFILE
output filename=/u01/product/oracle/dbs/spfileytedi.ora
channel ORA_DISK_1: reading from backup piece /rmandata/10.192.29.56/ytedi_l2_201204090310_c-480066880-20120409-00
channel ORA_DISK_1: restored backup piece 1
piece handle=/rmandata/10.192.29.56/ytedi_l2_201204090310_c-480066880-20120409-00 tag=TAG20120409T150631
channel ORA_DISK_1: restore complete, elapsed time: 00:00:02
Finished restore at 10-APR-12


RMAN> exit


Recovery Manager complete.

Step3 重新使用spfile啟動到nomount狀態:

rman$sqlplus / as sysdba

SQL*Plus: Release 10.2.0.4.0 - Production on Tue Apr 10 17:19:56 2012

Copyright (c) 1982, 2007, Oracle.  All Rights Reserved.


Connected to:
Oracle Database Enterprise Edition Release 10.2.0.4.0 - Production
With the Partitioning, Oracle Label Security, OLAP, Mining Scoring Engine
and Real Application Testing options

SQL> shutdown abort
ORACLE instance shut down.
SQL> startup nomount   
ORACLE instance started.

Total System Global Area  608174080 bytes
Fixed Size                  1268920 bytes
Variable Size             176161608 bytes
Database Buffers          427819008 bytes
Redo Buffers                2924544 bytes
SQL> 

Step4 根據spfile內容建立所需的目錄:

SQL> create pfile from spfile
SQL> !   
rman$cd /u01/product/oracle/dbs/
rman$cat initytedi.ora 
ytedi.__db_cache_size=427819008
ytedi.__java_pool_size=4194304
ytedi.__large_pool_size=4194304
ytedi.__shared_pool_size=159383552
ytedi.__streams_pool_size=8388608
*.audit_file_dest='/u01/product/admin/ytedi/adump'
*.audit_trail='DB'
*.background_dump_dest='/u01/product/admin/ytedi/bdump'
*.compatible='10.2.0.3.0'
*.control_files='/u01/product/oradata/ytedi/control01.ctl','/u01/product/oradata/ytedi/control02.ctl','/u01/product/oradata/ytedi/control03.ctl','/data/ytedi/control04.ctl'#RestoreControlfile
*.core_dump_dest='/u01/product/admin/ytedi/cdump'
*.db_block_size=8192
*.db_domain=''
*.db_file_multiblock_read_count=16
*.db_name='ytedi'
*.db_recovery_file_dest='/u01/product/flash_recovery_area'
*.db_recovery_file_dest_size=2147483648
*.dg_broker_start=FALSE
*.dispatchers='(PROTOCOL=TCP) (SERVICE=ytediXDB)'
*.job_queue_processes=10
*.log_archive_dest_1='LOCATION=/data/ytedi/arch'
*.log_archive_dest_2=''
*.log_archive_format='%t_%s_%r.arc'
*.open_cursors=300
*.pga_aggregate_target=201326592
*.processes=500
*.remote_login_passwordfile='EXCLUSIVE'
*.sessions=555
*.sga_target=605028352
*.undo_management='AUTO'
*.undo_retention=10800
*.undo_tablespace='UNDOTBS1'
*.user_dump_dest='/u01/product/admin/ytedi/udump'

rman$
rman$mkdir -p /u01/product/oradata/ytedi/
rman$mkdir -p /u01/product/admin/ytedi/bdump/
rman$mkdir -p /u01/product/admin/ytedi/adump/
rman$mkdir -p /u01/product/admin/ytedi/cdump/
rman$mkdir -p /u01/product/flash_recovery_area
rman$mkdir -p /data/ytedi
rman$exit

exit
SQL> exit

Step5 控制檔案:

rman$rman target / catalog rmaner/rmaner@catalog

Recovery Manager: Release 10.2.0.4.0 - Production on Tue Apr 10 17:24:20 2012

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

connected to target database: ytedi (not mounted)
connected to recovery catalog database

RMAN> restore controlfile;

Starting restore at 10-APR-12
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=541 devtype=DISK

channel ORA_DISK_1: starting datafile backupset restore
channel ORA_DISK_1: restoring control file
channel ORA_DISK_1: reading from backup piece /rmandata/10.192.29.56/ytedi_l2_201204100310_c-480066880-20120410-00
channel ORA_DISK_1: restored backup piece 1
piece handle=/rmandata/10.192.29.56/ytedi_l2_201204100310_c-480066880-20120410-00 tag=TAG20120410T033015
channel ORA_DISK_1: restore complete, elapsed time: 00:00:15
output filename=/u01/product/oradata/ytedi/control01.ctl
output filename=/u01/product/oradata/ytedi/control02.ctl
output filename=/u01/product/oradata/ytedi/control03.ctl
output filename=/data/ytedi/control04.ctl
Finished restore at 10-APR-12

RMAN> 

Step6 使用新恢復的控制檔案mount資料庫:

RMAN> alter database mount;

database mounted
released channel: ORA_DISK_1

RMAN> 

Step7 Restore資料庫:

RMAN> restore database;

Starting restore at 10-APR-12
Starting implicit crosscheck backup at 10-APR-12
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=541 devtype=DISK
Crosschecked 94 objects
Finished implicit crosscheck backup at 10-APR-12

Starting implicit crosscheck copy at 10-APR-12
using channel ORA_DISK_1
Finished implicit crosscheck copy at 10-APR-12

searching for all files in the recovery area
cataloging files...
no files cataloged

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 /u01/product/oradata/ytedi/system01.dbf
restoring datafile 00003 to /u01/product/oradata/ytedi/sysaux01.dbf
restoring datafile 00004 to /u01/product/oradata/ytedi/users01.dbf
restoring datafile 00005 to /data/ytedi/edibase_data01.dbf
restoring datafile 00007 to /data/ytedi/edilog_index01.dbf
channel ORA_DISK_1: reading from backup piece /rmandata/10.192.29.56/ytedi_l0_201204080310_p2n7skl7

......

piece handle=/rmandata/10.192.29.56/ytedi_l0_201204080310_p8n7slmo tag=YTEDI_L0_201204080310
channel ORA_DISK_1: restore complete, elapsed time: 00:02:56
channel ORA_DISK_1: starting datafile backupset restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
restoring datafile 00002 to /u01/product/oradata/ytedi/undotbs01.dbf
restoring datafile 00006 to /data/ytedi/edibase_data02.dbf
channel ORA_DISK_1: reading from backup piece /rmandata/10.192.29.56/ytedi_l0_201204080310_p9n7slt5
channel ORA_DISK_1: restored backup piece 1
piece handle=/rmandata/10.192.29.56/ytedi_l0_201204080310_p9n7slt5 tag=YTEDI_L0_201204080310
channel ORA_DISK_1: restore complete, elapsed time: 00:00:37
Finished restore at 10-APR-12

Step8 Recover資料庫:

RMAN> recover database;

Starting recover at 10-APR-12
using channel ORA_DISK_1
channel ORA_DISK_1: starting incremental datafile backupset restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
destination for restore of datafile 00001: /u01/product/oradata/ytedi/system01.dbf
destination for restore of datafile 00003: /u01/product/oradata/ytedi/sysaux01.dbf
destination for restore of datafile 00004: /u01/product/oradata/ytedi/users01.dbf
destination for restore of datafile 00005: /data/ytedi/edibase_data01.dbf
destination for restore of datafile 00007: /data/ytedi/edilog_index01.dbf

......

channel ORA_DISK_1: starting archive log restore to default destination
channel ORA_DISK_1: restoring archive log
archive log thread=1 sequence=7910
channel ORA_DISK_1: reading from backup piece /rmandata/10.192.29.56/ytedi_l2_201204100310_arc_q0n81ui4
channel ORA_DISK_1: restored backup piece 1
piece handle=/rmandata/10.192.29.56/ytedi_l2_201204100310_arc_q0n81ui4 tag=YTEDI_ARC_201204100310
channel ORA_DISK_1: restore complete, elapsed time: 00:00:02
archive log filename=/data/ytedi/arch1_7910_708618624.arc thread=1 sequence=7910
unable to find archive log
archive log thread=1 sequence=7911
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of recover command at 04/10/2012 20:16:40
RMAN-06054: media recovery requesting unknown log: thread 1 seq 7911 lowscn 11859098336858

RMAN> 


Step9 使用Resetlogs選項開啟資料庫:

RMAN> alter database open resetlogs;

database opened
new incarnation of database registered in recovery catalog
starting full resync of recovery catalog
full resync complete

RMAN> 

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/196700/viewspace-739826/,如需轉載,請註明出處,否則將追究法律責任。

相關文章