oracle数据库恢复
恢复背景
使用RMAN做了数据库的完全备份、参数文件、控制文件的备份,所有数据文件\ 在线重做日志文件、控制文件和spfile参数文件全部丢失
恢复步骤
1.关闭数据库
RMAN> shutdown immediate;
Oracle instance shut down
2.设置DBID
RMAN> set dbid 663499696
(可以在备份集的名称上得到DBID)
executing command: SET DBID
3.强行启动实例
RMAN> startup force nomount;
startup failed: ORA-01078: failure in processing system parameters
LRM-00109: could not open parameter file '/opt/app/oracle/product/10.2.0/db_1/dbs/initora10.ora'
LRM-00109: could not open parameter file '/opt/app/oracle/product/10.2.0/db_1/dbs/initora10.ora'
starting Oracle instance without parameter file for retrival of spfile
Oracle instance started
Oracle instance started
Total System Global Area 159383552 bytes
Fixed Size 1218268 bytes
Variable Size 54528292 bytes
Database Buffers 100663296 bytes
Redo Buffers 2973696 bytes
Variable Size 54528292 bytes
Database Buffers 100663296 bytes
Redo Buffers 2973696 bytes
4.恢复spfile参数文件(AUTOBACK已经不可用)
RMAN> restore spfile from '/orabak/ctl_c-663499696-20090319-00';
Starting restore at 19-MAR-09
using channel ORA_DISK_1
using channel ORA_DISK_1
channel ORA_DISK_1: autobackup found: /orabak/ctl_c-663499696-20090319-00
channel ORA_DISK_1: SPFILE restore from autobackup complete
Finished restore at 19-MAR-09
channel ORA_DISK_1: SPFILE restore from autobackup complete
Finished restore at 19-MAR-09
5.恢复控制文件(AUTOBACK已经不可用)
RMAN> restore controlfile from '/orabak/ctl_c-663499696-20090319-00';
re
Starting restore at 19-MAR-09
using channel ORA_DISK_1
re
Starting restore at 19-MAR-09
using channel ORA_DISK_1
channel ORA_DISK_1: restoring control file
channel ORA_DISK_1: restore complete, elapsed time: 00:00:02
output filename=/opt/app/oracle/product/10.2.0/db_1/dbs/cntrlora10.dbf(注意:控制文件不在原来数据文件的位置)
Finished restore at 19-MAR-09
channel ORA_DISK_1: restore complete, elapsed time: 00:00:02
output filename=/opt/app/oracle/product/10.2.0/db_1/dbs/cntrlora10.dbf(注意:控制文件不在原来数据文件的位置)
Finished restore at 19-MAR-09
7. 关闭数据库
RMAN> shutdown immediate;
using target database control file instead of recovery catalog
Oracle instance shut down
Oracle instance shut down
RMAN> startup mount;
connected to target database (not started)
Oracle instance started
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of startup command at 03/19/2009 13:55:37
ORA-00205: error in identifying control file, check alert log for more info
Oracle instance started
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of startup command at 03/19/2009 13:55:37
ORA-00205: error in identifying control file, check alert log for more info
8.恢复控制文件(AUTOBACK已经不可用)
RMAN> restore controlfile from '/orabak/ctl_c-663499696-20090319-00';
Starting restore at 19-MAR-09
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=156 devtype=DISK
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=156 devtype=DISK
channel ORA_DISK_1: restoring control file
channel ORA_DISK_1: restore complete, elapsed time: 00:00:03
output filename=/opt/app/oracle/oradata/ora10/control01.ctl
output filename=/opt/app/oracle/oradata/ora10/control02.ctl
output filename=/opt/app/oracle/oradata/ora10/control03.ctl(注意:控制文件已经恢复到原来数据文件的位置)
Finished restore at 19-MAR-09
channel ORA_DISK_1: restore complete, elapsed time: 00:00:03
output filename=/opt/app/oracle/oradata/ora10/control01.ctl
output filename=/opt/app/oracle/oradata/ora10/control02.ctl
output filename=/opt/app/oracle/oradata/ora10/control03.ctl(注意:控制文件已经恢复到原来数据文件的位置)
Finished restore at 19-MAR-09
9.装载数据库
RMAN> alter database mount;
database mounted
released channel: ORA_DISK_1
released channel: ORA_DISK_1
10.还原数据库
RMAN> restore database;
Starting restore at 19-MAR-09
Starting implicit crosscheck backup at 19-MAR-09
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=156 devtype=DISK
Crosschecked 1 objects
Finished implicit crosscheck backup at 19-MAR-09
Starting implicit crosscheck backup at 19-MAR-09
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=156 devtype=DISK
Crosschecked 1 objects
Finished implicit crosscheck backup at 19-MAR-09
Starting implicit crosscheck copy at 19-MAR-09
using channel ORA_DISK_1
Finished implicit crosscheck copy at 19-MAR-09
using channel ORA_DISK_1
Finished implicit crosscheck copy at 19-MAR-09
searching for all files in the recovery area
cataloging files...
no files cataloged
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 /opt/app/oracle/oradata/ora10/system01.dbf
restoring datafile 00002 to /opt/app/oracle/oradata/ora10/undotbs01.dbf
restoring datafile 00003 to /opt/app/oracle/oradata/ora10/sysaux01.dbf
restoring datafile 00004 to /opt/app/oracle/oradata/ora10/users01.dbf
restoring datafile 00005 to /opt/app/oracle/oradata/ora10/user_data.dbf
channel ORA_DISK_1: reading from backup piece /orabak/arch/20090319_0kkaa72a_1_1.bak
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
restoring datafile 00001 to /opt/app/oracle/oradata/ora10/system01.dbf
restoring datafile 00002 to /opt/app/oracle/oradata/ora10/undotbs01.dbf
restoring datafile 00003 to /opt/app/oracle/oradata/ora10/sysaux01.dbf
restoring datafile 00004 to /opt/app/oracle/oradata/ora10/users01.dbf
restoring datafile 00005 to /opt/app/oracle/oradata/ora10/user_data.dbf
channel ORA_DISK_1: reading from backup piece /orabak/arch/20090319_0kkaa72a_1_1.bak
channel ORA_DISK_1: restored backup piece 1
piece handle=/orabak/arch/20090319_0kkaa72a_1_1.bak tag=TAG20090319T111522
channel ORA_DISK_1: restore complete, elapsed time: 00:01:15
Finished restore at 19-MAR-09
11.恢复数据库
RMAN> recover database;
Starting recover at 19-MAR-09
using channel ORA_DISK_1
la
starting media recovery
using channel ORA_DISK_1
la
starting media recovery
unable to find archive log
archive log thread=1 sequence=3
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of recover command at 03/19/2009 14:03:07
RMAN-06054: media recovery requesting unknown log: thread 1 seq 3 lowscn 522697
archive log thread=1 sequence=3
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of recover command at 03/19/2009 14:03:07
RMAN-06054: media recovery requesting unknown log: thread 1 seq 3 lowscn 522697
12.重置onlineredolog日志序号
RMAN> alter database open resetlogs;
database opened
RMAN>
数据库恢复完成!
本文转自 pgmia 51CTO博客,原文链接:http://blog.51cto.com/heyiyi/140488