ORACLE11G RMAN备份恢复到异机数据库
oracle11g还原数据库步骤__概述说明以及解释
oracle11g还原数据库步骤概述说明以及解释引言部分的内容可以按照如下方式撰写:1. 引言1.1 概述引言部分将介绍本篇文章的主题,即Oracle 11g数据库还原步骤。
数据库还原是一项至关重要的任务,它可以帮助恢复丢失或损坏的数据,并确保系统的连续性和可靠性。
在本文中,我们将深入探讨Oracle 11g数据库还原的步骤和过程,以及执行还原操作前需要注意的准备工作。
1.2 文章结构在本文中,我们将按照以下顺序来讨论Oracle 11g数据库还原:- 首先,我们将介绍Oracle 11g数据库还原的重要性,阐述为什么必须进行数据库还原操作。
- 其次,我们将概述Oracle 11g数据库还原的步骤,并列出每个步骤的简要说明。
- 第三部分我们将详细描述执行数据库还原操作前所需进行的准备工作。
- 接下来,我们将提供执行数据库还原操作的详细步骤,包括必要时涉及到的命令和工具。
- 最后,我们将讨论完成数据库还原后进行验证和测试的方法与技巧。
1.3 目的本文旨在为读者提供有关Oracle 11g数据库还原的全面指南。
通过学习本文,读者将能够了解数据库还原的重要性、掌握进行数据库还原操作的步骤和技巧,并且能够有效地验证和测试还原后的数据库。
我们希望这篇文章能够帮助读者在数据库还原过程中避免常见错误,并提供相关提示和建议。
2. 正文:2.1 Oracle 11g数据库还原的重要性在数据库管理中,数据的安全性和完整性是至关重要的。
由于各种原因,比如硬件故障、用户误操作或者系统遭受攻击,数据库可能会丢失或损坏。
因此,在这些情况下,数据库还原变得非常重要。
Oracle 11g数据库还原是指恢复已经丢失或被损坏的数据到其先前可用状态的过程。
2.2 Oracle 11g数据库还原的步骤概述数据库还原通常包括以下主要步骤:- 备份介质准备:确定可用的备份介质,并确保其处于良好状态。
- 目标库环境准备:在目标库上创建必需的目录结构,并配置参数以适应还原操作。
Oracle 11g 备份恢复步骤
Oracle 11g 备份恢复步骤备份步骤:1、进入命令行操作cmd2、连接数据库sqlplus lwuser/lwuser3、创建备份目录文件—创建后必须在E盘建立dmpbak文件夹sql> create directory sdmzykt as 'E:\dmpbak\dmp';4、可使用命令查询备份目录文件sql> select * from dba_directories;5、赋予权限sql> grant read,write on directory sdmzykt to lwuser;6、执行备份语句—使用命令行窗口expdp lwuser/lwuser directory=sdmzykt dumpfile=sdmzyktbak.dmp logfile= sdmzyktbak.log schemas= lwuser恢复步骤:1、命令窗口直接导入:impdp lwuser/lwuser directory= sdmzykt dumpfile= sdmzyktbak.dmp logfile= sdmzyktbak.log schemas= lwuserbat文件:@echo offrem set backupfile=f_database_%date:~0,4%-%date:~5,2%-%date:~8,2%.dmp rem set logfile=f_database_%date:~0,4%-%date:~5,2%-%date:~8,2%.log rem delete 30days filesforfiles /p "D:\temp\dmp" /d -30 /c "cmd /c echodeleting @file ... && del /f @path"cd D:\temp\dmprem backup schemasset backupfile=sshe_%date:~0,4%-%date:~5,2%-%date:~8,2%.dmpset logfile=sshe_%date:~0,4%-%date:~5,2%-%date:~8,2%.logexpdp sshe/sshe directory=DIR_DP dumpfile=%backupfile% logfile=%logfile% schemas=sshe parallel=4auto运行脚步:@ECHO OFFschtasks /create /tn SSHE数据库定时备份/tr "D:\temp\sshe_bak.bat" /sc daily /st 00:00:00 /ru "system" PAUSEEXIT。
通过RMAN备份Oracle数据库恢复到其他服务器(案例)
通过RMAN备份Oracle数据库恢复到其他服务器(案例)通过RMAN备份Oracle数据库恢复到其他服务器(案例)本节演示如何通过RMAN创建的备份集,将数据库恢复到其他服务器。
本小节执行的操作较多,一定要有一个清醒的大脑,因此赶紧把脑袋里那堆乱七八糟的东西清除清除,要不你一定会看晕的。
设定环境如下:源库192.168.100.100,SID:orcdb。
目录库192.168.100.101,已安装与源库相同版本的数据库软件(一定要相同版本哟)。
准备工作如下:记录下源数据库的DBID,DBID的获取方式上节已讲过。
创建完整备份集(含控制文件、数据文件、归档文件),源库为非归档模式也可以,只要确保创建的备份是一致备份,然后将备份集复制到目标服务器的相同路径下。
为简单起见,源端与目标端目录结构保持一致。
如果你在测试或正式操作时由于实际原因无法保持源端与目标端结构一致,在恢复过程中注意修改相关路径。
操作步骤如下:注意,下列操作如非特别注明,均是在目标端服务器上进行的。
1.在源库端创建数据库的完整备份Backup database;备份集创建成功之后,将其复制到目录端的相同路径下,强调一点,必须是相同路径。
复制方式灵活多样,Windows环境可以直接通过共享复制,Linux/UNIX下可以通过FTP。
2.在目标服务器上创建OracleService如果是Linux/UNIX环境,不需要执行本步骤,只要在连接数据库时指定ORACLE_SID环境变量即可。
如果是Windows服务器,需要通过ORADIM命令创建一个OracleService,创建的SID要与源库相同,操作如下:1. C:\Documents and Settings\Administrator>ORADIM -NEW -SID orcdb2. Instance created.上述命令创建了一个名为orcdb的OracleService。
oracle的RMAN恢复数据库
☐RMAN概述RMAN是Oracle提供的使用程序Recovery Manager,即恢复管理器,使用RMAN可以轻松实现数据库的所有备份任务。
☐RMAN在数据库服务器的帮助下实现数据库文件,控制文件,数据库文件和控制文件的映像副本,以及归档日志文件,数据库服务器参数文件的备份。
☐RMAN也允许使用脚本文件实现数据的备份与恢复,而且这些脚本保存在数据库内,而不需要编写基于OS的脚本文件。
☐RMAN备份的文件自动保存在一个系统指定的目录下,文件的名称也由RMAN 自己维护,当实现数据恢复操作时,恢复指令简洁。
☐RMAN自动寻找需要的文件实现数据恢复。
减少了在传统的导出导出程序中人为错误的发生。
☐RMAN特点☐使用RMAN的优点如下所示。
✓支持增量备份:在传统的备份工具中如EXP或EXPDP,只能实现一个完整备份而不能增量备份,RMAN采用被备份级别实现增量备份,在一个完整备份的基础上,采用增量备份,和传统地备份方式相比,这样可以减少备份的数据量。
✓自动管理备份文件:RMAN备份的数据是RMAN自动管理的,包括文件名字,备份文件存储目录,以及识别最近的备份文件,搜索恢复时需要的表空间、模式或数据文件等备份文件。
✓自动化备份与恢复:在备份和恢复操作时,使用简单的指令就可以实现备份与恢复,且执行过程完全由RMAN自己维护。
✓不产生重做信息:与用户管理的联机备份不同,使用RMAN的联机备份不产生重做信息。
☐RMAN的系统结构组成☐介绍RMAN的系统结构组成。
☐RMAN可执行程序:它是一个客户端工具,用来启动与数据库服务器的连接,从而实现备份与恢复的各种操作。
☐RMAN客户端:一旦建立了与数据库服务器的会话连接,RMAN可执行程序就创建一个客户端,通过客户端完成与数据库服务器之间的通信,完成各种备份与恢复操作的指令。
RMAN客户端可以连接通过Oracle Net连接到可访问的任何主机上。
☐服务器进程:在RMAN建立了与数据库服务器的会话连接后,在数据库服务器端启动一个后台进程,它执行RMAN客户端发出的各种数据恢复与备份指令,并完成实际的磁盘或磁带设备的读写任务。
RMAN 备份集在异机异路径下恢复过程详解
Startup nomount
DECLARE
devtype varchar2(256);
done boolean;
BEGIN
devtype:=sys.dbms_backup_restore.deviceAllocate (type=>'',ident=>'t1');
sys.dbms_backup_restore.restoreSetDatafile;
sys.dbms_backup_restore.restoreDatafileTo(dfnumber=>03,toname=>'D:\ORACLE\PRODUCT.2.0\ORADATA\HRP270\SYSAUX01.DBF');
sys.dbms_backup_restore.restoreDatafileTo(dfnumber=>04,toname=>'D:\ORACLE\PRODUCT.2.0\ORADATA\HRP270\USERS01.DBF');
sys.dbms_backup_restore.restoreDatafileTo(dfnumber=>05,toname=>'D:\ORACLE\PRODUCT.2.0\ORADATA\HRP270\EXAMPLE01.DBF');
sys.dbms_backup_restore.restoreDatafileTo(dfnumber=>06,toname=>'D:\ORACLE\PRODUCT.2.0\ORADATA\HRP270\HIS01');
sys.dbms_backup_restore.restoreDatafileTo(dfnumber=>01,toname=>'D:\ORACLE\PRODUCT.2.0\ORADATA\HRP270\SYSTEM01.DBF');
Oracle 11g 基于RMAN的备份与恢复
Oracle 11g 基于RMAN的备份与恢复备份整个数据库C:\Users\huangluxiang>rman target/RMAN> backup database;RMAN> exit (退出)(1)重做日志损坏SQL> conn /as sysdba已连接到空闲例程。
SQL> startup mount;ORACLE 例程已经启动。
Total System Global Area 1071333376 bytesFixed Size 1375792 bytesVariable Size 729809360 bytesDatabase Buffers 335544320 bytesRedo Buffers 4603904 bytes数据库装载完毕。
SQL> recover database until cancel;完成介质恢复。
SQL> alter database open resetlogs;数据库已更改。
SQL> archive log list;数据库日志模式存档模式自动存档启用存档终点USE_DB_RECOVERY_FILE_DEST最早的联机日志序列 1下一个存档日志序列 1当前日志序列 1备注:恢复Oracle数据库,应该备份整个数据库(2)数据库丢失数据文件,控制文件,重做日志文件C:\Users\huangluxiang>rman target/RMAN> restore controlfile from autobackup;RMAN>alter database mount;RMAN> restore database;SQL> conn /as sysdba已连接。
SQL> recover database using backup controlfile until cancel;ORA-00279: 更改990116 (在12/13/2013 14:06:05 生成) 对于线程1 是必需的ORA-00289: 建议:C:\APP\HUANGLUXIANG\FLASH_RECOVERY_AREA\DLNU\ARCHIVELOG\2013_12_13\ O1_MF_1_5_%U_.ARCORA-00280: 更改990116 (用于线程1) 在序列#5 中指定日志: {<RET>=suggested | filename | AUTO | CANCEL}cancel介质恢复已取消。
Oracle11g数据库热备份恢复的方法
Oracle11g数据库热备份恢复的方法最近发现多个客户使用的Oracle11g数据库,数据备份恢复会有数据异常丢失的问题、用原先exp 和imp导入导出命令会发现,ecology系统当中的部分表和视图不能被导出。
且exp的导出命令不会出现错误日志。
后来查资料找到了另一种解决数据备份恢复的方法:用expdp和impdp命令导出导入数据则没有上述问题。
完整的从服务器创建数据库备份恢复到本机测试环境的脚本如下:注,红色部分可能环境不同需要调整的变量。
--按win+R键打开运行、输入cmd进入命令行--输入Oralce命令行命令:sqlplus /nolog--sysdba身份登录Oracle数据库conn sys/Oracle1234$@orcl as sysdba--更改oracle配置参数alter system set "_allow_level_without_connect_by"=true;--创建临时报空间create temporary tablespace ecology_temp tempfile'D:\Developer\oracle\oradata\orcl\ecology_temp.dbf' size 32M autoextend on next 32M maxsize 2048M extent management local;--创建报空间create tablespace ecology logging datafile 'D:\Developer\oracle\oradata\orcl\ecology.dbf' size 32M autoextend on next 32M maxsize 2048M extent management local;--创建备份输出目录(如果此目录在服务上不存在,则需要手动创建)create directory dmpdir as 'D:\ecology_data';--创建用户create user ecology identified by ecology default tablespace ecology temporary tablespace ecology_temp;--给ecology用户授权grant connect, resource, exp_full_database, imp_full_database to ecology;grant create session to ecology;grant create table to ecology;grant create tablespace to ecology;grant create view to ecology;grant resource, connect, RECOVERY_CATALOG_OWNER to ecology;--授权与ecology用户,解决用户数据导出的问题grant execute on SYS.DBMS_DEFER_IMPORT_INTERNAL to ecology;grant execute on SYS.DBMS_EXPORT_EXTENSION TO ecology;--授权与ecology用户读写备份目录的权限grant read, write on directory dmpdir to ecology;--提交数据commit;--Oracle数据库导出命令expdp ecology/ecology@orcl dumpfile=data0324.dmp(导出的文件) directory=dmpdir schemas=ecology(要导出的用户)--Oralce数据库导入命令impdp ecology/ecology@orcl directory=dmpdir dumpfile=data0324.dmp(要导入的文件,必须和服务器在同一目录下) schemas=ecology(要导入的用户)。
oracle rman将a机备份还原到b机
*.db_recovery_file_dest='/oracle/db_1/flash_recovery_area'
#归档日志路径
*.log_archive_dest_1='LOCATION=/archivelog'
#日志导出
*.user_dump_dest='/oracle/db_1/admin/udump'
SQL> shutdown immediate;
SQL> startup;
5、使用修改后的pfile启动数据库
STARTUP FORCE NOMOUNT PFILE='/oradata/test/initDB1.ora';
6、还原控制文件
run{
set controlfile autobackup format for device type disk to '/home/oracle/backup/controlfile_%F.bkf';#设置自动备份文件位置
#由于未复制联机日志文件,此时提示需要seqence 143388,scn 608805162
#在sqlplus提示符下继续介质恢复
SQL> conn / as sysdba
Connected.
idle> recover database until cancel;
#ORA-01110: data file 1: '/oradata/db1/system01.dbf'
run{
allocate channel diska device type disk format '/home/oracle/backup/all_%U.bkf';
[Oracle数据库]使用RMAN备份与还原数据库原理
使用RMAN备份与还原Oracle数据库原理一、数据库备份概念对于Oracle数据库,备份方式包括物理备份和逻辑备份。
1、物理备份将实际组成数据库的操作系统文件从一处拷贝到另一处的备份过程,通常是从磁盘到磁带。
该方法实现数据库的完整恢复,但数据库必须运行在归档模式下(业务数据库在非归档模式下运行),且需要极大的外部存储设备,例如磁带库,具体包括冷备份和热备份。
冷备份和热备份是物理备份(也称低级备份),它涉及到组成数据库的文件,但不考虑逻辑内容。
使用RMAN备份与还原ORACLE数据库的方式,属于物理备份方法。
2、逻辑备份利用SQL语言从数据库中抽取数据并存于二进制文件的过程。
业务数据库采用此种方式,此方法不需要数据库运行在归档模式下,不但备份简单,而且可以不需要外部存储设备,包括导出/导入(EXPORT/IMPORT)。
这种方法包括读取一系列的数据库日志,并写入文件中,这些日志的读取与其所处位置无关。
二、RMAN备份方式使用RMAN备份Oracle数据库,包括以下三种备份概念。
1、完全备份(Full Backup)与增量备份(Incremental Backup)完全备份与增量备份是针对数据文件而言,控制文件和归档日志文件不能进行增量备份。
当然,后两者可以做备份优化。
2、打开备份(Open Backup)或关闭备份(Closed Backup)数据库打开状态下进行备份即是打开备份,数据库关闭状态下(加载状态)进行的备份即关闭备份。
3、一致备份(Consistent Backup)与不一致备份(Inconsistent Backup)数据库打开状态或不干净关闭状态(shutdown abort)进行的备份是不一致备份,利用不一致的备份修复数据库后还需要做数据库的恢复。
在数据库干净关闭状态进行的备份是一致备份,利用一致备份修复数据库后不需要做数据库的恢复。
三、备份策略由于数据库占据物理空间较大,每次都进行全库备份,对存储介质要求比较高,也会造成空间的冗余浪费,故而在实际的数据备份过程中,通常采用增量备份的方法。
oracle备份如何到异机还原
oracle备份如何到异机还原作者:ocpyang情景描述:有朋友问,MSSQLSERVER将数据库备份还原到其它机器很方便,基本就是傻瓜式操作,oracle有控制文件、参数文件一堆东西,觉得还原很复杂;其实不然,我抽出了点时间,简单演示下案例,朋友们,参考下!为了简单快速,我才用RMAN备份和还原--说明:(1).RMAN备份到异机恢复的时候,db_name需要相同。
如果说要想改成其他的实例名,可以在恢复成功后,用nid命令修改。
实例名的信息会记录到控制文件里,所以如果在恢复的时候,如果实例名不一致,恢复的时候会报错。
(2).恢复的路径和源库不一致时,就需要在restore命令中使用set 命令指定新位置,并且使用switch datafile all将变更信息更新的到控制文件中。
测试环境:源数据库服务器A,安装在E,备份目录已在E盘;源数据库服务器B,安装在F盘.------------------------------------一、源数据库准备工作--------------------------------------1. 查询DBIDSQL> select name,dbid from v$database;NAME DBID--------- ----------ORCL 1320546556--2. 备份源数据DBrun {configure retention policy to recovery window of 14 days;configure controlfileautobackup on; --自动开启控制文件备份configure controlfileautobackup format for device type disk to'E:\backup\controlfile\bak_%F';allocate channel c1 device type disk format 'E:\backup\data\bak_%u'; allocate channel c2 device type disk format 'E:\backup\data\bak_%u'; sql 'alter system archive log current';backup incremental level=0 database skip inaccessibleplus archivelogfilesperset 20delete all input;release channel c1;release channel c2;}allocate channel for maintenance device type disk;crosscheck backupset;delete noprompt obsolete;--或run {configure retention policy to recovery window of 14 days;allocate channel c1 device type disk format 'E:\backup\data\bak_%u'; allocate channel c2 device type disk format 'E:\backup\data\bak_%u'; sql 'alter system archive log current';backup incremental level=0 database skip inaccessibleplus archivelogfilesperset 20delete all input;--手动直接指明备份文件名和路径backup current controlfile tag='bak_ctrollfile'format='E:\backup\controlfile\bak_ctl_file_%U_%T';backup spfile tag='bak_spfile' format='E:\backup\controlfile\bak_spfile_%U_%T'; release channel c1;release channel c2;}allocate channel for maintenance device type disk;crosscheck backupset;delete noprompt obsolete;--3.手动备份spfilecreatepfile='E:\backup\inittest.ora' from spfile;------------------------------------二、目标库准备工作:---------------------------------------步骤1. 创建口令文件--如果有就不需要新建.orapwd file=F:\app\Administrator\product\11.2.0\dbhome_1\database\PWDorcl.ora password=password--步骤2.恢复参数文件--方法1.源数据库spfile并拷贝到B数据库服务器\\192.168.2.25\e$\backup\inittest.ORA复制到E:\bk\inittest.ORA--步骤3.编辑参数文件中的文件路径如路径和原来一样,则不需修改eg:- *_DUMP_DEST- LOG_ARCHIVE_DEST*- CONTROL_FILES---实例:orcl.__db_cache_size=939524096orcl.__java_pool_size=16777216orcl.__large_pool_size=16777216orcl.__oracle_base='F:\app\Administrator'#修改路径orcl.__pga_aggregate_target=855638016orcl.__sga_target=2550136832orcl.__shared_io_pool_size=0orcl.__shared_pool_size=1526726656orcl.__streams_pool_size=16777216*.audit_file_dest='F:\app\Administrator\admin\orcl\adump' #修改路径*.audit_trail='db'*.compatible='11.2.0.0.0'#修改路径*.control_files='F:\app\Administrator\oradata\orcl\control01.ctl','F:\app\Administrator\orada ta\orcl\control02.ctl','F:\app\Administrator\oradata\orcl\control03.ctl'*.db_block_size=8192*.db_domain=''*.db_name='orcl'*.db_recovery_file_dest='F:\arch' #修改路径*.db_recovery_file_dest_size=6442450944*.diagnostic_dest='F:\app\Administrator' #修改路径*.dispatchers='(PROTOCOL=TCP) (SERVICE=orclXDB)'*.log_archive_dest_1='location=f:\arch' #修改路径*.nls_date_format='yyyy-mm-ddhh:mi:ss'*.open_cursors=300*.optimizer_capture_sql_plan_baselines=TRUE*.pga_aggregate_target=845152256*.processes=150*.remote_login_passwordfile='EXCLUSIVE'*.sga_target=2536505344*.skip_unusable_indexes=TRUE*.undo_tablespace='UNDOTBS1'--步骤4.重启实例,使用已编辑好的参数文件将用pfile将B数据库服务器启动到nomout状态rman target /startupnomountpfile='e:\bk\inittest.ora'--步骤5.恢复控制文件,装载数据库rman target /setdbid 1320546556restorecontrolfile from 'e:\bk\controlfile\BAK_CTL_FILE_6LO6SON4_1_1_20130412';启动restore 于2013-04-11 13:58:58使用目标数据库控制文件替代恢复目录分配的通道: ORA_DISK_1通道ORA_DISK_1: SID=129 设备类型=DISK通道ORA_DISK_1: 正在还原控制文件通道ORA_DISK_1: 还原完成, 用时: 00:00:01输出文件名=F:\APP\ADMINISTRATOR\ORADATA\ORCL\CONTROL01.CTL输出文件名=F:\APP\ADMINISTRATOR\ORADATA\ORCL\CONTROL02.CTL输出文件名=F:\APP\ADMINISTRATOR\ORADATA\ORCL\CONTROL03.CTL完成restore 于2013-04-11 13:59:00--步骤6.将DB启动到mout状态alter database mount;数据库已装载释放的通道: ORA_DISK_1--加载备份目录CATALOG START WITH 'E:\bk';搜索与样式E:\bk 匹配的所有文件数据库未知文件的列表====================================文件名: E:\bk\controlfile\BAK_C-1320546556-20130411-03文件名: E:\bk\controlfile\BAK_CTL_FILE_65O6QILO_1_1_20130411 文件名: E:\bk\controlfile\BAK_SPFILE_66O6QILQ_1_1_20130411文件名: E:\bk\data\BAK_60O6QIGV文件名: E:\bk\data\BAK_61O6QIGV文件名: E:\bk\data\BAK_62O6QIH1文件名: E:\bk\data\BAK_63O6QIH1文件名: E:\bk\data\BAK_64O6QILM是否确实要将上述文件列入目录(输入YES 或NO)? yes正在编制文件目录...目录编制完毕已列入目录的文件的列表======================文件名: E:\bk\controlfile\BAK_C-1320546556-20130411-03文件名: E:\bk\controlfile\BAK_CTL_FILE_65O6QILO_1_1_20130411 文件名: E:\bk\controlfile\BAK_SPFILE_66O6QILQ_1_1_20130411文件名: E:\bk\data\BAK_60O6QIGV文件名: E:\bk\data\BAK_61O6QIGV文件名: E:\bk\data\BAK_62O6QIH1文件名: E:\bk\data\BAK_63O6QIH1文件名: E:\bk\data\BAK_64O6QILM--步骤7.restore 数据库7.1 恢复目录不同的情况:到Target 库查询一下:SQL> select trim(file_id),trim(file_name) from dba_data_files ORDER BY FILE_ID ASC;1 E:\APP\ADMINISTRATOR\ORADATA\ORCL\SYSTEM01.DBF2 E:\APP\ADMINISTRATOR\ORADATA\ORCL\SYSAUX01.DBF3 E:\APP\ADMINISTRATOR\ORADATA\ORCL\UNDOTBS01.DBF4 E:\APP\ADMINISTRATOR\ORADATA\ORCL\USERS01.DBF6 E:\APP\ADMINISTRATOR\ORADATA\ORCL\VPAY02.DBF7 E:\APP\ADMINISTRATOR\ORADATA\ORCL\VPAY03.DBF8 E:\APP\ADMINISTRATOR\ORADATA\ORCL\VPAY04.DBF9 E:\APP\ADMINISTRATOR\ORADATA\ORCL\VPAY05.DBF11 E:\APP\ADMINISTRATOR\ORADATA\ORCL\VPAY06.DBF12 E:\APP\ADMINISTRATOR\ORADATA\ORCL\VPAY07.DBF13 E:\APP\ADMINISTRATOR\ORADATA\ORCL\VPAY08.DBF14 E:\APP\ADMINISTRATOR\ORADATA\ORCL\VPAY09.DBF15 E:\APP\ADMINISTRATOR\ORADATA\ORCL\VPAY10.DBF16 E:\APP\ADMINISTRATOR\ORADATA\ORCL\VPAY01.DBF17 E:\APP\ADMINISTRATOR\ORADATA\ORCL\VPAY11.DBF18 E:\APP\ADMINISTRATOR\ORADATA\ORCL\VPAY12.DBF19 E:\APP\ADMINISTRATOR\ORADATA\ORCL\VPAY13.DBF20 E:\APP\ADMINISTRATOR\ORADATA\ORCL\VPAY14.DBF21 E:\APP\ADMINISTRATOR\ORADATA\ORCL\VPAY15.DBF22 E:\APP\ADMINISTRATOR\ORADATA\ORCL\VPAY16.DBF23 E:\APP\ADMINISTRATOR\ORADATA\ORCL\VPAY17.DBF24 E:\APP\ADMINISTRATOR\ORADATA\ORCL\VPAY18.DBF25 E:\APP\ADMINISTRATOR\ORADATA\ORCL\VPAY19.DBF26 E:\APP\ADMINISTRATOR\ORADATA\ORCL\VPAY20.DBFSQL>select trim(file_id),trim(file_name) from dba_temp_files;1 E:\APP\ADMINISTRATOR\ORADATA\ORCL\TEMP01.DBFselect 'SET NEWNAME FOR DATAFILE'|| ' '||file_id||' '||'TO'|| ' '||''''||trim(file_name)||'''' ||';' from dba_data_files ORDER BY FILE_ID ASC;---如下实例:RUN{# rename the datafilesSET NEWNAME FOR DATAFILE 1 TO'F:\APP\ADMINISTRATOR\ORADATA\ORCL\SYSTEM01.DBF'; SET NEWNAME FOR DATAFILE 2 TO'F:\APP\ADMINISTRATOR\ORADATA\ORCL\SYSAUX01.DBF'; SET NEWNAME FOR DATAFILE 3 TO'F:\APP\ADMINISTRATOR\ORADATA\ORCL\UNDOTBS01.DBF'; SET NEWNAME FOR DATAFILE 4 TO'F:\APP\ADMINISTRATOR\ORADATA\ORCL\USERS01.DBF'; SET NEWNAME FOR DATAFILE 6 TO'F:\APP\ADMINISTRATOR\ORADATA\ORCL\VPAY02.DBF'; SET NEWNAME FOR DATAFILE 7 TO'F:\APP\ADMINISTRATOR\ORADATA\ORCL\VPAY03.DBF'; SET NEWNAME FOR DATAFILE 8 TO'F:\APP\ADMINISTRATOR\ORADATA\ORCL\VPAY04.DBF'; SET NEWNAME FOR DATAFILE 9 TO'F:\APP\ADMINISTRATOR\ORADATA\ORCL\VPAY05.DBF'; SET NEWNAME FOR DATAFILE 11 TO'F:\APP\ADMINISTRATOR\ORADATA\ORCL\VPAY06.DBF'; SET NEWNAME FOR DATAFILE 12 TO'F:\APP\ADMINISTRATOR\ORADATA\ORCL\VPAY07.DBF'; SET NEWNAME FOR DATAFILE 13 TO'F:\APP\ADMINISTRATOR\ORADATA\ORCL\VPAY08.DBF'; SET NEWNAME FOR DATAFILE 14 TO'F:\APP\ADMINISTRATOR\ORADATA\ORCL\VPAY09.DBF'; SET NEWNAME FOR DATAFILE 15 TO'F:\APP\ADMINISTRATOR\ORADATA\ORCL\VPAY10.DBF'; SET NEWNAME FOR DATAFILE 16 TO'F:\APP\ADMINISTRATOR\ORADATA\ORCL\VPAY01.DBF'; SET NEWNAME FOR DATAFILE 17 TO'F:\APP\ADMINISTRATOR\ORADATA\ORCL\VPAY11.DBF';SET NEWNAME FOR DATAFILE 18 TO'F:\APP\ADMINISTRATOR\ORADATA\ORCL\VPAY12.DBF';SET NEWNAME FOR DATAFILE 19 TO'F:\APP\ADMINISTRATOR\ORADATA\ORCL\VPAY13.DBF';SET NEWNAME FOR DATAFILE 20 TO'F:\APP\ADMINISTRATOR\ORADATA\ORCL\VPAY14.DBF';SET NEWNAME FOR DATAFILE 21 TO'F:\APP\ADMINISTRATOR\ORADATA\ORCL\VPAY15.DBF';SET NEWNAME FOR DATAFILE 22 TO'F:\APP\ADMINISTRATOR\ORADATA\ORCL\VPAY16.DBF';SET NEWNAME FOR DATAFILE 23 TO'F:\APP\ADMINISTRATOR\ORADATA\ORCL\VPAY17.DBF';SET NEWNAME FOR DATAFILE 24 TO'F:\APP\ADMINISTRATOR\ORADATA\ORCL\VPAY18.DBF';SET NEWNAME FOR DATAFILE 25 TO'F:\APP\ADMINISTRATOR\ORADATA\ORCL\VPAY19.DBF';SET NEWNAME FOR DATAFILE 26 TO'F:\APP\ADMINISTRATOR\ORADATA\ORCL\VPAY20.DBF';SQL "ALTER DATABASE RENAME FILE''E:\app\Administrator\oradata\orcl\REDO01.LOG''TO ''F:\app\Administrator\oradata\orcl\REDO01.LOG'' ";SQL "ALTER DATABASE RENAME FILE''E:\app\Administrator\oradata\orcl\REDO02.LOG''TO ''F:\app\Administrator\oradata\orcl\REDO02.LOG'' ";SQL "ALTER DATABASE RENAME FILE''E:\app\Administrator\oradata\orcl\REDO03.LOG''TO ''F:\app\Administrator\oradata\orcl\REDO03.LOG'' ";RESTORE DATABASE;SWITCH DATAFILE ALL;}对switch datafile all的说明:--对于nocatalog模式下,rman备份的信息是保存在控制文件里的,包括文件的路径信息。
Oracle 10g RAC生产数据库RMAN方式恢复到异地单机数据库全程记录
*.compatible='10.2.0.3.0'
*.control_files='/oracle/oradata/racdb/control01.ctl'
*.core_dump_dest='/oracle/app/oracle/admin/racdb/cdump'
*.db_block_size=8192
set newname for datafile'+ORADATA/racdb/datafile/smmsdb.364.676804261' to '/oracle/oradata/racdb/smmsdb.364.676804261';
set newname for datafile'+ORADATA/racdb/datafile/gosd.329.668687127' to '/oracle/oradata/racdb/gosd.329.668687127';
racdb1.sga_max_size=8388608000
racdb2.sga_max_size=8388608000
*.sga_target=1610612736
racdb1.sga_target=8388608000
racdb2.sga_target=8388608000
TSM Oracle 11gR2数据库异机完全恢复手册
TSM Oracle 11gR2数据库异机完全恢复手册说明:该手册是公司TSM灾备恢复手册的一部分。
目前使用TSM备份的公司已经不多了,而且会使用TSM的人大部分都不会Oracle,会Oracle的人也不一定就会TSM。
而我是两者都不会的人,只是不断的参考别人的帮助,然后一步一步验证出来的,所以说还是很有参考价值。
另外,也可以作为Oracle RMAN恢复的参考,TSM在里面的作用就是开启一个恢复通道而已。
当然,里面也有考虑不全的地方,如果有疑问,可以发邮件到*********************一起讨论。
1.O racle数据库恢复1.1.准备注意事项:➢备份时一定要备份控制文件、数据库和归档日志;➢恢复前必须知道源数据库的详细版本号;➢恢复前必须知道源数据库的数据库名称、数据库ID号(即DBID);➢恢复前必须知道源数据库的控制文件、数据文件、归档日志文件保存的目录路径;➢恢复前必须知道源数据备份的控制文件的备份名称;➢恢复前备份源数据库的TSM配置:NODE名称,DSM.OPT配置文件,TDOP.OPT配置文件(请参考TSM备份架构文档)。
2.1.1.源服务器数据库查询1)登录源服务器数据库,使用查询语句查询源数据库的数据库版本。
查询语句如下:SQL>select * from v$version;得到的结果如下图所示:2)使用查询语句查询源数据库的数据库名称及DBID。
如下:SQL>select name,dbid from v$database;得到的结果如下图:3)使用查询语句查询源数据库的数据文件存放路径。
如下:SQL>select , from v$tablespace t1,v$datafile t2 where t1.ts#=t2.ts#;得到的结果如下图:4)使用查询语句查询SPFILE和PFILE文件位置:SQL>SELECT NAME, VALUE, DISPLAY_VALUE FROM V$PARAMETER WHERE NAME ='spfile';得到下图:5)使用查询语句查询控制文件路径,如下:SQL> select name from v$controlfile;得到下图:6)使用查询语句查询归档日志文件路径,如下:SQL>select destination from v$archive_dest where destination is not null;得到下图:7)使用查询语句查询fast_recover_area的目录路径,如下:SQL>show parameter revocery;或者:SQL>select name from v$recovery_file_dest;得到下图:2.1.2.源数据库备份TSM备份请参考TSM备份架构文档。
ORACLE_11G_HA__NBU异机恢复过程
ORACLE 11G AIX HA ----NBU异机恢复过程恢复前提1.两台机器上NUB软件都已经安装好2.指定Master SERVER 上的/usr/openv/netbackup/bp.conf恢复源FORCE_RESTORE_MEDIA_SERVER = 生产库hostname 测试库hostname从生产库恢复到测试库。
操作目的节点POTLDB01 数据库恢复到POTLDB02即在节点POTLDB01上运行,并在节点POTLDB01上备份,恢复到POTLDB02上节点POTLDB01机器检查过程1.检查环境变量检查root@POTLDB01:/usr/openv/rmanscript#ps -ef |grep smonroot 385272 467274 0 10:40:22 pts/2 0:00 grep smonoracle 655484 1 0 Jul 25 - 0:06 ora_smon_portaldb机器名字root@POTLDB01:/usr/openv/rmanscript#hostnamePOTLDB01root@POTLDB01:/usr/openv/rmanscript#pwd ---rman脚本位置/usr/openv/rmanscriptroot@POTLDB01:/usr/openv/rmanscript#lshot_database_portaldb.sh hot_database_portaldb.sh.out hot_database_portaldb.sh_bak/etc/hosts文件172.16.3.115 POTLDB01_boot172.16.3.116 POTLDB02_boot172.16.3.116 POTLDB02172.16.3.115 POTLDB011.1.3.115 POTLDB01_stby1.1.3.116 POTLDB02_stby172.16.3.117 POTLDB_svc172.16.7.142 SHYQ-PS-MV-SV03-POTLDB01-nbu172.16.7.143 SHYQ-PS-MV-SV03-POTLDB02-nbu 网关IP10.11.233.124 nbumaster172.16.10.250 yqbf原备份脚本:$RMAN target $TARGET_CONNECT_STR nocatalog msglog $RMAN_LOG_FILE append << EOFRUN {ALLOCATE CHANNEL ch00 TYPE 'SBT_TAPE';send 'NB_ORA_CLIENT=SHYQ-PS-MV-SV03-POTLDB01-nbu';BACKUP$BACKUP_TYPESKIP INACCESSIBLETAG hot_db_bk_level0FILESPERSET 5# recommended formatFORMAT 'bk_%s_%p_%t'DATABASE;sql 'alter system archive log current';RELEASE CHANNEL ch00;加入后的脚本如下:BACKUP# recommended formatFORMAT '/oradata/rman_bak/controlfile/ portal_bak _%s_%p_%t'CURRENT CONTROLFILE;在节点POTLDB01成功备份后发现控制文件如下:root@POTLDB02:/usr/openv/rmanscript#ls -l /oradata/rman_bak/controlfiletotal 131072-rw-r----- 1 oracle 1001 13402112 Jul 28 11:38 portal_bak_25_1_757683479-rw-r----- 1 oracle 1001 13434880 Jul 28 11:36 portal_control_c-603295704-20110728-03 -rw-r----- 1 oracle 1001 13434880 Jul 28 11:38 portal_control_c-603295704-20110728-04 -rw-r----- 1 oracle dba 13434880 Jul 28 13:46 portal_control_c-603295704-20110728-05 -rw-r----- 1 oracle 1001 13402112 Jul 28 11:36 portaldb_controlfile_bak_23_1_757683366 获取DBIDSQL> select dbid from v$database;DBID----------603295704查看备份记录root@POTLDB01:/usr/openv/netbackup/bin#./bplist -C SHYQ-PS-MV-SV03-POTLDB01-nbu -S nbumaster -t 4 -R //c-603295704-20110728-02/cntrl_21_1_757683165/c-603295704-20110728-01/al_bk_19_1_757682964/c-603295704-20110728-00/bk_17_1_757682762/bk_16_1_757682227/bk_603295704_11_1_757680386/cntrl_10_1_757680271/al_bk_603295704_8_1_757680166/bk_603295704_7_1_757680069/bk_603295704_6_1_757679974/cntrl_5_1_757679319/al_4_1_757679223/bk_3_1_757679124/bk_2_1_757678789模拟数据库文件被删掉root@POTLDB01:/oradata/datafiles/portaldb#pwd/oradata/datafiles/portaldbroot@POTLDB01:/oradata/datafiles/portaldb#lsarchives control02.ctl redo101.log redo201.log redo301.log redo401.log redo501.log sysaux01.dbf temp01.dbf users01.dbfcontrol01.ctl control03.ctl redo102.log redo202.log redo302.log redo402.log redo502.log system01.dbf undotbs01.dbfroot@POTLDB01:/oradata/datafiles/portaldb#cd ../root@POTLDB01:/oradata/datafiles#lsportaldbroot@POTLDB01:/oradata/datafiles#lsportaldbroot@POTLDB01:/oradata/datafiles#mv portaldb portal_colroot@POTLDB01:/oradata/datafiles#mkdir portaldbroot@POTLDB01:/oradata/datafiles#cd portaldbroot@POTLDB01:/oradata/datafiles/portaldb#lsroot@POTLDB01:/oradata/datafiles/portaldb#mkdir archivesroot@POTLDB01:/oradata/datafiles/portaldb#chown –R oracle:dba /oradata/datafiles异机恢复到POTLDB02过程root@POTLDB02:/#lspvhdisk0 00c5c5666830b3fa rootvg active hdisk1 00c5c5666c01952b rootvg active hdisk2 00c5c5366a63d937 datavghdisk3 00c5c5366a65b992 hbvgroot@POTLDB02:/#varyonvg datavgroot@POTLDB02:/#mount /dev/data_lv /oradataroot@POTLDB02:/#su - oracleoracle@POTLDB02:/home/oracle$sqlplus /nologconnSQL*Plus: Release 11.1.0.7.0 - Production on Thu Jul 28 13:32:28 2011Copyright (c) 1982, 2008, Oracle. All rights reserved.SQL> /as sysdba;Connected to an idle instance.SQL>SQL>SQL>SQL> exitDisconnectedoracle@POTLDB02:/home/oracle$rman target /Recovery Manager: Release 11.1.0.7.0 - Production on Thu Jul 28 13:32:49 2011 Copyright (c) 1982, 2007, Oracle. All rights reserved.connected to target database (not started)RMAN> startup nomount;Oracle instance startedTotal System Global Area 43025158144 bytesFixed Size 2156784 bytesVariable Size 20669531920 bytesDatabase Buffers 22280142848 bytesRedo Buffers 73326592 bytesRMAN> set dbid=603295704executing command: SET DBIDRMAN> restore controlfile from '/oradata/rman_bak/controlfile/portal_bak_25_1_757683479';Starting restore at 28-JUL-11using target database control file instead of recovery catalogallocated channel: ORA_DISK_1channel ORA_DISK_1: SID=2188 device type=DISKchannel ORA_DISK_1: restoring control filechannel ORA_DISK_1: restore complete, elapsed time: 00:00:01output file name=/oradata/datafiles/portaldb/control01.ctloutput file name=/oradata/datafiles/portaldb/control02.ctloutput file name=/oradata/datafiles/portaldb/control03.ctlFinished restore at 28-JUL-11RMAN> alter database mount;database mountedRMAN>RMAN>RMAN> run2> {3> allocate channel t1 type 'sbt_tape' parms 'ENV=(NB_ORA_SERVER=nbumaster,NB_ORA_CLIENT=SHYQ-PS-MV-SV03-POTLDB01-nbu)';4> allocate channel t2 type 'sbt_tape' parms 'ENV=(NB_ORA_SERVER=nbumaster,NB_ORA_CLIENT=SHYQ-PS-MV-SV03-POTLDB01-nbu)';5> restore database;6> switch datafile all;7> recover database;8> sql 'alter database open resetlogs';9> release channel t1;10> release channel t2;11> }allocated channel: t1channel t1: SID=2187 device type=SBT_TAPEchannel t1: Veritas NetBackup for Oracle - Release 6.5 (2009050106)allocated channel: t2channel t2: SID=2188 device type=SBT_TAPEchannel t2: Veritas NetBackup for Oracle - Release 6.5 (2009050106)Starting restore at 28-JUL-11channel t1: starting datafile backup set restorechannel t1: specifying datafile(s) to restore from backup setchannel t1: restoring datafile 00001 to /oradata/datafiles/portaldb/system01.dbfchannel t1: restoring datafile 00002 to /oradata/datafiles/portaldb/sysaux01.dbfchannel t1: restoring datafile 00003 to /oradata/datafiles/portaldb/undotbs01.dbfchannel t1: restoring datafile 00004 to /oradata/datafiles/portaldb/users01.dbfchannel t1: reading from backup piece bk_16_1_757682227channel t1: piece handle=bk_16_1_757682227 tag=HOT_DB_BK_LEVEL0channel t1: restored backup piece 1channel t1: restore complete, elapsed time: 00:03:55Finished restore at 28-JUL-11Starting recover at 28-JUL-11starting media recoverychannel t1: starting archived log restore to default destinationchannel t1: restoring archived logarchived log thread=1 sequence=11channel t1: restoring archived logarchived log thread=1 sequence=12channel t1: reading from backup piece al_bk_19_1_757682964channel t1: piece handle=al_bk_19_1_757682964 tag=TAG20110728T112924channel t1: restored backup piece 1channel t1: restore complete, elapsed time: 00:01:25archived log file name=/oradata/datafiles/portaldb/archives/1_11_756554328.dbf thread=1 sequence=11 archived log file name=/oradata/datafiles/portaldb/archives/1_12_756554328.dbf thread=1 sequence=12 unable to find archived logarchived log thread=1 sequence=13released channel: t1released channel: t2RMAN-00571: ===========================================================RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============RMAN-00571: ===========================================================RMAN-03002: failure of recover command at 07/28/2011 13:44:17RMAN-06054: media recovery requesting unknown archived log for thread 1 with sequence 13 and starting SCN of 436680RMAN> alter database open;RMAN-00571: =========================================================== RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS =============== RMAN-00571: =========================================================== RMAN-03002: failure of alter db command at 07/28/2011 13:45:00ORA-01589: must use RESETLOGS or NORESETLOGS option for database open RMAN> sql 'alter database open resetlogs';sql statement: alter database open resetlogs成功检查oracle@POTLDB02:/home/oracle$sqlplus /nologSQL*Plus: Release 11.1.0.7.0 - Production on Thu Jul 28 14:04:12 2011Copyright (c) 1982, 2008, Oracle. All rights reserved.SQL> conn /as sysdba;Connected.SQL>SQL>SQL> select status,instance_name from v$instance;STATUS INSTANCE_NAME------------ ----------------OPEN portaldbSQL>。
利用RMAN将Oracle 11g的文件系统单实例数据库移植到双机RAC+ASM环境的过程
利用RMAN将Oracle 11g的文件系统单实例数据库移植到双机RAC+ASM环境的过程目的:利用单实例的rman全备,恢复到已有的RAC的ASM磁盘组内,删除RAC 已有的数据库,完成单实例数据库到RAC的环境迁移。
环境:单实例:sid: single版本:11.1.0.7ip: 192.168.76.160data: /home/oracle/single已有RAC:数据库:racdb版本:11.1.0.7testrac01: 192.168.76.160/161 sid: racdb1testrac02: 192.168.76.162/163 sid: racdb2data:+TESTDG/racdbdb_name: racdbsidprefix: racdbinit file: +TESTDG/racdb/spfileracdb.ora一、已有RAC的环境。
su - oracleexport ORACLE_SID=+ASM1sqlplus / as sysdbaselect name,state from v$asm_diskgroup;SQL> select name,state from v$asm_diskgroup;NAME STATE-------------------- -------------------TESTDG MOUNTEDalter system set log_archive_dest_1='Location=/arch_dir' scope=spfile sid='racdb1'; alter system set log_archive_format='racdb_%t_%s_%r.dbf' scope=spfile sid='racdb1'; alter system set log_archive_dest_1='Location=/arch_dir' scope=spfile sid='racdb2'; alter system set log_archive_format='racdb_%t_%s_%r.dbf' scope=spfile sid='racdb2';二、单实例的备份单实例和rac的版本要一致,包括小版本。
使用RMAN恢复数据库到不同主机
使用RMAN恢复数据库到不同主机2009-05-20 14:33当未使用catalog方式进行rman备份时,将备份集转移到其他主机时,除非目录结构相同,否则控制文件将无法识别路径不同的备份集,针对这类问题,可以使用dbms_backup_restore包进行文件回复;但是从Oracle 10g开始,Oracle终于简化了这类问题的处理,现在通过rman可以很容易地处理不同主机的rman备份集恢复。
一、获得源数据库的参数文件,修改后传送至目标数据库,修改后的参数文件可以用于数据库启动,主要修改的参数应该包括:*_dmpb_dest、control_files、db_recovery_file_dest、db_create_file_dest等。
二、建立相应的文件夹如:admin下建立cinwa及里面对应的文件夹(adump,bdump,cdump,dpdump,pfile,udump),oradata下建立cinwa,flash_recovery_area下建立cinwa三、在window平台下,可以通过oradim创建一个服务启动oracle环境C:\>oradim -new -sid cinwa实例已创建。
注意:记得启动服务。
四、通过rman来启动数据库到nomount状态C:\>set oracle_sid=cinwaC:\>rman target /RMAN> startup nomount pfile ='D:\oracle\product\10.2.0\admin\cinwa\pfile\init.ora';通过参数文件启动到noumount状态,参数文件所在位置在$ORACLE_HOME/database,$ORACLE_HOME/dbs,$ORACLE_BASE/admin/pfile相应目录下,记录了各种启动所必须得参数,如果现在所在的数据库的安装目录与源数据库不同,则需要更改路径.五、通过备份的控制文件恢复出控制文件RMAN> restore controlfile from 'D:\oracle\product\10.2.0\\backupC-515068080-20090518-02.BKP';然后根据参数文件的control_files设置,复制相应的副本。
使用RMAN恢复Oracle 10g RAC库至异机
使用RMAN恢复Oracle 10g RAC库至异机主RAC库:2个节点rac1(192.168.218.168),rac2(192.168.218.168) 采用ASM+RAW备机standby(192.168.218.188) 文件系统一。
在rac库备份:rac1-> crs_stat -tName Type Target State Host------------------------------------------------------------ora....SM1.asm application ONLINE ONLINE rac1ora....C1.lsnr application ONLINE ONLINE rac1ora.rac1.gsd application ONLINE ONLINE rac1ora.rac1.ons application ONLINE ONLINE rac1ora.rac1.vip application ONLINE ONLINE rac1ora....SM2.asm application ONLINE ONLINE rac2ora....C2.lsnr application ONLINE ONLINE rac2ora.rac2.gsd application ONLINE ONLINE rac2ora.rac2.ons application ONLINE ONLINE rac2ora.rac2.vip application ONLINE ONLINE rac2ora.racdb.db application ONLINE ONLINE rac1ora....b1.inst application ONLINE ONLINE rac1ora....b2.inst application ONLINE ONLINE rac2rac1->rac1-> export ORACLE_SID=racdb1rac1-> rman target / nocatalogRMAN> run{2> allocate CHANNEL ch00 type DISK CONNECT 'sys/oracle@racdb1';3> allocate CHANNEL ch01 type DISK CONNECT 'sys/oracle@racdb2';4> backup database format '/rmanset/racdb_full_%d%t%s%p' tag 'fullbackup';5> BACKUP FORMAT '/rmanset/%d_arch_%s_%p_%h' ARCHIVELOG ALL;6> backup format '/rmanset/cf_%d_%s_%p'7> (current controlfile);8> RELEASE CHANNEL ch00;9> RELEASE CHANNEL ch01;10> }allocated channel: ch00channel ch00: sid=148 instance=racdb1 devtype=DISKallocated channel: ch01channel ch01: sid=148 instance=racdb2 devtype=DISKStarting backup at 02-NOV-08channel ch00: starting full datafile backupsetchannel ch00: specifying datafile(s) in backupsetinput datafile fno=00001 name=+RACDATA/racdb/datafile/system.259.669487425input datafile fno=00005 name=+RACDATA/racdb/datafile/users.264.669487561input datafile fno=00004 name=+RACDATA/racdb/datafile/undotbs2.263.669487539 channel ch00: starting piece 1 at 02-NOV-08channel ch01: starting full datafile backupsetchannel ch01: specifying datafile(s) in backupsetinput datafile fno=00003 name=+RACDATA/racdb/datafile/sysaux.261.669487497input datafile fno=00002 name=+RACDATA/racdb/datafile/undotbs1.260.669487479 channel ch01: starting piece 1 at 02-NOV-08channel ch00: finished piece 1 at 02-NOV-08piece handle=/rmanset/racdb_full_RACDB669769770931 tag=FULLBACKUP comment=NONE channel ch00: backup set complete, elapsed time: 00:02:19channel ch00: starting full datafile backupsetchannel ch00: specifying datafile(s) in backupsetincluding current control file in backupsetchannel ch00: starting piece 1 at 02-NOV-08channel ch01: finished piece 1 at 02-NOV-08piece handle=/rmanset/racdb_full_RACDB669769784941 tag=FULLBACKUP comment=NONE channel ch01: backup set complete, elapsed time: 00:02:28channel ch01: starting full datafile backupsetchannel ch01: specifying datafile(s) in backupsetincluding current SPFILE in backupsetchannel ch01: starting piece 1 at 02-NOV-08channel ch00: finished piece 1 at 02-NOV-08piece handle=/rmanset/racdb_full_RACDB669769914951 tag=FULLBACKUP comment=NONE channel ch00: backup set complete, elapsed time: 00:00:11channel ch01: finished piece 1 at 02-NOV-08piece handle=/rmanset/racdb_full_RACDB669769933961 tag=FULLBACKUP comment=NONE channel ch01: backup set complete, elapsed time: 00:00:05Finished backup at 02-NOV-08Starting backup at 02-NOV-08current log archivedchannel ch00: starting archive log backupsetchannel ch00: specifying archive log(s) in backup setinput archive log thread=1 sequence=42 recid=141 stamp=669603048input archive log thread=1 sequence=44 recid=149 stamp=669640424input archive log thread=1 sequence=45 recid=151 stamp=669675778input archive log thread=1 sequence=46 recid=152 stamp=669679426input archive log thread=1 sequence=47 recid=156 stamp=669690456channel ch00: starting piece 1 at 02-NOV-08channel ch01: starting archive log backupsetchannel ch01: specifying archive log(s) in backup setinput archive log thread=1 sequence=53 recid=170 stamp=669767346input archive log thread=1 sequence=54 recid=172 stamp=669769357input archive log thread=2 sequence=44 recid=165 stamp=669764276input archive log thread=2 sequence=45 recid=167 stamp=669765472input archive log thread=2 sequence=46 recid=168 stamp=669765474input archive log thread=2 sequence=47 recid=169 stamp=669767345input archive log thread=2 sequence=48 recid=171 stamp=669769352input archive log thread=2 sequence=49 recid=175 stamp=669769944channel ch01: starting piece 1 at 02-NOV-08channel ch01: finished piece 1 at 02-NOV-08piece handle=/rmanset/RACDB_arch_98_1_2 tag=TAG20081102T231211 comment=NONE channel ch01: backup set complete, elapsed time: 00:00:04channel ch00: finished piece 1 at 02-NOV-08piece handle=/rmanset/RACDB_arch_97_1_1 tag=TAG20081102T231211 comment=NONE channel ch00: backup set complete, elapsed time: 00:00:11channel ch00: starting archive log backupsetchannel ch00: specifying archive log(s) in backup setinput archive log thread=1 sequence=48 recid=158 stamp=669690550input archive log thread=1 sequence=49 recid=160 stamp=669691146input archive log thread=1 sequence=50 recid=162 stamp=669755973input archive log thread=1 sequence=51 recid=163 stamp=669757116input archive log thread=1 sequence=52 recid=166 stamp=669764278input archive log thread=1 sequence=55 recid=173 stamp=669769375input archive log thread=1 sequence=56 recid=174 stamp=669769928channel ch00: starting piece 1 at 02-NOV-08channel ch00: finished piece 1 at 02-NOV-08piece handle=/rmanset/RACDB_arch_99_1_1 tag=TAG20081102T231211 comment=NONE channel ch00: backup set complete, elapsed time: 00:00:08Finished backup at 02-NOV-08Starting backup at 02-NOV-08channel ch00: starting full datafile backupsetchannel ch00: specifying datafile(s) in backupsetincluding current control file in backupsetchannel ch00: starting piece 1 at 02-NOV-08channel ch00: finished piece 1 at 02-NOV-08piece handle=/rmanset/cf_RACDB_100_1 tag=TAG20081102T231235 comment=NONE channel ch00: backup set complete, elapsed time: 00:00:07Finished backup at 02-NOV-08released channel: ch00released channel: ch012. 在rac库上创建pfileSQL> create pfile='/rmanset/initracdb.ora' from spfile;将rac1,rac2上的备份出来的rman文件和pfile ftp 至standby 主机二:standby 主机做恢复的过程:0.修改ftp过来的pfile,主要是rac中一些参数去掉:#*.cluster_database_instances=2*.cluster_database=false#racdb2.instance_number=2#racdb1.instance_number=1#racdb2.thread=2#racdb1.thread=1#racdb2.undo_tablespace='UNDOTBS2'#*.db_file_name_convert='+RACDATA/racdb/datafile/','/oradata/racdb/'#*.fal_client='RACDB'#*.fal_server='STANDBY'#*.log_archive_config='DG_CONFIG=(racdb,standby)'#racdb2.log_archive_dest_1='LOCATION=/racdb2_arch VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=racdb' #*.log_archive_dest_2='SERVICE=standby LGWR ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE)DB_UNIQUE_NAME=standby'#*.log_archive_dest_state_2='ENABLE'#*.log_file_name_convert='+RACDATA/racdb/onlinelog/','/oradata/racdb/'#*.remote_listener='LISTENERS_RACDB'#*.standby_file_management='AUTO'1.数据库启动到nomount2.restore controlfile3.restore archivelog4.recover database5.改变logfile 的位置,重新建redo6.drop 一个undo tablespace.7.add a temp tablespace8. 配tnsnames.ora 和listener.ora下为操作的过程:standby-> rman target /Recovery Manager: Release 10.2.0.1.0 - Production on Sun Nov 2 14:22:39 2008 Copyright (c) 1982, 2005, Oracle. All rights reserved.connected to target database: racdb (not mounted)--恢复controlfileRMAN> restore controlfile from '/rmanset/cf_RACDB_100_1';Starting restore at 02-NOV-08using channel ORA_DISK_1channel ORA_DISK_1: restoring control filechannel ORA_DISK_1: restore complete, elapsed time: 00:00:05output filename=/oradata/racdb/control01.ctlFinished restore at 02-NOV-08---restore datafile and archive logRMAN> sql 'alter database mount';sql statement: alter database mountreleased channel: ORA_DISK_1RMAN> run{2> set until sequence 57 thread 1;3> set newname for datafile 1 to '/oradata/racdb/system01.dbf';4> set newname for datafile 2 to '/oradata/racdb/undotbs01.dbf';5> set newname for datafile 3 to '/oradata/racdb/sysaux01.dbf';6> set newname for datafile 4 to '/oradata/racdb/users01.dbf';7> set newname for datafile 5 to '/oradata/racdb/undotbs02.dbf';8> restore database;9> switch datafile all;10> }executing command: SET until clauseexecuting command: SET NEWNAMEexecuting command: SET NEWNAMEexecuting command: SET NEWNAMEexecuting command: SET NEWNAMEexecuting command: SET NEWNAMEStarting restore at 02-NOV-08allocated channel: ORA_DISK_1channel ORA_DISK_1: sid=155 devtype=DISKchannel ORA_DISK_1: starting datafile backupset restorechannel ORA_DISK_1: specifying datafile(s) to restore from backup set restoring datafile 00001 to /oradata/racdb/system01.dbfrestoring datafile 00004 to /oradata/racdb/users01.dbfrestoring datafile 00005 to /oradata/racdb/undotbs02.dbfchannel ORA_DISK_1: reading from backup piece /rmanset/racdb_full_RACDB669769770931 channel ORA_DISK_1: restored backup piece 1piece handle=/rmanset/racdb_full_RACDB669769770931 tag=FULLBACKUPchannel ORA_DISK_1: restore complete, elapsed time: 00:00:36channel ORA_DISK_1: starting datafile backupset restorechannel ORA_DISK_1: specifying datafile(s) to restore from backup setrestoring datafile 00002 to /oradata/racdb/undotbs01.dbfrestoring datafile 00003 to /oradata/racdb/sysaux01.dbfchannel ORA_DISK_1: reading from backup piece /rmanset/racdb_full_RACDB669769784941 channel ORA_DISK_1: restored backup piece 1piece handle=/rmanset/racdb_full_RACDB669769784941 tag=FULLBACKUPchannel ORA_DISK_1: restore complete, elapsed time: 00:00:35Finished restore at 02-NOV-08datafile 1 switched to datafile copyinput datafile copy recid=10 stamp=669738296 filename=/oradata/racdb/system01.dbf datafile 2 switched to datafile copyinput datafile copy recid=11 stamp=669738296 filename=/oradata/racdb/undotbs01.dbf datafile 3 switched to datafile copyinput datafile copy recid=12 stamp=669738296 filename=/oradata/racdb/sysaux01.dbf datafile 4 switched to datafile copyinput datafile copy recid=13 stamp=669738297 filename=/oradata/racdb/users01.dbf datafile 5 switched to datafile copyinput datafile copy recid=14 stamp=669738297 filename=/oradata/racdb/undotbs02.dbf RMAN>--列出备份的archivelog:RMAN> list backup of archivelog all;using target database control file instead of recovery catalogList of Backup Sets===================BS Key Size Device Type Elapsed Time Completion Time------- ---------- ----------- ------------ ---------------89 2.44M DISK 00:00:03 02-NOV-08BP Key: 89 Status: AVAILABLE Compressed: NO Tag: TAG20081102T231211 Piece Name: /rmanset/RACDB_arch_98_1_2List of Archived Logs in backup set 89Thrd Seq Low SCN Low Time Next SCN Next Time---- ------- ---------- --------- ---------- ---------1 53 356353 02-NOV-08 396535 02-NOV-081 54 396535 02-NOV-08 398232 02-NOV-082 44 350717 02-NOV-08 356350 02-NOV-082 45 356350 02-NOV-08 376487 02-NOV-082 46 376487 02-NOV-08 396536 02-NOV-082 47 396536 02-NOV-08 397820 02-NOV-082 48 397820 02-NOV-08 398228 02-NOV-082 49 398228 02-NOV-08 398963 02-NOV-08BS Key Size Device Type Elapsed Time Completion Time------- ---------- ----------- ------------ ---------------90 17.42M DISK 00:00:07 02-NOV-08BP Key: 90 Status: AVAILABLE Compressed: NO Tag: TAG20081102T231211 Piece Name: /rmanset/RACDB_arch_97_1_1List of Archived Logs in backup set 90Thrd Seq Low SCN Low Time Next SCN Next Time---- ------- ---------- --------- ---------- ---------1 42 285767 01-NOV-08 285925 01-NOV-081 44 286441 01-NOV-08 286516 01-NOV-081 45 286516 01-NOV-08 308174 01-NOV-081 46 308174 01-NOV-08 312441 01-NOV-081 47 312441 01-NOV-08 324657 02-NOV-08BS Key Size Device Type Elapsed Time Completion Time------- ---------- ----------- ------------ ---------------91 9.69M DISK 00:00:04 02-NOV-08BP Key: 91 Status: AVAILABLE Compressed: NO Tag: TAG20081102T231211 Piece Name: /rmanset/RACDB_arch_99_1_1List of Archived Logs in backup set 91Thrd Seq Low SCN Low Time Next SCN Next Time---- ------- ---------- --------- ---------- ---------1 48 324657 02-NOV-08 324727 02-NOV-081 49 324727 02-NOV-08 325613 02-NOV-081 50 325613 02-NOV-08 349040 02-NOV-081 51 349040 02-NOV-08 350714 02-NOV-081 52 350714 02-NOV-08 356353 02-NOV-081 55 398232 02-NOV-08 398433 02-NOV-081 56 398433 02-NOV-08 398960 02-NOV-08--restore archivelog and recover database.RMAN>RMAN> run{2> set archivelog destination to '/racdb_arch';3> restore archivelog from sequence 49 thread 2;}4>executing command: SET ARCHIVELOG DESTINATIONStarting restore at 02-NOV-08using channel ORA_DISK_1channel ORA_DISK_1: starting archive log restore to user-specified destination archive log destination=/racdb_archchannel ORA_DISK_1: restoring archive logarchive log thread=2 sequence=49channel ORA_DISK_1: reading from backup piece /rmanset/RACDB_arch_98_1_2 channel ORA_DISK_1: restored backup piece 1piece handle=/rmanset/RACDB_arch_98_1_2 tag=TAG20081102T231211 channel ORA_DISK_1: restore complete, elapsed time: 00:00:02Finished restore at 02-NOV-08RMAN>RMAN>RMAN> run{2> set archivelog destination to '/racdb_arch';3> restore archivelog from sequence 44 thread 2;4> }Starting restore at 02-NOV-08using channel ORA_DISK_1archive log thread 2 sequence 49 is already on disk as file /racdb_arch/2_49_669487401.dbf channel ORA_DISK_1: starting archive log restore to user-specified destinationarchive log destination=/racdb_archchannel ORA_DISK_1: restoring archive logarchive log thread=2 sequence=44channel ORA_DISK_1: restoring archive logarchive log thread=2 sequence=45channel ORA_DISK_1: restoring archive logarchive log thread=2 sequence=46channel ORA_DISK_1: restoring archive logarchive log thread=2 sequence=47channel ORA_DISK_1: restoring archive logarchive log thread=2 sequence=48channel ORA_DISK_1: reading from backup piece /rmanset/RACDB_arch_98_1_2channel ORA_DISK_1: restored backup piece 1piece handle=/rmanset/RACDB_arch_98_1_2 tag=TAG20081102T231211channel ORA_DISK_1: restore complete, elapsed time: 00:00:02Finished restore at 02-NOV-08RMAN> run{2> set until sequence 57 thread 1;3> recover database;4> }executing command: SET until clauseStarting recover at 02-NOV-08using channel ORA_DISK_1starting media recoveryarchive log thread 2 sequence 49 is already on disk as file /racdb_arch/2_49_669487401.dbfchannel ORA_DISK_1: starting archive log restore to default destinationchannel ORA_DISK_1: restoring archive logarchive log thread=1 sequence=56channel ORA_DISK_1: reading from backup piece /rmanset/RACDB_arch_99_1_1channel ORA_DISK_1: restored backup piece 1piece handle=/rmanset/RACDB_arch_99_1_1 tag=TAG20081102T231211channel ORA_DISK_1: restore complete, elapsed time: 00:00:02archive log filename=/racdb_arch/1_56_669487401.dbf thread=1 sequence=56archive log filename=/racdb_arch/2_49_669487401.dbf thread=2 sequence=49media recovery complete, elapsed time: 00:00:01Finished recover at 02-NOV-08--对redo 作修改:alter database rename file '+RACDATA/racdb/onlinelog/group_1.257.669487411' to '/oradata/racdb/redo1'; alter database rename file '+RACDATA/racdb/onlinelog/group_2.258.669487419' to '/oradata/racdb/redo2'; alter database rename file '+RACDATA/racdb/onlinelog/group_3.265.669489319' to '/oradata/racdb/redo3'; alter database rename file '+RACDATA/racdb/onlinelog/group_4.266.669489327' to '/oradata/racdb/redo4';SQL> select member from v$logfile;--------------------------------------------------------------------------------+RACDATA/racdb/onlinelog/group_1.257.669487411+RACDATA/racdb/onlinelog/group_2.258.669487419+RACDATA/racdb/onlinelog/group_3.265.669489319+RACDATA/racdb/onlinelog/group_4.266.669489327SQL> alter database rename file '+RACDATA/racdb/onlinelog/group_1.257.669487411' to '/oradata/racdb/redo1'; Database altered.SQL> alter database rename file '+RACDATA/racdb/onlinelog/group_2.258.669487419' to '/oradata/racdb/redo2'; alter database rename file '+RACDATA/racdb/onlinelog/group_3.265.669489319' to '/oradata/racdb/redo3';alter database rename file '+RACDATA/racdb/onlinelog/group_4.266.669489327' to '/oradata/racdb/redo4'; Database altered.SQL>Database altered.SQL>Database altered.SQL> alter database open resetlogs;Database altered.SQL>SQL>SQL> select THREAD#, STATUS, ENABLED from v$thread;THREAD# STATUS ENABLED---------- ------ --------1 OPEN PUBLIC2 CLOSED PUBLICSQL>SQL> select group# from v$log where THREAD#=2;GROUP#----------34SQL> alter database disable thread 2;Database altered.SQL> alter database drop logfile group 4;alter database drop logfile group 4*ERROR at line 1:ORA-00350: log 4 of instance racdb2 (thread 2) needs to be archived ORA-00312: online log 4 thread 2: '/oradata/racdb/redo4'SQL> alter database clear unarchived logfile group 3;Database altered.SQL> alter database drop logfile group 3;Database altered.SQL> alter database drop logfile group 4;alter database drop logfile group 4*ERROR at line 1:ORA-00350: log 4 of instance racdb2 (thread 2) needs to be archived ORA-00312: online log 4 thread 2: '/oradata/racdb/redo4'SQL> alter database clear unarchived logfile group 4;Database altered.SQL> alter database drop logfile group 4;Database altered.SQL> select group#,member from v$logfile;GROUP#--------------------------------------------------------------------------------1/oradata/racdb/redo12/oradata/racdb/redo2SQL> select THREAD#, STATUS, ENABLED from v$thread;THREAD# STATUS ENABLED---------- ------ --------1 OPEN PUBLIC对undo 的处理:SQL> show parameter undoNAME TYPE VALUE------------------------------------ ----------- ------------------------------undo_management string AUTOundo_retention integer 900undo_tablespace string UNDOTBS1SQL> select tablespace_name from dba_tablespaces where contents='UNDO';TABLESPACE_NAME------------------------------UNDOTBS1UNDOTBS2SQL> drop tablespace UNDOTBS2 including contents and datafiles;Tablespace dropped.SQL> select tablespace_name from dba_tablespaces where contents='UNDO';TABLESPACE_NAME------------------------------UNDOTBS1SQL>对temp的处理:create temporary tablespace TEMP1 tempfile '/oradata/racdb/temp01.dbf' size 50M autoextend off;SQL> select name from v$tempfile;NAME--------------------------------------------------------------------------------------------------------------------------------------------- /oradata/racdb/RACDB/datafile/o1_mf_temp_4jtl9yfl_.tmpSQL>SQL>SQL> select tablespace_name from dba_tablespaces where contents='TEMPORARY';TABLESPACE_NAME------------------------------TEMPSQL> create temporary tablespace TEMP12 tempfile '/oradata/racdb/temp01.dbf'3 size 50M autoextend off;Tablespace created.SQL> alter database default temporary tablespace TEMP1; Database altered.SQL> drop tablespace TEMP including contents and datafiles; Tablespace dropped.SQL>再配上tnsnames.ora 及listener.ora#####参考metalink Note:415579.1。
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
ORACLE11G RMAN备份恢复到异机数据库1. 主数据库环境操作系统版本 : Centos6.7 x64数据库版本 : Oracle 11.2.0.4 x64数据库名 : prb数据库SID : prbdb_unique_name : prbinstance_name : prbIP : 10.0.8.1002. 备库环境操作系统版本 : Centos6.7 x64数据库版本 : Oracle 11.2.0.4 x64 (只安装oracle数据库软件,no netca dbca)数据库名 : prb数据库SID : prbdb_unique_name: prbinstance_name : prbIP:10.0.8.101将参数文件备份、控制文件备份、数据文件备份、以及归档备份到目标主机1 此处实验环境为同平台,同字节序,同版本,源机器和目标机器相同的目录结构。
2 目标机器只需要安装oracle只安装oracle数据库软件,no netca dbca3 第一次利用备份恢复测试环境,之后从源机器拷贝备份到目标机器并在控制文件中注册,再见行恢复测试。
备份数据库backup format '/u01/prb/rmanbk/fulldb_%d_%U' database include current controlfile plus archivelog delete input;orapwd file='/u01/app/oracle/product/11.2.0.4/db_1/dbs/orapwprb' password=oracle entries=10 force=y1rman 连接到源数据库prd-db1-> rman target /Recovery Manager: Release 11.2.0.4.0 - Production on Wed Aug 17 19:23:27 2016 Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved. connected to target database: PRB (DBID=1906641159)RMAN>2 分别列出参数文件备份,控制文件备份,数据文件备份,以及归档备份的名字参数文件备份如下:RMAN> list backup of spfile;using target database control file instead of recovery catalogList of Backup Sets===================BS Key Type LV Size Device Type Elapsed Time Completion Time------- ---- -- ---------- ----------- ------------ -------------------3 Full 9.36M DISK 00:00:01 2016/08/17 16:47:34BP Key: 3 Status: AVAILABLE Compressed: NO Tag: TAG20160817T164718 Piece Name: /u01/prb/rmanbk/fulldb_PRB_04rdg8d5_1_1SPFILE Included: Modification time: 2016/08/17 16:30:57SPFILE db_unique_name: PRB控制文件备份如下:RMAN> list backup of controlfile;List of Backup Sets===================BS Key Type LV Size Device Type Elapsed Time Completion Time------- ---- -- ---------- ----------- ------------ -------------------3 Full 9.36M DISK 00:00:01 2016/08/17 16:47:34BP Key: 3 Status: AVAILABLE Compressed: NO Tag: TAG20160817T164718 Piece Name: /u01/prb/rmanbk/fulldb_PRB_04rdg8d5_1_1Control File Included: Ckp SCN: 972048 Ckp time: 2016/08/17 16:47:33数据文件备份如下:RMAN> list backup of database;List of Backup Sets===================BS Key Type LV Size Device Type Elapsed Time Completion Time------- ---- -- ---------- ----------- ------------ -------------------2 Full 1.08G DISK 00:00:15 2016/08/17 16:47:33BP Key: 2 Status: AVAILABLE Compressed: NO Tag: TAG20160817T164718 Piece Name: /u01/prb/rmanbk/fulldb_PRB_03rdg8cm_1_1List of Datafiles in backup set 2File LV Type Ckp SCN Ckp Time Name---- -- ---- ---------- ------------------- ----1 Full 972030 2016/08/17 16:47:18 /u01/app/oracle/oradata/prb/system01.dbf2 Full 972030 2016/08/17 16:47:18 /u01/app/oracle/oradata/prb/sysaux01.dbf3 Full 972030 2016/08/17 16:47:18 /u01/app/oracle/oradata/prb/undotbs01.dbf4 Full 972030 2016/08/17 16:47:18 /u01/app/oracle/oradata/prb/users01.dbf列出归档备份如下:RMAN> list backup of archivelog all;List of Backup Sets===================BS Key Size Device Type Elapsed Time Completion Time------- ---------- ----------- ------------ -------------------1 68.93M DISK 00:00:01 2016/08/17 16:47:17BP Key: 1 Status: AVAILABLE Compressed: NO Tag: TAG20160817T164716 Piece Name: /u01/prb/rmanbk/fulldb_PRB_02rdg8ck_1_1List of Archived Logs in backup set 1Thrd Seq Low SCN Low Time Next SCN Next Time---- ------- ---------- ------------------- ---------- ---------1 4 955212 2016/08/17 16:26:15 966337 2016/08/17 16:28:09 1 5 966337 2016/08/17 16:28:09 971912 2016/08/17 16:45:39 1 6 971912 2016/08/17 16:45:39 972019 2016/08/17 16:47:16 BS Key Size Device Type Elapsed Time Completion Time------- ---------- ----------- ------------ -------------------4 13.00K DISK 00:00:00 2016/08/17 16:47:35BP Key: 4 Status: AVAILABLE Compressed: NO Tag: TAG20160817T164735 Piece Name: /u01/prb/rmanbk/fulldb_PRB_05rdg8d7_1_1List of Archived Logs in backup set 4Thrd Seq Low SCN Low Time Next SCN Next Time---- ------- ---------- ------------------- ---------- ---------1 7 972019 2016/08/17 16:47:16 972053 2016/08/17 16:47:35 目标主机创建相应的目录mkdir -p /u01/app/oracle/admin/prb/{adump,dpdump,pfile,scripts}mkdir -p /u01/app/oracle/oradata/prbmkdir -p /u01/app/oracle/fast_recovery_area/prbmkdir -p /u01/prb/rmanbkmkdir -p /u01/archivelog3 将备份文件、密码文件copy到目标主机scp /u01/prb/rmanbk/* oracle@prd-db2:/u01/prb/rmanbk/scp /u01/app/oracle/product/11.2.0.4/db_1/dbs/orapwprb oracle@prd-db2:/u01/app/oracle/product/11.2.0.4/db_1/dbs/恢复参数文件及控制文件1 配置新主机上的ORACLE_SIDecho 'db_name=prb' > $ORACLE_HOME/dbs/initprb.oraexport ORACLE_SID=prbsqlplus / as sysdba@prbstartup nomount pfile='/u01/app/oracle/product/11.2.0.4/db_1/dbs/initprb.ora' 目标主机上发起rman连接prd-db2-> rman target /Recovery Manager: Release 11.2.0.4.0 - Production on Wed Aug 17 18:36:34 2016 Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved. connected to target database (not started)设置dbid 并启动实例到nomount状态RMAN> set dbid 3601019238executing command: SET DBIDRMAN> startup nomount;Oracle instance startedTotal System Global Area 217157632 bytesFixed Size 2251816 bytesVariable Size 159384536 bytesDatabase Buffers 50331648 bytesRedo Buffers 5189632 bytes恢复spfile文件RMAN> restore spfile to '/u01/app/oracle/product/11.2.0.4/db_1/dbs/spfileprb.ora' from '/u01/prb/rmanbk/fulldb_PRB_04rdg8d5_1_1';Starting restore at 2016/08/17 18:37:40allocated channel: ORA_DISK_1channel ORA_DISK_1: SID=19 device type=DISKchannel ORA_DISK_1: restoring spfile from AUTOBACKUP /u01/prb/rmanbk/fulldb_PRB_04rdg8d5_1_1channel ORA_DISK_1: SPFILE restore from AUTOBACKUP completeFinished restore at 2016/08/17 18:37:41startup force nomountRMAN> startup force nomount;Oracle instance startedTotal System Global Area 584568832 bytesFixed Size 2255432 bytesVariable Size 226493880 bytesDatabase Buffers 352321536 bytesRedo Buffers 3497984 bytes恢复控制文件RMAN> restore controlfile to '/u01/app/oracle/oradata/prb/control01.ctl' from '/u01/prb/rmanbk/fulldb_PRB_04rdg8d5_1_1';Starting restore at 2016/08/17 18:38:26allocated channel: ORA_DISK_1channel ORA_DISK_1: SID=19 device type=DISKchannel ORA_DISK_1: restoring control filechannel ORA_DISK_1: restore complete, elapsed time: 00:00:01Finished restore at 2016/08/17 18:38:27启动数据库到加载状态RMAN> alter database mount;RMAN-00571: ===========================================================RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============RMAN-00571: ===========================================================RMAN-03002: failure of alter db command at 08/17/2016 18:38:39ORA-00205: error in identifying control file, check alert log for more infoprd-db2-> export ORACLE_SID=prbprd-db2-> sqlplus / as sysdbaSQL*Plus: Release 11.2.0.4.0 Production on Wed Aug 17 18:42:04 2016Copyright (c) 1982, 2013, Oracle. All rights reserved.Connected to:Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production With the Partitioning, OLAP, Data Mining and Real Application Testing options SQL> shutdown immediate;ORA-01507: database not mountedORACLE instance shut down.SQL> startup mount;ORACLE instance started.Total System Global Area 584568832 bytesFixed Size 2255432 bytesVariable Size 226493880 bytesDatabase Buffers 352321536 bytesRedo Buffers 3497984 bytesORA-00205: error in identifying control file, check alert log for more info 解决办法:scp /u01/app/oracle/oradata/prb/control01.ctl prd-db2:/u01/app/oracle/oradata/prb/ scp /u01/app/oracle/fast_recovery_area/prb/ control02.ctlprd-db2:/u01/app/oracle/fast_recovery_area/prb/启动到mount状态正常SQL> startup mountORACLE instance started.Total System Global Area 584568832 bytesFixed Size 2255432 bytesVariable Size 226493880 bytesDatabase Buffers 352321536 bytesRedo Buffers 3497984 bytesDatabase mounted.三 在新控制文件中注册数据文件备份和归档备份prd-db2-> rman target /Recovery Manager: Release 11.2.0.4.0 - Production on Wed Aug 17 18:52:34 2016 Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved. connected to target database: PRB (DBID=1906641159, not open)RMAN> catalog start with '/u01/prb/rmanbk/';using target database control file instead of recovery catalogsearching for all files that match the pattern /u01/prb/rmanbk/no files found to be unknown to the database恢复整个库RMAN> restore database;Starting restore at 2016/08/17 18:53:42allocated channel: ORA_DISK_1channel ORA_DISK_1: SID=18 device type=DISKchannel ORA_DISK_1: starting datafile backup set restorechannel ORA_DISK_1: specifying datafile(s) to restore from backup setchannel ORA_DISK_1: restoring datafile 00001 to /u01/app/oracle/oradata/prb/system01.dbfchannel ORA_DISK_1: restoring datafile 00002 to /u01/app/oracle/oradata/prb/sysaux01.dbfchannel ORA_DISK_1: restoring datafile 00003 to /u01/app/oracle/oradata/prb/undotbs01.dbfchannel ORA_DISK_1: restoring datafile 00004 to /u01/app/oracle/oradata/prb/users01.dbfchannel ORA_DISK_1: reading from backup piece /u01/prb/rmanbk/fulldb_PRB_03rdg8cm_1_1channel ORA_DISK_1: piece handle=/u01/prb/rmanbk/fulldb_PRB_03rdg8cm_1_1 tag=TAG20160817T164718channel ORA_DISK_1: restored backup piece 1channel ORA_DISK_1: restore complete, elapsed time: 00:00:15Finished restore at 2016/08/17 18:53:57RMAN> recover database;Starting recover at 2016/08/17 18:54:12using channel ORA_DISK_1starting media recoverychannel ORA_DISK_1: starting archived log restore to default destination channel ORA_DISK_1: restoring archived logarchived log thread=1 sequence=7channel ORA_DISK_1: reading from backup piece /u01/prb/rmanbk/fulldb_PRB_05rdg8d7_1_1channel ORA_DISK_1: piece handle=/u01/prb/rmanbk/fulldb_PRB_05rdg8d7_1_1 tag=TAG20160817T164735channel ORA_DISK_1: restored backup piece 1channel ORA_DISK_1: restore complete, elapsed time: 00:00:01archived log file name=/u01/app/oracle/fast_recovery_area/PRB/archivelog/2016_08_17/o1_mf_1_7_cv8 jlo4y_.arc thread=1 sequence=7RMAN-00571: ===========================================================RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============RMAN-00571: ===========================================================RMAN-03002: failure of recover command at 08/17/2016 18:54:14ORA-00283: recovery session canceled due to errorsRMAN-11003: failure during parse/execution of SQL statement: alter database recover logfile'/u01/app/oracle/fast_recovery_area/PRB/archivelog/2016_08_17/o1_mf_1_7_cv8jlo4 y_.arc'ORA-00283: recovery session canceled due to errorsORA-00313: open failed for members of log group 2 of thread 1ORA-00312: online log 2 thread 1: '/u01/app/oracle/oradata/prb/redo02.log'ORA-27037: unable to obtain file statusLinux-x86_64 Error: 2: No such file or directoryAdditional information: 3缺失归档日志情况下的恢复prd-db2-> export ORACLE_SID=prbprd-db2-> sqlplus / as sysdbaSQL*Plus: Release 11.2.0.4.0 Production on Wed Aug 17 19:03:52 2016Copyright (c) 1982, 2013, Oracle. All rights reserved.Connected to:Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production With the Partitioning, OLAP, Data Mining and Real Application Testing optionsSQL> shutdown immediate;ORA-01109: database not openDatabase dismounted.ORACLE instance shut down.SQL> startup mount;ORACLE instance started.Total System Global Area 584568832 bytesFixed Size 2255432 bytesVariable Size 226493880 bytesDatabase Buffers 352321536 bytesRedo Buffers 3497984 bytesDatabase mounted.SQL> alter database open ;alter database open*ERROR at line 1:ORA-01589: must use RESETLOGS or NORESETLOGS option for database openSQL> alter database open noresetlogs;alter database open noresetlogs*ERROR at line 1:ORA-01588: must use RESETLOGS option for database openSQL> alter database open resetlogs;Database altered.SQL> select max(sequence#) from v$archived_log;MAX(SEQUENCE#)--------------7数据库正常启动prd-db2-> export ORACLE_SID=prbprd-db2-> sqlplus / as sysdbaSQL*Plus: Release 11.2.0.4.0 Production on Wed Aug 17 19:11:49 2016Copyright (c) 1982, 2013, Oracle. All rights reserved.Connected to:Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production With the Partitioning, OLAP, Data Mining and Real Application Testing options SQL> shutdown immediate;Database closed.Database dismounted.ORACLE instance shut down.SQL> startupORACLE instance started.Total System Global Area 584568832 bytesFixed Size 2255432 bytesVariable Size 226493880 bytesDatabase Buffers 352321536 bytesRedo Buffers 3497984 bytesDatabase mounted.Database opened.。