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 还原controlfilemount数据库

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数据库恢复演练报告(下)的更多相关文章

  1. Netbackup-Oracle数据库恢复演练(上)

    目录 第一章NBU实施内容 1 第二章 环境准备 1 2.1添加LICENSE: 1 2.2安装配置NBU客户端(linux,unix相同) 2 2.3配置并验证oracle备份脚本 3 2.4添加备 ...

  2. oracle数据库恢复与备份

    一.oracle数据库恢复 1.恢复刚才删除的一条数据 delete from emp e where e.empname='SMITH' select * from flashback_transa ...

  3. 重装系统后ORACLE数据库恢复的方法

    如果我们的操作系统出现问题,重装系统后,ORACLE数据库应该如何恢复呢?下文就为您列举了两个重装系统后ORACLE数据库恢复的方法,供您参考. ORACLE数据库恢复的方法我们经常会用到,下面就为您 ...

  4. DBF 文件 ORACLE 数据库恢复

    DBF 文件 ORACLE 数据库恢复 清·魏源<庸易通义>:"至道问学之有知无行,分温故为存心,知新为致知,而敦厚为存心,崇礼为致知,此皆百密一疏." 起因 在我们的 ...

  5. 数栈运维实例:Oracle数据库运维场景下,智能运维如何落地生根?

    从马车到汽车是为了提升运输效率,而随着时代的发展,如今我们又希望用自动驾驶把驾驶员从开车这项体力劳动中解放出来,增加运行效率,同时也可减少交通事故发生率,这也是企业对于智能运维的诉求. 从人工运维到自 ...

  6. Raid信息丢失数据恢复及oracle数据库恢复验证方案

    早些时候,有个客户14块盘的磁盘阵列出现故障,需要恢复的数据是oracle数据库,客户在寻求数据恢复技术支持,要求我提供详细的数据恢复方案,以下是提供给客户的详细数据恢复解决方案,本方案包含Raid数 ...

  7. Oracle数据库访问其他用户下的表,不加表所属的用户名的实现方法

    一. 问题: 如何实现在Oracle数据库中访问其他用户的表时不需加表所属的用户名 二. 举例: Oracle里面的用户A,要访问用户B的表需要带用户B的前缀,如访问用户B的 TEST表,需要这样访问 ...

  8. 把oracle数据库恢复到某个时间点或者某个scn

    alter session set nls_date_format='yyyymmdd hh24:mi:ss'; select sysdate from dual; conn dbauser/1234 ...

  9. 如何将备份的oracle数据库还原到指定用户下。

    上一文章 oracle11g数据库--创建表空间,创建用户,用户授权并指定表空间.我们已经建好了指定的新用户pdmis. 接下来我们需要将备份好的数据库,还原至新用户pdmis下. 想要还原,我们需要 ...

随机推荐

  1. Electron、Node.js、JavaScript、JQuery、Vue.js、Angular.js,layui,bootstrap

    转载:https://blog.csdn.net/meplusplus/article/details/79033786 layui :是基于jquery库的封装开发. bootstrap:同样基于 ...

  2. 图像数据转换成db(leveldb/lmdb)文件(转)

    参考网站:http://www.cnblogs.com/denny402/p/5082341.html 在深度学习的实际应用中,我们经常用到的原始数据是图片文件,如jpg,jpeg,png,tif等格 ...

  3. ettercap局域网DNS欺骗实现过程

    转载:https://www.cnblogs.com/hkleak/p/5043063.html 笔记一:ettercap是什么? 我们在对WEB安全检测的时候都会用到Cain和netfuke这两款工 ...

  4. css3 移动端页面全屏旋转,横屏显示。

    css3旋转模拟手机横屏. 当手机不能自动旋转时,或有特殊需求.用css3 transform,实现横屏展示. 注意: 相关样式注意横屏的显示. touch的手势方向没有变,依旧是原来方向,若有相关插 ...

  5. OS---存储器

    1.存储器的层次结构 1.1 概述 理想情况下,存储器应当速度非常快.并且与处理器的速度匹配.容量大且价格低廉: 实际情况,无法满足上述三个条件: 于是在现在OS中,存储器采用  层次结构  来组织: ...

  6. Mybatis学习笔记10 - 动态sql之if判断

    示例代码: 接口定义: package com.mybatis.dao; import com.mybatis.bean.Employee; import java.util.List; public ...

  7. IA-32e架构下的内核初始化内存管理

    初级内存管理单元 关于内存的分页 以往的物理页是按照4KB进行分配和管理的, 而在Linux之后流行的就是2MB大小的物理页的分配和管理, 整个物理内存管理单元也是2MB物理页管理的 先获取基本的物理 ...

  8. SpringMVC 的初始化参数绑定

    初始化参数绑定:日期格式 一:首先我们先做一种日期格式的绑定,配置初始化参数绑定和自定义类型转换有着异曲同工之妙 配置步骤如下: 1.我们首先配置applicationContext.xml,进行扫描 ...

  9. MS .NET企业级应用架构设计笔记1(关于业务层)

    本文针对<MS .NET企业级应用架构设计>业务层前半部分做了相关笔记并记录了自己的一点想法.对于后半部分的具体模式将在第二次笔记中体现.   关于Layer与Tier Layer一般用来 ...

  10. vue的计算和监视属性,附一小实例

    1. 计算属性 在computed属性对象中定义计算属性的方法 在页面中使用{{方法名}}来显示计算的结果 2. 监视属性: 通过通过vm对象的$watch()或watch配置来监视指定的属性 当属性 ...