OS:
Oracle-linux 5.7
Db:
11.2.0.3.0
Full recovery
To view an existing data file
Sql> select name from V$datafile;
NAME
--------------------------------------------------------------------------------
+data/yoon/datafile/system.256.823151193
+data/yoon/datafile/sysaux.257.823151193
+data/yoon/datafile/undotbs1.258.823151193
+data/yoon/datafile/users.259.823151193
+data/yoon/datafile/undotbs2.264.823151401
Make a full backup
Rman> CONFIGURE controlfile autobackup on;
New RMAN configuration parameters:
CONFIGURE Controlfile autobackup on;
New RMAN configuration parameters is successfully stored
rman> backup as Copy database;
Starting backup at 2013:12:16 15:29:30
Allocated Channel:ora_disk_1
Channel ora_disk_1:sid=34 Instance=yoon1 Device Type=disk
Channel ora_disk_1:starting datafile Copy
Input datafile file number=00001 name=+data/yoon/datafile/system.256.823151193
Output file name=+flush/yoon/datafile/system.261.834334171 tag=tag20131216t152930 recid=1 STAMP=834334197
Channel ora_disk_1:datafile copy complete, elapsed time:00:00:35
Channel ora_disk_1:starting datafile Copy
Input datafile file number=00002 name=+data/yoon/datafile/sysaux.257.823151193
Output file name=+flush/yoon/datafile/sysaux.262.834334207 tag=tag20131216t152930 recid=2 STAMP=834334226
Channel ora_disk_1:datafile copy complete, elapsed time:00:00:25
Channel ora_disk_1:starting datafile Copy
Input datafile file number=00003 name=+data/yoon/datafile/undotbs1.258.823151193
Output file name=+flush/yoon/datafile/undotbs1.263.834334231 tag=tag20131216t152930 recid=3 STAMP=834334234
Channel ora_disk_1:datafile copy complete, elapsed time:00:00:03
Channel ora_disk_1:starting datafile Copy
Input datafile file number=00005 name=+data/yoon/datafile/undotbs2.264.823151401
Output file name=+flush/yoon/datafile/undotbs2.264.834334235 tag=tag20131216t152930 recid=4 STAMP=834334235
Channel ora_disk_1:datafile copy complete, elapsed time:00:00:03
Channel ora_disk_1:starting datafile Copy
Input datafile file number=00004 name=+data/yoon/datafile/users.259.823151193
Output file name=+flush/yoon/datafile/users.265.834334237 tag=tag20131216t152930 recid=5 stamp=834334237
Channel ora_disk_1:datafile copy complete, elapsed time:00:00:01
Finished backup at 2013:12:16 15:30:38
Starting Control File and SPFILE autobackup at 2013:12:16 15:30:38
Piece handle=+flush/yoon/autobackup/2013_12_16/s_834334238.266.834334241 Comment=none
Finished Control File and SPFILE autobackup at 2013:12:16 15:30:41
Create a table space
sql> Create Tablespace Yoon datafile size 5m;
Tablespace created.
Sql> select name from V$datafile;
NAME
--------------------------------------------------------------------------------
+data/yoon/datafile/system.256.823151193
+data/yoon/datafile/sysaux.257.823151193
+data/yoon/datafile/undotbs1.258.823151193
+data/yoon/datafile/users.259.823151193
+data/yoon/datafile/undotbs2.264.823151401
+data/yoon/datafile/yoon.268.834334445
Create a table
Sql> CREATE Table Yoon as select * from User_tables;
Table created.
Sql> Select COUNT (*) from Yoon;
COUNT (*)
----------
971
Close the database delete file to simulate a disaster scenario
Sql>!
[Email protected] ~]$ srvctl stop Database-d Yoon
Asmcmd> RM-RF yoon.268.834334445
Start Database
[[email protected] ~]$ srvctl start database-d yoon
prcr-1079:failed to start Reso Urce ora.yoon.db
Crs-5017:the resource Action "ora.yoon.db start" encountered the following error:
Ora-01157:cannot identify/lock data file 6-see DBWR trace file
Ora-01110:data file 6: ' +data/yoon/datafile/yoon.268 .834334445 '
. For details refer to "(: CLSN00107:)" in "/u01/app/grid/11.2.0/log/rac1/agent/crsd/oraagent_oracle/oraagent_ Oracle.log ".
Crs-2674:start of ' ora.yoon.db ' on ' Rac1 ' failed
Crs-2632:there is no more servers to try to place resource ' ora.yoon.db ' on the would satisfy its placement policy
Crs-5017:the Resource Action "ora.yoon.db start" encountered the following error:
Ora-01157:cannot identify/lock data file 6-see DBWR trace file
Ora-01110:data file 6: ' +data/yoon/datafile/yoon.268.834334445 '
. For details refer to "(: CLSN00107:)" in "/u01/app/grid/11.2.0/log/rac2/agent/crsd/oraagent_oracle/oraagent_ Oracle.log ".
Sql> Startup
Ora-03135:connection lost Contact
Sql> Conn/as SYSDBA
Connected to an idle instance.
Sql> Startup
ORACLE instance started.
Total System Global area 1653518336 bytes
Fixed Size 2228904 bytes
Variable Size 1023413592 bytes
Database buffers 620756992 bytes
Redo buffers 7118848 bytes
Database mounted.
Ora-01157:cannot identify/lock data file 6-see DBWR trace file
Ora-01110:data file 6: ' +data/yoon/datafile/yoon.268.834334445 '
Cannot use recover database; Because this data file is not backed up at all
You need to rebuild the file with the ALTER DATABASE create DataFile command
sql> ALTER DATABASE Create datafile ' +data/yoon/datafile/yoon.268.834334445 ';
Database altered.
Or
ALTER DATABASE create datafile 6;
sql> recover datafile 6;
Ora-00283:recovery session canceled due to errors
Ora-01110:data file 6: ' +data/yoon/datafile/yoon.268.834334445 '
Ora-01157:cannot identify/lock data file 6-see DBWR trace file
Ora-01110:data file 6: ' +data/yoon/datafile/yoon.268.834334445 '
Asmcmd> ls
sysaux.257.823151193
system.256.823151193
UNDOTBS1.258.823151193
UNDOTBS2.264.823151401
users.259.823151193
yoon.268.834334961
The source file and the new file are found to be different, so:
sql> ALTER DATABASE rename file ' +data/yoon/datafile/yoon.268.834334445 ' to ' +data/yoon/datafile/ yoon.268.834334961 ';
Database altered.
sql> recover datafile 6;
Media recovery complete.
sql> ALTER DATABASE open;
Database altered.
Sql> select name from V$datafile;
NAME
--------------------------------------------------------------------------------
+data/yoon/datafile/system.256.823151193
+data/yoon/datafile/sysaux.257.823151193
+data/yoon/datafile/undotbs1.258.823151193
+data/yoon/datafile/users.259.823151193
+data/yoon/datafile/undotbs2.264.823151401
+data/yoon/datafile/yoon.268.834334961
6 rows selected.
Sql> Select COUNT (*) from Yoon;
COUNT (*)
----------
971
RMAN Full Recovery