RMAN恢复(rman只备份数据库,但不备份归档,归档通过简单的rsync或scp来传送到异地备份)...

只为研究研究一下

备份
[oracle@GGS ~]$ rman target /

Recovery Manager: Release 10.2.0.5.0 - Production on Thu Jan 19 10:54:48 2012

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

connected to target database: ORCL (DBID=1290862477)

RMAN> backup incremental level 0 device type disk format '/oracle/%U' database ;

Starting backup at 19-JAN-12
using channel ORA_DISK_1
channel ORA_DISK_1: starting incremental level 0 datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
input datafile fno=00001 name=/oracle/oradata/orcl/system01.dbf
input datafile fno=00002 name=/oracle/oradata/orcl/undotbs01.dbf
input datafile fno=00003 name=/oracle/oradata/orcl/sysaux01.dbf
channel ORA_DISK_1: starting piece 1 at 19-JAN-12
channel ORA_DISK_1: finished piece 1 at 19-JAN-12
piece handle=/oracle/0bn159m2_1_1 tag=TAG20120119T110433 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:01:14
channel ORA_DISK_1: starting incremental level 0 datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
including current control file in backupset
including current SPFILE in backupset
channel ORA_DISK_1: starting piece 1 at 19-JAN-12
channel ORA_DISK_1: finished piece 1 at 19-JAN-12
piece handle=/oracle/0cn159od_1_1 tag=TAG20120119T110433 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:04
Finished backup at 19-JAN-12

RMAN> sql 'alter system archive log current';

sql statement: alter system archive log current

RMAN> quit


Recovery Manager complete.
[oracle@GGS ~]$

恢复(删除数据文件,控制文件,spfile)
[oracle@GGS ~]$ rman target /

Recovery Manager: Release 10.2.0.5.0 - Production on Thu Jan 19 11:11:42 2012

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

connected to target database (not started)

RMAN> restore spfile from '/oracle/0cn159od_1_1';-------------需要启动实例才能从备份片中恢复spfile

Starting restore at 19-JAN-12
using target database control file instead of recovery catalog
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of restore command at 01/19/2012 11:13:47
RMAN-12010: automatic channel allocation initialization failed
RMAN-06403: could not obtain a fully authorized session
ORA-01034: ORACLE not available
ORA-27101: shared memory realm does not exist
Linux-x86_64 Error: 2: No such file or directory

RMAN> startup force nomount -------------启动oracle缺省的实例,看其sga与原来spfile的内存分配是不一样的

startup failed: ORA-01078: failure in processing system parameters
LRM-00109: could not open parameter file '/oracle/db_1/dbs/initorcl.ora'

starting Oracle instance without parameter file for retrival of spfile
Oracle instance started

Total System Global Area 159383552 bytes

Fixed Size 2094736 bytes
Variable Size 67111280 bytes
Database Buffers 83886080 bytes
Redo Buffers 6291456 bytes

RMAN> restore spfile from '/oracle/0cn159od_1_1';

Starting restore at 19-JAN-12
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=36 devtype=DISK

channel ORA_DISK_1: autobackup found: /oracle/0cn159od_1_1
channel ORA_DISK_1: SPFILE restore from autobackup complete
Finished restore at 19-JAN-12

RMAN> startup force nomount

Oracle instance started

Total System Global Area 109051904 bytes

Fixed Size 2094352 bytes
Variable Size 67111664 bytes
Database Buffers 33554432 bytes
Redo Buffers 6291456 bytes

RMAN> restore controlfile from '/oracle/0cn159od_1_1'
2> ;

Starting restore at 19-JAN-12
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:06
output filename=/oracle/oradata/orcl/control01.ctl
output filename=/oracle/oradata/orcl/control02.ctl
output filename=/oracle/oradata/orcl/control03.ctl
Finished restore at 19-JAN-12

RMAN> sql ' alter database mount';

sql statement: alter database mount
released channel: ORA_DISK_1

RMAN> restore database;

Starting restore at 19-JAN-12
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=156 devtype=DISK

channel ORA_DISK_1: starting datafile backupset restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
restoring datafile 00001 to /oracle/oradata/orcl/system01.dbf
restoring datafile 00002 to /oracle/oradata/orcl/undotbs01.dbf
restoring datafile 00003 to /oracle/oradata/orcl/sysaux01.dbf
channel ORA_DISK_1: reading from backup piece /oracle/0bn159m2_1_1
channel ORA_DISK_1: restored backup piece 1
piece handle=/oracle/0bn159m2_1_1 tag=TAG20120119T110433
channel ORA_DISK_1: restore complete, elapsed time: 00:02:10
Finished restore at 19-JAN-12

-----------------------------恢复,把归档传送到原来的归档目录上(即spfile指定的路径)--------------------------------

RMAN> list backup of archivelog all;-----------rman只记录了以前的归档记录


List of Backup Sets
===================

BS Key Size Device Type Elapsed Time Completion Time
------- ---------- ----------- ------------ ---------------
7 19.00K DISK 00:00:01 27-OCT-11
BP Key: 7 Status: AVAILABLE Compressed: NO Tag: TAG20111027T092236
Piece Name: /oracle/db_1/dbs/07mq4vqs_1_1

List of Archived Logs in backup set 7
Thrd Seq Low SCN Low Time Next SCN Next Time
---- ------- ---------- --------- ---------- ---------
1 36 248331 27-OCT-11 248395 27-OCT-11


---------------------------------------通过SQLPLUS来查看归档的序号-----------------------
[oracle@GGS ~]$ sqlplus / as sysdba

SQL*Plus: Release 10.2.0.5.0 - Production on Thu Jan 19 11:25:50 2012

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


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

idle> recover database;----------通过备份的控制文件来恢复,并且是不一致性恢复
ORA-00283: recovery session canceled due to errors
ORA-01610: recovery using the BACKUP CONTROLFILE option must be done

idle> archive log list;
Database log mode Archive Mode
Automatic archival Enabled
Archive destination /oracle/oradata/archivelog
Oldest online log sequence 38
Next log sequence to archive 40
Current log sequence 40
idle> recover database until sequence 41;

ORA-00277: illegal option to the UNTIL recovery flag SEQUENCE


idle> quit
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

------------------------------回到rman中做恢复--------------------------------------
RMAN> recover database until sequence 41 ----------------取Current log sequence+1
2> ;

Starting recover at 19-JAN-12
using channel ORA_DISK_1

starting media recovery

archive log filename=/oracle/oradata/archivelog/1_40_763081741.dbf thread=1 sequence=40
media recovery complete, elapsed time: 00:00:02
Finished recover at 19-JAN-12

RMAN>
RMAN> sql 'alter database open';-------必须要resetlogs

sql statement: alter database open
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03009: failure of sql command on default channel at 01/19/2012 11:46:34
RMAN-11003: failure during parse/execution of SQL statement: alter database open
ORA-01589: must use RESETLOGS or NORESETLOGS option for database open

RMAN> sql 'alter database open NORESETLOGS';----不能使用noresetlog

sql statement: alter database open NORESETLOGS
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03009: failure of sql command on default channel at 01/19/2012 11:48:16
RMAN-11003: failure during parse/execution of SQL statement: alter database open NORESETLOGS
ORA-01588: must use RESETLOGS option for database open

RMAN> sql 'alter database open RESETLOGS';

sql statement: alter database open RESETLOGS

RMAN>

[@more@]

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

转载于:http://blog.itpub.net/786540/viewspace-1057246/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值