RMAN 完全恢复
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
RMAN 完全恢复的更多相关文章
- Oracle—RMAN完全恢复
一.RMAN完全恢复的相关概念 1.在RMAN完全恢复中主要使用两个命令,一个是restore,另一个是recover. 2.可以在三个级别恢复,数据库,表空间,数据文件. 3.RMAN中应对于各种情 ...
- oracle之三rman 完全恢复
rman 完全恢复 8.1 recover 恢复: 1)归档 : 完全恢复和不完全恢复 2)非归档:只能恢复到最后一次备份状态(还原) 8.2 完全恢复: ----先对数据库做一个备份(如果是arch ...
- oracle数据库rman备份计划及恢复
1.rman完全恢复的前提条件:历史的datafile,controlfile和spfile备份,加上完整的archivelog和完好的redolog. 2.rman备份脚本: a.RMAN 0级备份 ...
- RMAN常用备份恢复命令汇总
RMAN命令 1.独立命令 RMAN>shutdown immediate RMAN>startup RMAN>backup format 'd:\backup\%d_%s.b ...
- RMAN参数详解
在Oracle 10g中的配置情况使用RMAN>show all;可以显示出RMAN 配置参数为: CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # d ...
- RMAN主要命令 show,list,crosscheck,delete详解
Oracle RMAN 的 show,list,crosscheck,delete命令整理 Oracle RMAN 的 show,list,crosscheck,delete命令整理 1.SHOW命 ...
- enmo_day_07
数据备份 物理备份 : 底层数据块 逻辑备份 :exp(export), imp(import) 导入导出工具,提取成dump文件,再将dump文件放入数据库 expdp, impdp 数据蹦 uti ...
- ocp11g培训内部教材_053课堂笔记(043)_数据备份
053:数据库高级管理: 目录 第一部分:数据库备份与恢复... 4 第一章:备份恢复概述... 4 1.1 备份的意义: 4 1.2 数据库故障的类型:... 4 1.3 制定你的备份和恢复的计划. ...
- 5. RAMN备份与恢复
一. rman简介 RMAN(Recovery Manager)是一种用于备份(backup).还原(restore)和恢复(recover)数据库的 Oracle 工具.RMAN只能用于ORACLE ...
随机推荐
- NAT学习笔记
NAT介绍 NAT, 全称网络地址转换(Network Address Translation),是一种在IP封包通过路由器或防火墙时重写来源IP地址或目的IP地址的技术. NAT的分类及介绍 NAT ...
- 转载收藏- (TTL与CMOS)电路常识性概念
原帖:http://blog.sina.com.cn/s/blog_48c0c0190101bbth.html
- emacs org mode 中的标签全参考
把交叉的信息关联起来的最好的方式就是打标签. emacs 的 org 模式对标签的支持非常强大. 每一个标题都可以在最后包含标签列表.标签由字母.数字.'_' 和 '@' 组成.标签的前后必需有一个冒 ...
- Android开发-API指南-<provider>
<provider> 英文原文:http://developer.android.com/guide/topics/manifest/provider-element.html 采集(更新 ...
- 【翻译习作】 Windows Workflow Foundation程序开发-第一章01
第 1 章 欢迎来到工作流的世界 …思想如蝴蝶般飞到我身边 —— Gossard / Vedder (译注:Gossard与Vedder是来自Pearl Jam乐队的2名乐手,该句出自他们的歌曲 ...
- openerp权限设置总结
Openerp权限设置 最近一直在弄openerp权限问题,现在终于懂了一些.主要对模块下的security 目录下的文件:xxx_security.xml.ir.model.access.csv进行 ...
- com学习(五)——实现多接口
从第五回开始到第七回,咱们用 ATL 写了一个简单的 COM 组件,之所以说简单,是因为在组件中,只实现了一个自定义(custom)的接口 IFun.当然如果想偷懒的话,我们可以把 200 个函数都加 ...
- VS2010之MFC串口通信的编写教程
http://wenku.baidu.com/link?url=K1XPdj9Dcf2of_BsbIdbPeeZ452uJqiF-s773uQyMzV2cSaPRIq6RddQQH1zr1opqVBM ...
- PAT1007
#include<stdio.h>#include<vector>#include<algorithm>using namespace std; int main( ...
- 【MySQL】mysql buffer pool结构分析
转自:http://blog.csdn.net/wyzxg/article/details/7700394 MySQL官网配置说明地址:http://dev.mysql.com/doc/refman/ ...