NBU 还原windows ORACLE数据库(BW)

将0.92数据库还原到1.92,还原时间7月13日

1.查询所需要的控制日志

bplist -C bw-prd01 -s 2017-7-2 -e 2017-7-15 -k oracle_bw-prd01_0_92_arch -t 4 -R -b -l  / |findstr "cnt"

(第2、3步可并行)

2.开始还原控制文件

进入rman,数据库起到nomount利用备份文件进行控制文件还原

rman target /
startup nomount
run{
 allocate channel ch00 type ‘SBT_TAPE‘;
 send ‘nb_ora_serv=nbumaster01‘;
 send ‘nb_ora_client= bw-prd01‘;
 restore controlfile from ‘cntrl_1705_1_949284511‘;
 release channel ch00;
}

3.还原数据文件(开到mount状态)

alter database mount;

run{
 allocate channel ch00 type ‘SBT_TAPE‘;
 allocate channel ch01 type ‘SBT_TAPE‘;
 send ‘nb_ora_serv=nbumaster01‘;
 send ‘nb_ora_client=bw-prd01‘;
set newname for datafile 1 to ‘E:\ERPORACLE\DATAFILE\SYSTEM.DATA1‘;
set newname for datafile 2 to ‘E:\ERPORACLE\DATAFILE\SYSAUX.DATA1‘;
set newname for datafile 3 to ‘E:\ERPORACLE\DATAFILE\UNDO.DATA1‘;
set newname for datafile 4 to ‘E:\ERPORACLE\DATAFILE\SR3.DATA1‘;
set newname for datafile 5 to ‘E:\ERPORACLE\DATAFILE\SR3.DATA2‘;
set newname for datafile 6 to ‘E:\ERPORACLE\DATAFILE\SR3740.DATA1‘;
set newname for datafile 7 to ‘E:\ERPORACLE\DATAFILE\SR3USR.DATA1‘;
set newname for datafile 8 to ‘E:\ERPORACLE\DATAFILE\SR740.DATA1‘;
set newname for datafile 9 to ‘E:\ERPORACLE\DATAFILE\SR3.DATA3‘;
set newname for datafile 10 to ‘E:\ERPORACLE\DATAFILE\SR3.DATA4‘;
set newname for datafile 11 to ‘E:\ERPORACLE\DATAFILE\SR3.DATA5‘;
set newname for datafile 12 to ‘E:\ERPORACLE\DATAFILE\SR3.DATA6‘;
set newname for datafile 13 to ‘E:\ERPORACLE\DATAFILE\SR3.DATA7‘;
set newname for datafile 14 to ‘E:\ERPORACLE\DATAFILE\SR3740.DATA2‘;
set newname for datafile 15 to ‘E:\ERPORACLE\DATAFILE\SR3740.DATA3‘;
set newname for datafile 16 to ‘E:\ERPORACLE\DATAFILE\SR3740.DATA4‘;
set newname for datafile 17 to ‘E:\ERPORACLE\DATAFILE\SR3740.DATA5‘;
set newname for datafile 18 to ‘E:\ERPORACLE\DATAFILE\SR3740.DATA6‘;
set newname for datafile 19 to ‘E:\ERPORACLE\DATAFILE\SR3.DATA8‘;
set newname for datafile 20 to ‘E:\ERPORACLE\DATAFILE\SR3.DATA9‘;
set newname for datafile 21 to ‘E:\ERPORACLE\DATAFILE\SR3.DATA10‘;
set newname for datafile 22 to ‘E:\ERPORACLE\DATAFILE\SR3.DATA11‘;
set newname for datafile 23 to ‘E:\ERPORACLE\DATAFILE\SR3.DATA12‘;
set newname for datafile 24 to ‘E:\ERPORACLE\DATAFILE\SR3.DATA13‘;
set newname for datafile 25 to ‘E:\ERPORACLE\DATAFILE\SR3.DATA14‘;
set newname for datafile 26 to ‘E:\ERPORACLE\DATAFILE\SR3.DATA15‘;
set newname for datafile 27 to ‘E:\ERPORACLE\DATAFILE\SR3.DATA16‘;
set newname for datafile 28 to ‘E:\ERPORACLE\DATAFILE\SR3.DATA17‘;
set newname for datafile 29 to ‘E:\ERPORACLE\DATAFILE\SR3.DATA18‘;
set newname for datafile 30 to ‘E:\ERPORACLE\DATAFILE\SR3.DATA19‘;
set newname for datafile 31 to ‘E:\ERPORACLE\DATAFILE\SR3.DATA20‘;
set newname for datafile 32 to ‘E:\ERPORACLE\DATAFILE\SR3.DATA21‘;
set newname for datafile 33 to ‘E:\ERPORACLE\DATAFILE\SR3.DATA22‘;
set newname for datafile 34 to ‘E:\ERPORACLE\DATAFILE\SR3.DATA23‘;
set newname for datafile 35 to ‘E:\ERPORACLE\DATAFILE\SR3.DATA24‘;
set newname for datafile 36 to ‘E:\ERPORACLE\DATAFILE\SR3.DATA25‘;
set newname for datafile 37 to ‘E:\ERPORACLE\DATAFILE\SR3.DATA26‘;
set newname for datafile 38 to ‘E:\ERPORACLE\DATAFILE\SR3.DATA27‘;
set newname for datafile 39 to ‘E:\ERPORACLE\DATAFILE\SR3.DATA28‘;
set newname for datafile 40 to ‘E:\ERPORACLE\DATAFILE\SR3.DATA29‘;
set newname for datafile 41 to ‘E:\ERPORACLE\DATAFILE\SR3.DATA30‘;
set newname for tempfile 1 to ‘E:\ERPORACLE\DATAFILE\TEMP.DATA1‘;
set newname for tempfile 2 to ‘E:\ERPORACLE\DATAFILE\TEMP.DATA2‘;
 restore  database
 until time "to_date(‘2017/07/13‘,‘yyyy/mm/dd‘)";
SWITCH DATAFILE ALL;
SWITCH TEMPFILE ALL;
 release channel ch00;
 release channel ch01;
}

可直接运行第5步看缺少哪些归档日志

4.查询SEQUENCE号,还原归档日志

sqlplus / as sysdba

alter session set nls_date_format=‘YYYYMMDD HH24:MI:SS‘;
set linesize 160;
set pagesize;

select THREAD#,SEQUENCE#,FIRST_TIME,COMPLETION_TIME from v$archived_log
where --SEQUENCE# IN(63145);
COMPLETION_TIME>to_date(‘20170713 09:00:00‘,‘yyyymmdd hh24:mi:ss‘)
and    COMPLETION_TIME<to_date(‘20170713 11:00:00‘,‘yyyymmdd hh24:mi:ss‘)
order by SEQUENCE#;
--还原归档日志
rman target /
run{
allocate channel ch0 type ‘SBT_TAPE‘;
allocate channel ch1 type ‘SBT_TAPE‘;
send ‘NB_ORA_CLIENT=bw-prd01‘;
send ‘nb_ora_serv=nbumaster01‘;
restore archivelog  sequence between 63430 and 65699;
release channel ch0;
release channel ch1;
}

5.恢复数据库

run{
allocate channel ch0 type ‘SBT_TAPE‘;
allocate channel ch1 type ‘SBT_TAPE‘;
send ‘NB_ORA_CLIENT=bw-prd01‘;
send ‘nb_ora_serv=nbumaster01‘;
recover database;
release channel ch0;
release channel ch1;
}

sqlplus / as sysdba
alter database open resetlogs;

OR

sqlplus / as sysdba
alter session set nls_date_format=‘YYYY/MM/DD HH24:MI:SS‘;
recover database until time ‘2017/07/13 10:00:00‘ using backup controlfile;
alter database open resetlogs;

时间: 2024-10-03 02:04:17

NBU 还原windows ORACLE数据库(BW)的相关文章

备份还原oracle数据库

Winserver 和 linxu 下的备份还原命令是相同的 基本格式: imp和exp不适合大文件备份,如果文件超过20个G,这种方式效率会很低,如果文件过大,可以采用Rman方式进行备份还原 exp bim_dev/[email protected] file=c:\bim_dev.dmp owner=bim_dev imp bim_dev/[email protected] file=c:\bim_dev.dmp full=y ignore=y l 错误信息处理:如果是本地链接导入库,不需

虚拟Linux系统使用Windows系统oracle数据库

前提:本地oracle数据库能正常使用. 数据库:oracle 11g 虚拟机:VMware_workstation_full_12.5.2 本机系统:Windows 7 旗舰版 虚拟机系统:openSUSE LINUX 网络适配器 VMware Network Adapter VMnet8  的ip地址和虚拟机系统的ip地址在同一网段就可以相互ping通 VMnet8 ip:192.168.14.1 虚拟机ip:192.168.14.131 Windows ip:192.168.1.111 在

[解决办法]windows的非administrator账户无法通过plsql工具登录oracle数据库

环境:windows2008服务器.使用的非administrator账户,而是新建了一个windows2008账户.安装好了plsql工具. 问题:使用administrator账户可以用plsql工具连接成功oracle数据库:但是使用非administrator账户用plsql工具连接oracle数据库失败,如下图: 原因:经过反复排查,是因为plsql工具没有获取系统的权限,而且加入了administrators组也是无效,主要原因是windows在vista系统之后新增了一个UAC(用

windows下oracle数据库自动备份脚本

1.根据日期自动生成 Oracle 备份文件 @echo off echo 正在备份Oracle数据库,请稍等...... exp userid='用户名/密码@SID' file=D:\bak\res_%date:~0,4%%date:~5,2%%date:~8,2%.dmp log=D:\bak\res_%date:~0,4%%date:~5,2%%date:~8,2%.log owner=res echo 任务完成! 2.根据日期时间分秒自动生成 Oracle 备份文件 @echo off

AppAssure备份Windows平台Oracle数据库

环境: AppAssure Core : 5.4.3.106 Oracle:  11g Enterprise Edition Release 11.2.0.1.0 -64bit OS: Windows Server 2012 R2 (Core Server and OracleDB) 备份恢复步骤如下: 1. 检查数据库模式, 查看数据库是否处于归档模式中 sqlplus / as sysdba SQL > archive log list 2. 若为非归档,则修改数据库归档模式 SQL > 

PHP7在windows上配置远程连接Oracle数据库的方法

由于项目需求,需要去其他项目组的oracle数据库上面去定时的获取一些数据,在本地配置了一下连接都oracle的方法,踩过windows上配置的一个又一个的坑,终于完成了配置,在此分享一下,希望能够帮助到有需要的的人. 1.首先验证一下他们给的只读账号是否能够连接成功,需要在本地安装连接工具(PLSQL Developer) 2.配置PLSQL Developer连接需要下载oracle即时客户端(instantclient_11_2)工具,建立一个tnsnames.ora文件里面保存连接数据库

windows计划任务+批处理文件实现oracle数据库的定时备份

1.创建批处理文件 @echo off REM ########################################################### REM # Windows Server 2008下Oracle数据库自动备份批处理脚本 REM ########################################################### set CURDATE=%date:~0,4%%date:~5,2%%date:~8,2% set hour=%t

Windows环境下Oracle数据库的自动备份脚本

批处理文件(.bat) @echo off echo ================================================ echo  Windows环境下Oracle数据库的自动备份脚本 echo  1. 使用当前日期命名备份文件. echo  2. 自动删除7天前的备份. echo ================================================ ::以“YYYYMMDD”格式取出当前时间. set BACKUPDATE=%date

ORACLE数据库的备份和还原。

Oracle数据库备份与还原命令 数据导出: 1 将数据库TEST完全导出,用户名system 密码manager 导出到D:\daochu.dmp中 exp system/[email protected] file=d:\daochu.dmp full=y 2 将数据库中system用户与sys用户的表导出 exp system/[email protected] file=d:\daochu.dmp owner=(system,sys) 3 将数据库中的表table1 .table2导出