使用rman备份异机恢复数据库
一.RMAN备份源库
注意点:
最好保留rman备份日志
$rman target / log=backup.log
RMAN>run {
allocate channel t1 type disk;
allocate channel t2 type disk;
allocate channel t3 type disk;
allocate channel t4 type disk;
backup format '<give location of backup/%U>' filesperset (database); sql 'alter system archive log current';
backup format '<give location of backup/%U>' fiesperset (archivelog all);
backup format '<give location of backup/%U>' current controlfile;
}
二.将备份文件传输到用于恢复的机器
注意点:
在10之前,必须将备份放到相同的路径和目录;10g之后,可以使用catalog命令进行注册。
除了备份文件,还要将参数文件传输过去(当然也可以自己重建)
2.1 创建或修改参数文件
对于参数文件中使用的文件路径目录都要创建好
2.2 创建口令文件
C:\> orapwd file=pwdmdb.ora password=ys06 entries=
2.3 创建oracle services(windows平台需要执行)
C:\> ORADIM -new -sid mdb -intpwd ys06 -maxusers -startmode auto -pfile 'C:\init.ora';
三.还原控制文件
> set oracle_sid=mdb
> sqlplus /nolog
$ connect /as sysdba
$ startup nomount pfile=C:\init.ora
$ exit
> rman target /
RMAN> restore controlfile from 'C:\data\NCCNTRL_20150921_8AQHLUR6_1_1' #这一步需要使用到参数文件中对控制文件的配置信息
RMAN> alter database mount;
四.catalog备份信息
如果备份文件的位置和源库上不同,需要进行catalog注册
RMAN> catalog start with '备份文件的存放目录' noprompt; #会将所有的备份片注册进来
RMAN> crosscheck backup tag '<backup tag from backup log>' ; #如果有多份备份,将老的备份标记为expired
RMAN> delete expired backup; #删除过期的备份
五.还原数据库
RMAN> report schema; #列出schema信息,如果源库和目标库的文件位置或文件名不同,需要使用set newname进行重新设置
RMAN> run{
allocate channel t1 type disk;
allocate channel t2 type disk;
set newname for datafile to 'C:\ORACLE\ORADATA\SYSTEM01.DBF';
set newname for datafile to 'C:\ORACLE\ORADATA\SYSAUX01.DB';
set newname for datafile to 'C:\ORACLE\ORADATA\UNDOTBS01.DBF';
set newname for datafile to 'C:\ORACLE\ORADATA\USERS01.DBF';
set until sequence ;
restore database;
switch datafile all;
recover database;
}
sequence可以从rman备份日志中找到,或者查看v$backup_redolog
六.重命名redo文件
SQL> set lines
col member format a60
select a.thread#,a.group#,b.type,b.member,a.bytes/
from v$log a,v$logfile b
where a.group#=b.group# order by a.group#;
SQL> alter database rename file '<old file location and name>' to '<new location and name>';
确认一下
SQL> select a.thread#,a.group#,b.type,b.member,a.bytes/ from v$log a,v$logfile b where a.group#=b.group# order by a.group#;
七.重命名temp文件
SQL> alter database rename tempfile 'D:\APP\ADMINISTRATOR\ORADATA\mdb\TEMP01.DBF' to 'C:\ORACLE\ORADATA\TEMP01.DBF'
八.打开数据库
SQL> alter database open resetlogs;
SQL> create spfile from pfile;
SQL> shutdown immediate
SQL> startup
数据异机还原后,和源库有相同的DBID和DB_NAME
使用rman备份异机恢复数据库的更多相关文章
- RMAN - 备份异机恢复
OS: Oracle Linux Server release 5.7 DB: Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - ...
- RMAN 备份异机恢复 并创建新DBID
测试平台信息: Oracle:11gR2 操作系统:Redhat 5.5 Target DB:dave 几点说明: (1)RMAN 异机恢复的时候,db_name必须相同. 如果说要想改成其他的实 ...
- RAC数据库的RMAN备份异机恢复到单节点数据库
1.首先在rac环境用rman备份数据库.[oracle@rac1 admin]$ rman target /run{allocate channel c1 device type disk conn ...
- Rman备份异机恢复
最后更新时间:2018/12/29 前置条件 已准备一台安装好Centos6+oracle11gr2 软件的服务器; 只安装了 oracle 数据库软件,需要手工创建以下目录: #环境变量 expor ...
- Hyper-V安装Oracle Linux6_4 Oracle db 12c并使用rman做异机恢复
本文记录在Windows Server 2012 R2上安装Oracle Enterprise Linux 6.4以及使用RMAN进行进行异机恢复的过程. Windows服务器增加Hyper-V功能 ...
- Oracle之使用rman进行异机恢复测试记录
本次测试目的是从生产数据库导出rman备份然后在测试数据库恢复 1,拷贝备份至相应目录 2,进入rman rman target \ 3,关闭数据库 shutdown 4,以nomount模式启动数据 ...
- rman全备份异机恢复
一.测试环境 [oracle@localhost ~]$ uname -a Linux localhost.localdomain -.el6.x86_64 # SMP Tue May :: EDT ...
- rman 备份并异机恢复
1.RMAN 备份脚本 RUN { CONFIGURE RETENTION POLICY DAYS; CONFIGURE CONTROLFILE AUTOBACKUP ON; CONFIGURE CO ...
- Oracle 单实例 迁移到 RAC 实例 -- 使用RMAN 异机恢复
Oracle 官网有关单实例迁移到RAC的一个步骤说明: How to Convert 10g Single-Instance database to 10g RAC using Manual Con ...
随机推荐
- <摘录>linux文件IO
这篇文章写的比较全面,也浅显易懂,备份下.转载自:http://blog.chinaunix.net/uid-27105712-id-3270102.html 在Linux 开发中,有几个关系到性能的 ...
- TRF7970A IC Communication Interface
General Introduction The communication interface to the reader can be configured in two ways: with a ...
- Time Step Too Small in Multisim
http://digital.ni.com/public.nsf/allkb/4B99B2CD6C0C3B6A86257205005D58E0 Error: Time Step Too Small i ...
- wpf简单的绘图板
xaml: <Window x:Class="WpfApplication1.MainWindow" xmlns="http://schemas.microsoft ...
- 关于心理的二十五种倾向(查理·芒格)-5
17)压力影响倾向人在遇到突然的压力.比方遭遇危急时.会导致人体内部的肾上腺素激增,推动更快,更极端的反应. A)人在压力的情况下会使得社会认同倾向更加强大.B)人在压力的情况下会使得避免怀疑倾向更加 ...
- TortoiseSVN 冲突解决详细步骤 (图)
冲突还是很好解决的,但我没有试过在IDE里边集成怎样.记得VSS在Visual Studio里边解决冲突就非常完美,冲突自动报告,自动弹出冲突解决窗口,让你处理该怎么合并两份版本.合并后自动签入com ...
- Python pass 语句
Python pass 语句 Python pass是空语句,是为了保持程序结构的完整性. pass 不做任何事情,一般用做占位语句. Python 语言 pass 语句语法格式如下: pass 实例 ...
- [译林军] 译~CrossBridge 简介
本文由 9ria 社区译林军翻译,转载请注明出处.加入译林军 :http://bbs.9ria.com/thread-286920-1-1.html CrossBridge 是 Adobe Fla ...
- [Android开发教程]Android官网developer training中文版教程 - 1.1.1 创建一个Android项目
本系列持续更新中.转载请注明来源. 前言:近期打算系统学习一下Android开发,发现Android官网上的developer training也是个非常好的学习资料,于是想到一边学习一边写一个中文版 ...
- java.lang.Integer can not be cast to java.lang.Long
hibernate 查询出来的结果 id 是int类型,xml文件配置的是int, 在jython 中调用hibernate 进行查询.字段的类型是java.lang.Long, 直接将id 传进去, ...