6.Netbackup-Oracle数据库恢复演练报告(下)
1.1 Oracle数据库恢复
目录
1 安装新的客户端
2 新建异机恢复文件
3 新建数据库实例
4 建立spfile文件
5 建立数据文件夹
6 启动数据库到nomount状态
7 列出备份信息
8 还原controlfile,并mount数据库
9 查找数据文件信息
10 数据文件恢复
11 归档日志恢复
12 联机日志路径修改
13 Recover并打开数据库
14 验证数据库
1.1.1 安装新的客户端
在备份服务器上添加hosts信息
10.110.10.74 backup-test
在客户端添加hosts信息
10.12.69.111 nbu-b
安装客户端
1.1.2 新建异机恢复文件
在备份服务器上建立支持异机恢复要求的文件。
备份服务器建立No.Restrictions空文件
UNIX platform: /usr/openv/netbackup/db/altnames/No.Restrictions
1.1.3 新建数据库实例
对于需要恢复的机器,需要新建立一个数据库实例进行数据恢复。
本次恢复针到的实例为test
1.1.4 建立spfile文件
原spfile导出文件为:
|
[root@backup-test testtest]# cat inittest1.ora.old test2.__db_cache_size=7918845952 test1.__db_cache_size=6643777536 test2.__java_pool_size=134217728 test1.__java_pool_size=134217728 test2.__large_pool_size=167772160 test1.__large_pool_size=167772160 test1.__oracle_base='/oracle/'#ORACLE_BASE set from environment test2.__oracle_base='/oracle/'#ORACLE_BASE set from environment test2.__pga_aggregate_target=6442450944 test1.__pga_aggregate_target=5637144576 test2.__sga_target=9663676416 test1.__sga_target=10468982784 test2.__shared_io_pool_size=0 test1.__shared_io_pool_size=0 test2.__shared_pool_size=1342177280 test1.__shared_pool_size=3422552064 test2.__streams_pool_size=0 test1.__streams_pool_size=0 *.audit_file_dest='/oracle/admin/test/adump' *.audit_trail='db' *.cluster_database=true *.compatible='11.2.0.4.0' *.control_files='+DATA_DG/test/controlfile/current.256.834077963','+DATA_DG/test/controlfile/current.275.834330051','+FLASH_DG/test/controlfile/current.278.834330403' *.db_block_size=8192 *.db_create_file_dest='+DATA_DG' *.db_domain='' *.db_name='test' *.diagnostic_dest='/oracle' *.dispatchers='(PROTOCOL=TCP) (SERVICE=testXDB)' test1.instance_number=1 test2.instance_number=2 *.lock_sga=FALSE *.log_archive_dest_1='LOCATION=+FLASH_DG' *.log_archive_format='%t_%s_%r.dbf' *.memory_max_target=16106127360 *.memory_target=16106127360 *.open_cursors=500 *.processes=1000 *.remote_listener='test-scan:1521' *.remote_login_passwordfile='exclusive' *.session_cached_cursors=100 *.sessions=1105 test2.thread=2 test1.thread=1 *.undo_retention=7200 test1.undo_tablespace='UNDOTBS1' test2.undo_tablespace='UNDOTBS2' |
由于需要恢复到单机,删除RAC相关信息。 另外由于硬件资源的不同,删除需要恢复的资源配置。
新的配置文件为
|
[root@backup-test testtest]# cat inittest1.ora *.__oracle_base='/oradata/testtest/'#ORACLE_BASE set from environment *.__pga_aggregate_target=5637144576 *.__sga_target=10468982784 *.audit_file_dest='/oradata/testtest/adump' *.audit_trail='db' *.compatible='11.2.0.4.0' *.control_files='/oradata/testtest/controlfile/current.256.834077963' *.db_block_size=8192 *.db_create_file_dest='/oradata/testtest/' *.db_domain='' *.db_name='test' *.diagnostic_dest='/oradata/testtest/' *.dispatchers='(PROTOCOL=TCP) (SERVICE=testXDB)' *.lock_sga=FALSE *.log_archive_dest_1='LOCATION=/oradata/testtest/archive/' *.log_archive_format='%t_%s_%r.dbf' *.open_cursors=500 *.processes=1000 *.remote_login_passwordfile='exclusive' *.session_cached_cursors=100 *.sessions=1105 *.undo_retention=7200 *.undo_tablespace='UNDOTBS1' |
1.1.5 建立数据文件夹
根据spfile建立相关文件
|
[root@backup-test testtest]# ll -a total 52 drwxrwxrwx 7 oracle oinstall 4096 Sep 25 16:26 . drwxrwxr-x 29 oracle oinstall 12288 Sep 28 10:03 .. drwxr-xr-x 2 oracle oinstall 4096 Sep 28 10:37 adump drwxr-xr-x 2 oracle oinstall 4096 Sep 25 16:02 archive drwxr-xr-x 2 oracle oinstall 4096 Sep 28 10:10 controlfile drwxrwxr-x 3 oracle oinstall 4096 Sep 25 16:20 diag -rwxrwxrwx 1 oracle oinstall 760 Sep 25 16:26 inittest1.ora -rwxr-xr-x 1 oracle oinstall 1578 Sep 25 15:45 inittest1.ora.old drwxrwxrwx 2 oracle oinstall 4096 Sep 25 12:04 testtest -rwxrwxrwx 1 oracle oinstall 6520 Sep 25 14:44 utlpwdmg.sql |
1.1.6 启动数据库到nomount状态
|
sqlplus /nolog idle> conn / as sysdba idle> startup nomount pfile='/oradata/testtest/inittest1.ora' idle> startup nomount pfile='/oradata/testtest/inittest1.ora' ORACLE instance started. Total System Global Area 396726272 bytes Fixed Size 2253504 bytes Variable Size 318770496 bytes Database Buffers 67108864 bytes Redo Buffers 8593408 bytes |
1.1.7 列出备份信息
在备份服务器上列出相关备份信息
|
bplist -C test-db01 -s 09/27/2015 -t 4 -R -b -l / 。。。。。。。 |
1.1.8 还原controlfile,并mount数据库
RMAN还原
|
RMAN> RMAN>connect target / RMAN> run{ 2> allocate channel ch0 type 'sbt_tape'; 3> send 'NB_ORA_CLIENT=test-db01'; 4> send 'nb_ora_serv=nbu-b'; 5> restore controlfile from '/cntrl_3175_1_891580028'; 6> release channel ch0; 7> } using target database control file instead of recovery catalog allocated channel: ch0 channel ch0: SID=578 device type=SBT_TAPE channel ch0: Veritas NetBackup for Oracle - Release 7.6 (2014102721) sent command to channel: ch0 sent command to channel: ch0 Starting restore at 2015-09-28 10:10:36 channel ch0: restoring control file channel ch0: restore complete, elapsed time: 00:00:15 output file name=/oradata/testtest/controlfile/current.256.834077963 Finished restore at 2015-09-28 10:10:52 released channel: ch0 RMAN> alter database mount; database mounted |
1.1.9 查找数据文件信息
|
sqlplus /nolog idle> conn / as sysdba idle> select name from v$datafile; NAME ---------------------------------------------------------------------------------------------------- +DATA_DG/test/datafile/system.259.834077963 +DATA_DG/test/datafile/sysaux.260.834077967 +DATA_DG/test/datafile/undotbs1.261.834077971 +DATA_DG/test/datafile/undotbs2.263.834077979 +DATA_DG/test/datafile/users.264.834077981 +DATA_DG/test/datafile/zhos_dataspace.268.889894605 +DATA_DG/test/datafile/zhos_dataspace.272.834956161 +DATA_DG/test/datafile/zhos_dataspace.271.834956199 +DATA_DG/test/datafile/spcred_dataspace.269.834956241 +DATA_DG/test/datafile/zhos_indexspace.273.834317857 +DATA_DG/test/datafile/audit_dataspace.280.846839715 11 rows selected. idle> select member from v$logfile; MEMBER ---------------------------------------------------------------------------------------------------- +DATA_DG/test/onlinelog/group_1.257.834077963 +DATA_DG/test/onlinelog/group_2.258.834077963 +DATA_DG/test/onlinelog/group_3.265.834080437 +DATA_DG/test/onlinelog/group_4.266.834080437 +DATA_DG/test/onlinelog/group_5.276.834332677 +DATA_DG/test/onlinelog/group_6.277.834332723 +DATA_DG/test/onlinelog/group_7.278.834332751 +DATA_DG/test/onlinelog/group_8.279.834332783 8 rows selected. |
1.1.10 数据文件恢复
编辑还原脚本如下:
|
export ORACLE_SID=test rman <<EOF connect target / run { allocate channel ch0 type 'SBT_TAPE'; allocate channel ch1 type 'SBT_TAPE'; send 'nb_ora_serv=nbu-b'; send 'nb_ora_client=test-db01'; set newname for datafile '+DATA_DG/test/datafile/system.259.834077963' to '/oradata/testtest/system.259.834077963'; set newname for datafile '+DATA_DG/test/datafile/sysaux.260.834077967' to '/oradata/testtest/sysaux.260.834077967'; set newname for datafile '+DATA_DG/test/datafile/undotbs1.261.834077971' to '/oradata/testtest/undotbs1.261.834077971'; set newname for datafile '+DATA_DG/test/datafile/undotbs2.263.834077979' to '/oradata/testtest/undotbs2.263.834077979'; set newname for datafile '+DATA_DG/test/datafile/users.264.834077981' to '/oradata/testtest/users.264.834077981'; set newname for datafile '+DATA_DG/test/datafile/zhos_dataspace.268.889894605' to '/oradata/testtest/zhos_dataspace.268.889894605'; set newname for datafile '+DATA_DG/test/datafile/zhos_dataspace.272.834956161' to '/oradata/testtest/zhos_dataspace.272.834956161'; set newname for datafile '+DATA_DG/test/datafile/zhos_dataspace.271.834956199' to '/oradata/testtest/zhos_dataspace.271.834956199'; set newname for datafile '+DATA_DG/test/datafile/spcred_dataspace.269.834956241' to '/oradata/testtest/spcred_dataspace.269.834956241'; set newname for datafile '+DATA_DG/test/datafile/zhos_indexspace.273.834317857' to '/oradata/testtest/zhos_indexspace.273.834317857'; set newname for datafile '+DATA_DG/test/datafile/audit_dataspace.280.846839715' to '/oradata/testtest/audit_dataspace.280.846839715'; restore database; switch datafile all; release channel ch0; release channel ch1; } exit EOF |
运行数据还原
恢复完成
1.1.11 归档日志恢复
|
idle> select THREAD#,SEQUENCE#,FIRST_TIME,COMPLETION_TIME from v$archived_log where COMPLETION_TIME>to_date('20150927 20:00:00','yyyymmdd hh24:mi:ss') and COMPLETION_TIME<to_date('20150928 6:00:00','yyyymmdd hh24:mi:ss') order by SEQUENCE#; THREAD# SEQUENCE# FIRST_TIME COMPLETION_TIME ---------- ---------- ------------------- ------------------- 1 27587 2015-09-27 19:59:31 2015-09-27 21:01:28 ...... 39 rows selected. |
RMAN还原归档日志
节点1还原
|
RMAN> connect target / connected to target database: test (DBID=825185095, not open) RMAN> run{ set archivelog destination to '/oradata/testtest/archive'; 2> 3> allocate channel ch0 type 'SBT_TAPE'; send 'NB_ORA_CLIENT=test-db01'; send 'nb_ora_serv=nbu-b'; restore archivelog sequence between 27587 and 27597 thread 1; 4> 5> 6> 7> release channel ch0; 8> } executing command: SET ARCHIVELOG DESTINATION ...... released channel: ch0 |
节点2还原
|
RMAN> run{ set archivelog destination to '/oradata/testtest/archive'; 2> 3> allocate channel ch0 type 'SBT_TAPE'; 4> send 'NB_ORA_CLIENT=test-db01'; 5> send 'nb_ora_serv=nbu-b'; 6> restore archivelog sequence between 45287 and 45314 thread 2; 7> release channel ch0; 8> } executing command: SET ARCHIVELOG DESTINATION allocated channel: ch0 channel ch0: SID=673 device type=SBT_TAPE channel ch0: Veritas NetBackup for Oracle - Release 7.6 (2014102721) sent command to channel: ch0 sent command to channel: ch0 Starting restore at 2015-09-28 14:14:04 channel ch0: starting archived log restore to user-specified destination ...... released channel: ch0 |
1.1.12 联机日志路径修改
Sqlplus 修改
|
idle> alter database rename file '+DATA_DG/test/onlinelog/group_1.257.834077963' to'/oradata/testtest/group_1.257.834077963'; ...... |
1.1.13 Recover并打开数据库
Sqlplus启动数据库
|
idle> recover database until cancel using backup controlfile; ORA-00279: change 10315737932005 generated at 09/27/2015 22:03:45 needed for thread 1 ORA-00289: suggestion : /oradata/testtest/archive/1_27589_834077959.dbf ORA-00280: change 10315737932005 for thread 1 is in sequence #27589 Specify log: {<RET>=suggested | filename | AUTO | CANCEL} AUTO ORA-00308: cannot open archived log '/oradata/testtest/archive/1_27589_834077959.dbf' ORA-27037: unable to obtain file status Linux-x86_64 Error: 2: No such file or directory Additional information: 3 .............. ORA-00308: cannot open archived log '/oradata/testtest/archive/2_45315_834077959.dbf' ORA-27037: unable to obtain file status Linux-x86_64 Error: 2: No such file or directory Additional information: 3 idle> idle> alter database open resetlogs; Database altered. |
1.1.14 验证数据库
|
idle> select open_mode from v$database; OPEN_MODE ---------------------------------------- READ WRITE |
6.Netbackup-Oracle数据库恢复演练报告(下)的更多相关文章
- Netbackup-Oracle数据库恢复演练(上)
目录 第一章NBU实施内容 1 第二章 环境准备 1 2.1添加LICENSE: 1 2.2安装配置NBU客户端(linux,unix相同) 2 2.3配置并验证oracle备份脚本 3 2.4添加备 ...
- oracle数据库恢复与备份
一.oracle数据库恢复 1.恢复刚才删除的一条数据 delete from emp e where e.empname='SMITH' select * from flashback_transa ...
- 重装系统后ORACLE数据库恢复的方法
如果我们的操作系统出现问题,重装系统后,ORACLE数据库应该如何恢复呢?下文就为您列举了两个重装系统后ORACLE数据库恢复的方法,供您参考. ORACLE数据库恢复的方法我们经常会用到,下面就为您 ...
- DBF 文件 ORACLE 数据库恢复
DBF 文件 ORACLE 数据库恢复 清·魏源<庸易通义>:"至道问学之有知无行,分温故为存心,知新为致知,而敦厚为存心,崇礼为致知,此皆百密一疏." 起因 在我们的 ...
- 数栈运维实例:Oracle数据库运维场景下,智能运维如何落地生根?
从马车到汽车是为了提升运输效率,而随着时代的发展,如今我们又希望用自动驾驶把驾驶员从开车这项体力劳动中解放出来,增加运行效率,同时也可减少交通事故发生率,这也是企业对于智能运维的诉求. 从人工运维到自 ...
- Raid信息丢失数据恢复及oracle数据库恢复验证方案
早些时候,有个客户14块盘的磁盘阵列出现故障,需要恢复的数据是oracle数据库,客户在寻求数据恢复技术支持,要求我提供详细的数据恢复方案,以下是提供给客户的详细数据恢复解决方案,本方案包含Raid数 ...
- Oracle数据库访问其他用户下的表,不加表所属的用户名的实现方法
一. 问题: 如何实现在Oracle数据库中访问其他用户的表时不需加表所属的用户名 二. 举例: Oracle里面的用户A,要访问用户B的表需要带用户B的前缀,如访问用户B的 TEST表,需要这样访问 ...
- 把oracle数据库恢复到某个时间点或者某个scn
alter session set nls_date_format='yyyymmdd hh24:mi:ss'; select sysdate from dual; conn dbauser/1234 ...
- 如何将备份的oracle数据库还原到指定用户下。
上一文章 oracle11g数据库--创建表空间,创建用户,用户授权并指定表空间.我们已经建好了指定的新用户pdmis. 接下来我们需要将备份好的数据库,还原至新用户pdmis下. 想要还原,我们需要 ...
随机推荐
- git命令行操作:拉不到最新代码???
现场场景: 仓库中有一个包名使用了驼峰命名,还有一个非驼峰的同名包, windows系统下因为不区分文件夹大小写,拉取没问题,但是本地push不上去.打算到Linux上clone下来后,删除那个驼 ...
- Python中的sin和cos函数
1 第一次使用math.sin()和math.cos(),可是发现结果不对,比如Math.sin(90)=0.893996663600,奇怪? 2 3 一查,原来sin(x) \n\n Ret ...
- ArrayList中进行删除操作引发的问题
1.普通for遍历 for(int i=0;i<list.size();i++){ if(list.get(i).equals("a")) list.remove(i); } ...
- Android Studio 2.2以上支持了Cmake的配置JNI的相关参数
Android Studio 2.2以上支持了Cmake的配置JNI的相关参数,简化了通过Android.mk配置.并很好的继承了C++的编辑方式.以下是对应的引入第三方so和第三方.cpp文件的路径 ...
- python 编程,应该养成哪些好的习惯
python 编程,应该养成哪些好的习惯? https://www.zhihu.com/question/28966220 无缓冲输出 python -u sys.stdout.flush() 性能 ...
- checkbox多选、全选js效果
//全选checkbox function allCheck() { //全选input var all = $("input[name='all']"); //全部的input ...
- Kudu Tablet design
不多说,直接上干货! http://blog.csdn.net/lookqlp/article/details/51416829
- php函数内不能访问函数外的变量原因
执行如下代码: $i = 10; function my(){ echo $i; } my(); xdebug显示是:Undefined variable 以前也知道有这个问题存在,即函数内部不可以访 ...
- Cannot convert value '0000-00-00 00:00:00' from column 1 to TIMESTAMP解决办法
在Mysql数据库中使用DATETIME类型来存储时间,使用JDBC中读取这个字段的时候,应该使用 ResultSet.getTimestamp(),这样会得到一个java.sql.Timestamp ...
- 如何使用rem单位
最近搞移动端,真是被rem.em与px的换算要了老命了,看了不少文档,似乎弄明白了,这不今天用又蒙圈了. 好多文档上老是说用rem就给html设置font-size,用em就给body设置font-s ...