环境:Oracle 10.2.0.4 ,Redhat Linux 4.0 U5 X86-64Bit
DB每日使用RMAN排程备份到NFS卷上
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 10g Enterprise Edition Release 10.2.0.4.0 - Production
With the Partitioning, Oracle Label Security, OLAP, Data 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'#Restore Controlfile
*.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/38267/viewspace-720856/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/38267/viewspace-720856/