cp雾化器开多少瓦:rman恢复 nocatalog 方式恢复

来源:百度文库 编辑:偶看新闻 时间:2024/07/02 02:49:37
控制文件在,数据文件丢失.完全恢复过程
RMAN> startup mount;connected to target database (not started)
Oracle instance started
database mountedTotal System Global Area     135337540 bytesFixed Size                      452164 bytes
Variable Size                109051904 bytes
Database Buffers              25165824 bytes
Redo Buffers                    667648 bytesRMAN> restore database;Starting restore at 16-AUG-06allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=11 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 /opt/oracle/oradata/tldb/system01.dbf
restoring datafile 00002 to /opt/oracle/oradata/tldb/undotbs01.dbf
restoring datafile 00003 to /opt/oracle/oradata/tldb/users01.dbf
channel ORA_DISK_1: restored backup piece 1
piece handle=/opt/oracle/product/9.2.0/dbs/1fhqs95f_1_1 tag=TAG20060816T100015 params=NULL
channel ORA_DISK_1: restore complete
Finished restore at 16-AUG-06RMAN> recover database;Starting recover at 16-AUG-06
using channel ORA_DISK_1starting media recovery
media recovery completeFinished recover at 16-AUG-06RMAN> alter database open;database openedRMAN>
------------------------------------------------------------------------
控制文件丢失,不完全恢复 
 控制文件损坏时,使用 using backup controlfile
sql> recover database until time ‘YYYY-MM-DD:HH:MI:SS‘
until cancel
until scn
或者需要恢复到不同的控制文件状态时.比如:表空间的误删除
做完不完全恢复,需要重新做备份.

 tl1:~ # rman target /Recovery Manager: Release 9.2.0.6.0 - ProductionCopyright (c) 1995, 2002, Oracle Corporation.  All rights reserved.connected to target database: TLDB (DBID=937533021)

tl1:~ # rman target /

Recovery Manager: Release 9.2.0.6.0 - Production

Copyright (c) 1995, 2002, Oracle Corporation.  All rights reserved.

connected to target database (not started)

RMAN> startup nomount; --数据库先启动到nomount状态.

Oracle instance started

Total System Global Area     135337540 bytes

Fixed Size                      452164 bytes
Variable Size                109051904 bytes
Database Buffers              25165824 bytes
Redo Buffers                    667648 bytes

RMAN> restore controlfile from autobackup;

Starting restore at 16-AUG-06

using target database controlfile instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=11 devtype=DISK
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of restore command at 08/16/2006 09:34:14
RMAN-06495: must explicitly specify DBID with SET DBID command --提示需要设置dbid.我们在做rman备份的时候可以看到dbid.

RMAN> set dbid 937533021

executing command: SET DBID

RMAN> restore controlfile from autobackup;

Starting restore at 16-AUG-06

using channel ORA_DISK_1
channel ORA_DISK_1: looking for autobackup on day: 20060816
channel ORA_DISK_1: autobackup found: c-937533021-20060816-01
channel ORA_DISK_1: controlfile restore from autobackup complete
replicating controlfile
input filename=/opt/oracle/oradata/tldb/control01.ctl
output filename=/opt/oracle/oradata/tldb/control02.ctl
output filename=/opt/oracle/oradata/tldb/control03.ctl
Finished restore at 16-AUG-06

RMAN> alter database mount; --此时数据库可以mount上了.

database mounted

RMAN> alter database open; --但是还不能打开

RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of alter db command at 08/16/2006 09:35:10
ORA-01589: must use RESETLOGS or NORESETLOGS option for database open

RMAN> alter database open resetlogs; --打开报错,因为restore之后没有recover.

RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of alter db command at 08/16/2006 09:35:20
ORA-01152: file 1 was not restored from a sufficiently old backup
ORA-01110: data file 1: ‘/opt/oracle/oradata/tldb/system01.dbf‘

RMAN> recover database;

Starting recover at 16-AUG-06
using channel ORA_DISK_1

starting media recovery

archive log thread 1 sequence 1 is already on disk as file /opt/oracle/oradata/tldb/redo03.log
archive log filename=/opt/oracle/oradata/tldb/redo03.log thread=1 sequence=0
media recovery complete
Finished recover at 16-AUG-06

RMAN> alter database open resetlogs;

database opened

RMAN>
恢复完毕.
使用resetlogs之后需在catalog database 上进行reset database,原有备份信息将不可用,所以要及时进行新的完全备份。
-------------------------------------------------------------
redolog丢失,不完全恢复
online redo log损坏,数据库仅恢复到最后一个归档的日志文件。
SQL> recover database using backup controlfile until cancel;
SQL> RECOVER DATABASE UNTIL CANCEL USING BACKUP CONTROLFILE;
SQL> CANCELSQL> alter database open resetlogs;Database altered.
 SQL> startup mount;
ORACLE instance started.Total System Global Area  135337540 bytes
Fixed Size                   452164 bytes
Variable Size             109051904 bytes
Database Buffers           25165824 bytes
Redo Buffers                 667648 bytes
Database mounted.

SQL> RECOVER DATABASE UNTIL CANCEL USING BACKUP CONTROLFILE;
ORA-00279: change 1712919 generated at 08/16/2006 17:26:27 needed for thread 1
ORA-00289: suggestion : /opt/oracle/arch/1_1.arc
ORA-00280: change 1712919 for thread 1 is in sequence #1
Specify log: {=suggested | filename | AUTO | CANCEL}
/opt/oracle/oradata/tldb/redo01.log.bak --此处是mv了的redo log file.
Log applied.
Media recovery complete.
SQL>
SQL> alter database open ;
alter database open
*
ERROR at line 1:
ORA-01589: must use RESETLOGS or NORESETLOGS option for database open
SQL> alter database open resetlogs;Database altered.SQL>
至此恢复完成.
 --------------------------------------------------------------
spfile丢失,完全恢复 tl1:~ # rman target /Recovery Manager: Release 9.2.0.6.0 - ProductionCopyright (c) 1995, 2002, Oracle Corporation.  All rights reserved.connected to target database (not started)RMAN> startup nomount;startup failed: ORA-01078: failure in processing system parameters
LRM-00109: could not open parameter file ‘/opt/oracle/product/9.2.0/dbs/inittldb.ora‘trying to start the Oracle instance without parameter files ...
Oracle instance startedTotal System Global Area     101782948 bytesFixed Size                      452004 bytes
Variable Size                 50331648 bytes
Database Buffers              50331648 bytes
Redo Buffers                    667648 bytesRMAN>
RMAN> set dbid 937533021executing command: SET DBIDRMAN> restore spfile from autobackup;Starting restore at 16-AUG-06using channel ORA_DISK_1
channel ORA_DISK_1: looking for autobackup on day: 20060816
channel ORA_DISK_1: autobackup found: c-937533021-20060816-0c
channel ORA_DISK_1: SPFILE restore from autobackup complete
Finished restore at 16-AUG-06RMAN> RMAN> host;[oracle@tl1 ~]$ ls -l $ORACLE_HOME/dbs/spfiletldb.ora
-rw-r-----  1 oracle dba 3584 Aug 16 11:59 /opt/oracle/product/9.2.0/dbs/spfiletldb.ora
[oracle@tl1 ~]$ exit
exit
host command complete
RMAN> shutdown immediate;Oracle instance shut downRMAN> set dbid 937533021executing command: SET DBIDRMAN> startup;connected to target database (not started)
Oracle instance started
database mounted
database openedTotal System Global Area     135337540 bytesFixed Size                      452164 bytes
Variable Size                109051904 bytes
Database Buffers              25165824 bytes
Redo Buffers                    667648 bytesRMAN> exit
Recovery Manager complete.------------------------------------------------------------------
到时间点的不完全恢复.  tl1:~ # rman target /Recovery Manager: Release 9.2.0.6.0 - ProductionCopyright (c) 1995, 2002, Oracle Corporation.  All rights reserved.connected to target database: TLDB (DBID=937533021)RMAN> run {
2> sql "alter session set nls_date_format=‘‘yyyy-mm-dd hh24:mi:ss‘‘";
3> set until time= ‘2006-08-16 12:46:00‘;
4> restore database;
5> recover database;
6> sql ‘alter database open resetlogs‘;
7> }using target database controlfile instead of recovery catalog
sql statement: alter session set nls_date_format=‘‘yyyy-mm-dd hh24:mi:ss‘‘executing command: SET until clauseStarting restore at 16-AUG-06allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=12 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 /opt/oracle/oradata/tldb/system01.dbf
restoring datafile 00002 to /opt/oracle/oradata/tldb/undotbs01.dbf
restoring datafile 00003 to /opt/oracle/oradata/tldb/users01.dbf
channel ORA_DISK_1: restored backup piece 1
piece handle=/opt/oracle/product/9.2.0/dbs/24hqsino_1_1 tag=TAG20060816T124336 params=NULL
channel ORA_DISK_1: restore complete
Finished restore at 16-AUG-06Starting recover at 16-AUG-06
using channel ORA_DISK_1starting media recoveryarchive log thread 1 sequence 3 is already on disk as file /opt/oracle/arch/1_3.arc
channel ORA_DISK_1: starting archive log restore to default destination
channel ORA_DISK_1: restoring archive log
archive log thread=1 sequence=2
channel ORA_DISK_1: restored backup piece 1
piece handle=/opt/oracle/product/9.2.0/dbs/25hqsio0_1_1 tag=TAG20060816T124344 params=NULL
channel ORA_DISK_1: restore complete
archive log filename=/opt/oracle/arch/1_2.arc thread=1 sequence=2
archive log filename=/opt/oracle/arch/1_3.arc thread=1 sequence=3
media recovery complete
Finished recover at 16-AUG-06sql statement: alter database open resetlogsRMAN> --------------------------------------------------
undo表空间坏,不完全恢复类似于普通文件的恢复.