单实例异地恢复

1、主库备份
主库
controlfile autobackup
backup database;
记录dbid
将备份出来得文件传送到备库上。
2、异地恢复
[oracle@rac1 oracle]$ export ORACLE_SID=oradb1
[oracle@rac1 oracle]$ rman target /
Recovery Manager: Release 10.2.0.1.0 - Production on Fri Jan 25 15:20:16 2013
Copyright (c) 1982, 2005, Oracle.  All rights reserved.
connected to target database (not started)
RMAN> set dbid 805645286
executing command: SET DBID
RMAN>

RMAN> startup
connected to target database (not started)
startup failed: ORA-01078: failure in processing system parameters
LRM-00109: could not open parameter file '/u01/app/oracle/product/10.2.0/db_1/dbs/initoradb1.ora'
starting Oracle instance without parameter file for retrival of spfile
Oracle instance started
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of startup command at 01/25/2013 15:22:51
ORA-00205: error in identifying control file, check alert log for more info
-----首先恢复spfile
RMAN> restore spfile to '/u01/app/oracle/product/10.2.0/db_1/dbs/spfileoradb1.ora' from '/home/oracle/backup/rman1/c-2149226819-20130125-03';
RMAN> shutdown immediate
Oracle instance shut down
RMAN> startup nomount
connected to target database (not started)
Oracle instance started
Total System Global Area     167772160 bytes
Fixed Size                     1218316 bytes
Variable Size                 79694068 bytes
Database Buffers              83886080 bytes
Redo Buffers                   2973696 bytes
RMAN>
--接下来恢复控制文件
RMAN> restore controlfile from '/home/oracle/backup/rman1/c-2149226819-20130125-03';
Starting restore at 25-JAN-13
using target database control file instead of recovery catalog
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:01
output filename=/u01/app/oracle/oradata/oradb1/control01.ctl
output filename=/u01/app/oracle/oradata/oradb1/control02.ctl
output filename=/u01/app/oracle/oradata/oradb1/control03.ctl
Finished restore at 25-JAN-13
RMAN> alter database mount;
database mounted
released channel: ORA_DISK_1
--最后恢复数据
RMAN>
RMAN> restore database;
Starting restore at 25-JAN-13
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/app/oracle/oradata/oradb1/system01.dbf
restoring datafile 00002 to /u01/app/oracle/oradata/oradb1/undotbs01.dbf
restoring datafile 00003 to /u01/app/oracle/oradata/oradb1/sysaux01.dbf
restoring datafile 00004 to /u01/app/oracle/oradata/oradb1/users01.dbf
restoring datafile 00005 to /u01/app/oracle/oradata/oradb1/data01.dbf
channel ORA_DISK_1: reading from backup piece /home/oracle/backup/rman/805645286_13_20130125.rman
channel ORA_DISK_1: restored backup piece 1
piece handle=/home/oracle/backup/rman/805645286_13_20130125.rman tag=TAG20130125T142126
channel ORA_DISK_1: restore complete, elapsed time: 00:01:57
Finished restore at 25-JAN-13
RMAN> alter database open resetlogs;
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of alter db command at 01/25/2013 15:35:37
ORA-01152: file 1 was not restored from a sufficiently old backup
ORA-01110: data file 1: '/u01/app/oracle/oradata/oradb1/system01.dbf'
RMAN>
RMAN> exit

Recovery Manager complete.
[oracle@rac1 oracle]$
--------sqlplus下执行---------
[oracle@rac1 dbs]$ sqlplus / as sysdba
SQL*Plus: Release 10.2.0.1.0 - Production on Fri Jan 25 16:00:38 2013
Copyright (c) 1982, 2005, Oracle.  All rights reserved.

Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
SQL> alter database open resetlogs;
alter database open resetlogs
*
ERROR at line 1:
ORA-01152: file 1 was not restored from a sufficiently old backup
ORA-01110: data file 1: '/u01/app/oracle/oradata/oradb1/system01.dbf'

SQL> recover database using backup controlfile until cancel;
ORA-00279: change 650539 generated at 01/25/2013 14:21:26 needed for thread 1
ORA-00289: suggestion : /home/oracle/backup/arch/1_1_805644326.dbf
ORA-00280: change 650539 for thread 1 is in sequence #1

Specify log: {=suggested | filename | AUTO | CANCEL}
auto
ORA-00308: cannot open archived log
'/home/oracle/backup/arch/1_1_805644326.dbf'
ORA-27037: unable to obtain file status
Linux Error: 2: No such file or directory
Additional information: 3

ORA-00308: cannot open archived log
'/home/oracle/backup/arch/1_1_805644326.dbf'
ORA-27037: unable to obtain file status
Linux Error: 2: No such file or directory
Additional information: 3

SQL> alter database open resetlogs;
Database altered.
SQL> exit
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
[oracle@rac1 dbs]$
-----------------恢复完成-----------------

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/23382569/viewspace-761088/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/23382569/viewspace-761088/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值