OS:
ORACLE-LINUX 5.7

DB:
11.2.0.3.0

完全恢复

查看现有的数据文件
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

做一个完全备份
RMAN> CONFIGURE CONTROLFILE AUTOBACKUP on;

new RMAN configuration parameters:
CONFIGURE CONTROLFILE AUTOBACKUP ON;
new RMAN configuration parameters are 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

创建一个表空间
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

创建表
SQL> create table yoon as select * from user_tables;

Table created.

SQL> select count(*) from yoon;

COUNT(*)
----------
       971
       
关闭数据库删除文件,模拟灾难场景
SQL> !
[oracle@rac1 ~]$ srvctl stop database -d yoon

ASMCMD> rm -rf YOON.268.834334445

启动数据库
[oracle@rac1 ~]$ srvctl start database -d yoon  
PRCR-1079 : Failed to start resource 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 are no more servers to try to place resource 'ora.yoon.db' on that 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'

不能用recover database; 因为这个数据文件根本没有备份

需要用alter database create datafile命令重建文件
SQL> alter database create datafile '+DATA/yoon/datafile/yoon.268.834334445';

Database altered.


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

发现源文件和新建的文件不同之处,因此:
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

最新文章

  1. ThinkPHP常用查询
  2. 大前端学习笔记整理【五】rem与px换算的计算方式
  3. JAVA利用ODBC读取DBF,可以解决javadbf.jar对DBF部分中文乱码和错行等杂症
  4. ABP集合帖
  5. STL算法
  6. python学习笔记(六)文件夹遍历,异常处理
  7. Linux系统性能测试工具sysbench
  8. selenium webdriver使用过程中出现Element is not currently visible and so may not be interacted with的处理方法
  9. 兔子--Android中的五大布局
  10. linux vim taglist config
  11. android之写文件到sd卡
  12. linux:C语言通过ICMP协议判断局域网内部主机是否存活
  13. SharePoint Patterns and Practices 简介
  14. ch11 持有对象
  15. .NET Core 从 Github到 Nuget 持续集成、部署
  16. html的初了解(更新中···)
  17. Spring JPA配置讲解
  18. 瘋子C语言笔记 (string)
  19. 【系统】supervisor支持多进程
  20. 使用object literal替换switch

热门文章

  1. Select的深入应用(2)
  2. oracle中,行转列函数wm_concat()结果有长度限制,重写该函数解决
  3. PAT1069. The Black Hole of Numbers
  4. 法线贴图——Normal Mapping
  5. Windows phone 8 学习笔记(5) 图块与通知(转)
  6. svn不能提交 svn: is out of date; try updating
  7. XML内容作为String字符串读取报错
  8. _func_
  9. box2d 遍历世界中 body 的方法
  10. jQuery判断元素离页面顶部的高度