SET NEWNAME FOR DATABASE TO恢复数据库

創建pfile中的路徑
[oracle@11g ~]$ mkdir -p /u01/app/oracle/admin/orcl/adump
打開到nomount狀態
[oracle@11g ~]$ sqlplus / as sysdba


SQL*Plus: Release 11.2.0.4.0 Production on Fri Nov 25 08:00:48 2016


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


Connected to an idle instance.


SQL> startup nomount pfile='/backup/pfile.ora';
ORACLE instance started.


Total System Global Area 1252663296 bytes
Fixed Size                  2252824 bytes
Variable Size             956305384 bytes
Database Buffers          285212672 bytes
Redo Buffers                8892416 bytes
SQL> quit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
不完全恢復數據庫
[oracle@11g ~]$ rman target /


Recovery Manager: Release 11.2.0.4.0 - Production on Fri Nov 25 08:07:48 2016


Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.


connected to target database: ORCL (not mounted)


RMAN> restore controlfile from '/backup/orcl_full_02rlpiv6_1_1';


Starting restore at 25-NOV-16
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=19 device type=DISK


channel ORA_DISK_1: restoring control file
channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
output file name=/oradata/ORCL/controlfile/o1_mf_ctdygv67_.ctl
Finished restore at 25-NOV-16


RMAN> alter database mount;


database mounted
released channel: ORA_DISK_1


RMAN> run {
2> SET NEWNAME FOR DATABASE   TO '/oradata/%U';
3> restore database;
4> switch datafile all;
5> catalog backuppiece '/backup/orcl_arch_full_03rlpiva_1_1';
6> catalog backuppiece '/backup/orcl_full_01rlpite_1_1';
7> recover database;
8> }


executing command: SET NEWNAME


Starting restore at 25-NOV-16
using channel ORA_DISK_1


skipping datafile 1; already restored to file /oradata/data_D-ORCL_TS-SYSTEM_FNO-1
skipping datafile 2; already restored to file /oradata/data_D-ORCL_TS-SYSAUX_FNO-2
skipping datafile 3; already restored to file /oradata/data_D-ORCL_TS-UNDOTBS1_FNO-3
skipping datafile 4; already restored to file /oradata/data_D-ORCL_TS-USERS_FNO-4
restore not done; all files read only, offline, or already restored
Finished restore at 25-NOV-16




cataloged backup piece
backup piece handle=/backup/orcl_arch_full_03rlpiva_1_1 RECID=2 STAMP=928829483


cataloged backup piece
backup piece handle=/backup/orcl_full_01rlpite_1_1 RECID=3 STAMP=928829483


Starting recover at 25-NOV-16
using channel ORA_DISK_1


starting media recovery


channel ORA_DISK_1: starting archived log restore to default destination
channel ORA_DISK_1: restoring archived log
archived log thread=1 sequence=2
channel ORA_DISK_1: restoring archived log
archived log thread=1 sequence=3
channel ORA_DISK_1: reading from backup piece /backup/orcl_arch_full_03rlpiva_1_1
channel ORA_DISK_1: piece handle=/backup/orcl_arch_full_03rlpiva_1_1 tag=TAG20161125T075314
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
archived log file name=/arch/1_2_919238363.dbf thread=1 sequence=2
archived log file name=/arch/1_3_919238363.dbf thread=1 sequence=3
unable to find archived log
archived log thread=1 sequence=4
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of recover command at 11/25/2016 08:11:25
RMAN-06054: media recovery requesting unknown archived log for thread 1 with sequence 4 and starting SCN of 984045


RMAN> recover database until scn 984045;


Starting recover at 25-NOV-16
using channel ORA_DISK_1


starting media recovery
media recovery complete, elapsed time: 00:00:00


Finished recover at 25-NOV-16


RMAN> exit




Recovery Manager complete.
重開日誌打開數據庫
[oracle@11g ~]$ sqlplus / as sysdba


SQL*Plus: Release 11.2.0.4.0 Production on Fri Nov 25 08:14:38 2016


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




Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options


SQL> alter database open resetlogs;


Database altered.


SQL> quit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值