情景描述:丢失所有数据文件,控制文件和参数文件完好,且有一个表空间read only。
恢复过程:
SQL> select tablespace_name, status from dba_tablespaces;
TABLESPACE_NAME STATUS
------------------------------ ---------
SYSTEM ONLINE
UNDOTBS1 ONLINE
TEMP ONLINE
USERS READ ONLY
SQL> exit
Disconnected from Oracle9i Enterprise Edition Release 9.2.0.1.0 - Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.1.0 - Production
C:\Documents and Settings\p485224>rman target sys/oracle
Recovery Manager: Release 9.2.0.1.0 - Production
Copyright (c) 1995, 2002, Oracle Corporation. All rights reserved.
connected to target database: ORA92US (DBID=3206997025)
RMAN> backup database format 'D:\ora_bak\RMAN\ORA92US\df_%d_%s_%p.bak' tag=wholecold;
Starting backup at 2008-04-09 10:11:33
using target database controlfile instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=13 devtype=DISK
channel ORA_DISK_1: starting full datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
including current SPFILE in backupset
including current controlfile in backupset
input datafile fno=00001 name=D:\OPT\ORACLE9I\PRODUCT\9.2.0\ORADATA\ORA92US\SYSTEM01.DBF
input datafile fno=00002 name=D:\OPT\ORACLE9I\PRODUCT\9.2.0\ORADATA\ORA92US\UNDOTBS01.DBF
input datafile fno=00003 name=D:\OPT\ORACLE9I\PRODUCT\9.2.0\ORADATA\ORA92US\USERS01.DBF
channel ORA_DISK_1: starting piece 1 at 2008-04-09 10:11:35
channel ORA_DISK_1: finished piece 1 at 2008-04-09 10:12:10
piece handle=D:\ORA_BAK\RMAN\ORA92US\DF_ORA92US_2_1.BAK comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:36
Finished backup at 2008-04-09 10:12:10
RMAN> shutdown immediate
database closed
database dismounted
Oracle instance shut down
RMAN> startup
connected to target database (not started)
Oracle instance started
database mounted
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of startup command at 04/09/2008 10:13:38
ORA-01157: cannot identify/lock data file 1 - see DBWR trace file
ORA-01110: data file 1: 'D:\OPT\ORACLE9I\PRODUCT\9.2.0\ORADATA\ORA92US\SYSTEM01.DBF'
RMAN> restore database;
Starting restore at 2008-04-09 10:13:52
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=11 devtype=DISK
datafile 3 not processed because file is read-only
channel ORA_DISK_1: starting datafile backupset restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
restoring datafile 00001 to D:\OPT\ORACLE9I\PRODUCT\9.2.0\ORADATA\ORA92US\SYSTEM01.DBF
restoring datafile 00002 to D:\OPT\ORACLE9I\PRODUCT\9.2.0\ORADATA\ORA92US\UNDOTBS01.DBF
channel ORA_DISK_1: restored backup piece 1
piece handle=D:\ORA_BAK\RMAN\ORA92US\DF_ORA92US_2_1.BAK tag=WHOLECOLD params=NULL
channel ORA_DISK_1: restore complete
Finished restore at 2008-04-09 10:14:29
RMAN> restore database check readonly;
//You can force RMAN to restore any missing datafiles belonging to read-only tablespaces by using the CHECK READONLY option to the RESTORE command.
Starting restore at 2008-04-09 10:14:45
using channel ORA_DISK_1
skipping datafile 1; already restored to file D:\OPT\ORACLE9I\PRODUCT\9.2.0\ORADATA\ORA92US\SYSTEM01.DBF
skipping datafile 2; already restored to file D:\OPT\ORACLE9I\PRODUCT\9.2.0\ORADATA\ORA92US\UNDOTBS01.DBF
channel ORA_DISK_1: starting datafile backupset restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
restoring datafile 00003 to D:\OPT\ORACLE9I\PRODUCT\9.2.0\ORADATA\ORA92US\USERS01.DBF
channel ORA_DISK_1: restored backup piece 1
piece handle=D:\ORA_BAK\RMAN\ORA92US\DF_ORA92US_2_1.BAK tag=WHOLECOLD params=NULL
channel ORA_DISK_1: restore complete
Finished restore at 2008-04-09 10:14:47
RMAN> recover database;
Starting recover at 2008-04-09 10:15:08
using channel ORA_DISK_1
datafile 3 not processed because file is read-only
starting media recovery
media recovery complete
Finished recover at 2008-04-09 10:15:09
RMAN> alter database open;
database opened
RMAN>
即使存在表空间read only情况,RMAN在恢复过程中也会给出提示,只要根据提示采取相应措施即可。注意:temporary file会根据controlfile中的信息自动创建~(After restore and recovery of a whole database, when the database is opened, any missing temporary tablespaces recorded in the control file version of the RMAN repository are re-created with their previous creation size, AUTOEXTEND and MAXSIZE attributes.)
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/9765498/viewspace-231293/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/9765498/viewspace-231293/