NBU异机恢复Oracle操作步骤
NBU 异机恢复Oracle操作步骤
Hehuyi_In 于 2020-05-15 22:36:22 发布 1507 收藏 5
分类专栏: Oracle 备份还原
版权
Oracle
同时被 2 个专栏收录
206 篇⽂章4 订阅
订阅专栏
备份还原
31 篇⽂章0 订阅
订阅专栏
⼀、准备⼯作
1. DBA
恢复服务器安装与原库相同版本的数据库软件、NBU客户端
双向开通到NBU备份服务器的1556、13724、13720、13782、13790端⼝的防⽕墙策略(应该只要1556和13724,但为避免还原时出现其他异常,建议都开)
/etc/hosts⽂件添加NBU备份服务器主机名及原库主机名,ping 主机名测试能否解析成功
确保恢复服务器磁盘空间⾜够
2. NBU管理员
/etc/hosts⽂件添加待恢复服务器主机名,ping 主机名测试能否解析成功,若不成功可使⽤bpclntcmd -clear_host_cache清除nbu端dns缓存
配置恢复授权,确保备份机器和还原机器都在列表中,且允许还原
Host Properties->Mater server->Client Attributes
若是异机恢复,需在NBU给备份机器和恢复机器增加异机恢复的权限
cd /usr/openv/netbackup/db/altnames
touch 主机名
检查异机恢复参数
NBUInstallPath/NetBackup/bin/admincmd/bpgetconfig | grep "DISALLOW_CLIENT"
#输出
DISALLOW_CLIENT_LIST_RESTORE = NO
DISALLOW_CLIENT_RESTORE = NO
#若如上两个参数为YES,则表⽰禁⽌进⾏异机恢复,需要将两个参数改成NO,为保证参数⽣效,建议修改后重启主服务器上的NBU服务
NBUInstallPath/NetBackup/bin/bp.kill_all
NBUInstallPath/NetBackup/bin/bp.start_all
⼆、数据恢复
以下均在待恢复服务器操作
1. 检查备份⽂件情况
/usr/openv/netbackup/bin/bplist -C iZwz94g9fehswlnzd19jv2Z -t 4 -b -l -R /
# -C后跟备份库主机名;-t后跟还原类型,4是oracle标志;-b指列出备份⽂件的⽇期和时间;-l指列出备份⽂件的详细信息;-R以递归的⽅式显⽰⼦⽬录。
c-和cntrl开头的是控制⽂件⾃动备份,包含参数⽂件和控制⽂件
al开头的是归档⽇志备份
bk开头的是数据库备份
2. Oracle⽤户执⾏oracle_link
Linux/Unix需要在netbackup/bin路径下执⾏oracle_link,以便rman调⽤nbu接⼝进⾏读取数据备份信息
/usr/openv/netbackup/bin/oracle_link
3. ⼿⼯创建参数⽂件
测试使⽤控制⽂件备份中恢复的spfile可能遇到在restore数据库时⽆法到正确的备份⽂件路径等难以排查的问题,NBU供应商建议⼿⼯创建参数⽂件,优先恢复数据⽂件,待数据可读后如果有必要再恢复原来的参数⽂件(⼀般没有必要,只要恢复出业务需要的数据即可)。
检查参数⽂件中的各路径位置,确保⽬录已存在,或修改参数⽂件指定新路径。
cd $ORACLE_HOME/dbs
a
#内容如下
*.audit_file_dest='/data/prd/oracle/database/admin/ORCL/adump'
*patible='12.1.0.2.0'
*.control_files='/data/prd/oracle/database/oradata/ORCL/controlfile/o1_mf_h9bx082j_.ctl','/data/prd/oracle/database/fast_recovery_area/ORCL/controlfile/o1_mf_h9bx08cr_.ctl'
*.db_block_size=8192
*.db_file_multiblock_read_count=16
*.db_create_file_dest='/data/restore/'
*.db_recovery_file_dest='/data/restore/'
*.db_recovery_file_dest_size=500g
*.enable_pluggable_database=ture
*.db_name='HYBRID'
*.log_archive_dest_1='location=/data/arch'
*.log_archive_format='%t_%s_%r.arc'
*.open_cursors=300
*.processes=1500
*.remote_login_passwordfile='exclusive'
*.sessions=1655
*.sga_max_size=4G
*.sga_target=4G
*.pga_aggregate_limit=3G
*.pga_aggregate_target=1G
*.undo_management='AUTO'
undo_tablespace='UNDOTBS1'
*.diagnostic_dest='/data/prd/oracle/database'
利⽤pfile启动数据库到nomount状态
startup nomount pfile='/data/prd/oracle/database/12.1.0.2/ORCL/a'
4. 恢复控制⽂件
注意NB_ORA_CLIENT后是备份库的主机名,控制⽂件备份⼀般选晚于⽬标时间点并且离它最近的即可。rman target /
Set DBID=2334928137;
run{
allocate channel ch00 type 'SBT_TAPE';
send 'nb_ora_serv=nbu01';
send 'nb_ora_client=iZwz94g9fehswlnzd19jv2Z';
restore controlfile from '/c-2334928137-20200513-09';
release channel ch00;
}
启动数据库到mount状态
alter database mount;
检查物理⽂件位置,确保⽬录已存在,或在恢复时指定新路径
select name from v$datafile;
select name from v$tempfile;
select member from v$logfile;
archive log list
5. 恢复数据⽂件
本⽂以恢复到指定时间点、不同数据⽂件⽬录为例
rman target /
run {
ALLOCATE CHANNEL CH1 TYPE 'SBT_TAPE';
ALLOCATE CHANNEL CH2 TYPE 'SBT_TAPE';
send 'nb_ora_serv=nbu01';
send 'nb_ora_client=iZwz94g9fehswlnzd19jv2Z';
set newname for database to '/data/restore/%b';
set until time "to_date('2020-05-13 14:00:00','yyyy-mm-dd hh24:mi:ss')";
restore database;
switch datafile all;
recover database;
RELEASE CHANNEL CH1;
RELEASE CHANNEL CH2;
}
open数据库
alter database open resetlogs;
select status from v$instance;
6. 检查是否恢复到要求时间点
基于时间点的还原并不⼀定准确,可能会有10分钟以内误差。
RMAN> list incarnation of database;
using target database control file instead of recovery catalog
List of Database Incarnations
DB Key Inc Key DB Name DB ID STATUS Reset SCN Reset Time
------- ------- -------- ---------------- --- ---------- ----------
1 1 HYBRID 2334928137 PARENT 1 14-APR-20
2 2 HYBRID 2334928137 CURRENT 11836309 13-MAY-20
RMAN> select scn_to_timestamp(11836309) from dual;
SCN_TO_TIMESTAMP(11836309)
-------------------------------
13-MAY-20 01.50.11.000000000 PM
三、报错⼩结
1. 报错1
RMAN> run{
2> allocate channel ch00 type 'SBT_TAPE';
3> send 'nb_ora_serv=nbu01';
4> send 'nb_ora_client=iZwz9bqyoktgse85mhpwd8Z';
5> restore controlfile from '/c-2334928137-20200511-09';
6> release channel ch00;
7> }
using target database control file instead of recovery catalog
allocated channel: ch00
channel ch00: SID=1150 device type=SBT_TAPE
channel ch00: Veritas NetBackup for Oracle - Release 7.7.3 (2016051915)
sent command to channel: ch00
sent command to channel: ch00
Starting restore at 11-MAY-20
released channel: ch00
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of restore command at 05/11/2020 22:10:12
RMAN-06172: no AUTOBACKUP found or specified handle is not a valid copy or piece
解决⽅法:nb_ora_client参数后应该填备份服务器名⽽⾮还原服务器名
3. 报错3
RMAN> run {
2> ALLOCATE CHANNEL CH1 TYPE 'SBT_TAPE';
3> ALLOCATE CHANNEL CH2 TYPE 'SBT_TAPE';
4> send 'nb_ora_serv=nbu01';
5> send 'nb_ora_client=iZwz94g9fehswlnzd19jv2Z';
6> set until time "to_date('2020-05-08 17:00:00','yyyy-mm-dd hh24:mi:ss')";
7> restore database;
8> recover database;
9> RELEASE CHANNEL CH1;
10> RELEASE CHANNEL CH2;
11> }
allocated channel: CH1
channel CH1: SID=1150 device type=SBT_TAPE
channel CH1: Veritas NetBackup for Oracle - Release 7.7.3 (2016051915)
allocated channel: CH2
channel CH2: SID=6 device type=SBT_TAPE
channel CH2: Veritas NetBackup for Oracle - Release 7.7.3 (2016051915)
sent command to channel: CH1
sent command to channel: CH2
sent command to channel: CH1
sent command to channel: CH2
executing command: SET until clause
Starting restore at 13-MAY-20
Starting implicit crosscheck backup at 13-MAY-20
Finished implicit crosscheck backup at 13-MAY-20
Starting implicit crosscheck copy at 13-MAY-20
oracle数据库自动备份方法Finished implicit crosscheck copy at 13-MAY-20
searching for all files in the recovery area
cataloging done
released channel: CH1
released channel: CH2
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of restore command at 05/13/2020 00:16:30
RMAN-06026: some targets not found - aborting restore
RMAN-06023: no backup or copy of datafile 8 found to restore
RMAN-06023: no backup or copy of datafile 7 found to restore
RMAN> exit
解决⽅法:测试时的解决⽅法为使⽤⼿⼯创建的参数⽂件⽽⾮控制⽂件中恢复的spfile,也查到有很多别的问题可能导致此类报错,详情可在MOS中搜索。
4. 报错4
RMAN> run {
2> ALLOCATE CHANNEL CH1 TYPE 'SBT_TAPE';
3> ALLOCATE CHANNEL CH2 TYPE 'SBT_TAPE';
4> send 'nb_ora_serv=nbu01-in';
5> send 'nb_ora_client=iZwz94g9fehswlnzd19jv2Z';
6> set newname for database to '/data/restore/%b';
7> set until time "to_date('2020-12-01 10:00:00','yyyy-mm-dd hh24:mi:ss')";
8> restore database;
9> switch datafile all;
10> recover database;
11> RELEASE CHANNEL CH1;
12> RELEASE CHANNEL CH2;
13> }
allocated channel: CH1
channel CH1: SID=1710 device type=SBT_TAPE
channel CH1: Veritas NetBackup for Oracle - Release 7.7.3 (2016051915)
allocated channel: CH2
channel CH2: SID=5 device type=SBT_TAPE
channel CH2: Veritas NetBackup for Oracle - Release 7.7.3 (2016051915)
sent command to channel: CH1
sent command to channel: CH2
sent command to channel: CH1
sent command to channel: CH2
executing command: SET NEWNAME
executing command: SET until clause
Starting restore at 25-DEC-20
released channel: CH1
released channel: CH2
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of restore command at 12/25/2020 15:20:15
RMAN-06026: some targets not found - aborting restore
RMAN-06023: no backup or copy of datafile 4 found to restore
RMAN-06023: no backup or copy of datafile 3 found to restore
RMAN-06023: no backup or copy of datafile 2 found to restore
RMAN-06023: no backup or copy of datafile 1 found to restore
解决⽅法:使⽤的控制⽂件过新,已⽆欲恢复时间点备份记录。控制⽂件备份⼀般选晚于⽬标时间点并且离它最近的即可。
5. 报错5
SQL> alter database open resetlogs;
alter database open resetlogs
*
ERROR at line 1:
ORA-00344: unable to re-create online log '/data/oracle/oradata/pa/redo01.log'
ORA-27040: file create error, unable to create file
Linux-x86_64 Error: 2: No such file or directory
Additional information: 1
解决⽅法:redo⽇志所在⽬录未创建或⽆权限。创建对应⽬录并授权,或者修改redo⽂件⽬录
6. 报错6
SQL> alter database open RESETLOGS;
alter database open RESETLOGS
*
ERROR at line 1:
ORA-00392: log 3 of thread 1 is being cleared, operation not allowed
ORA-00312: online log 3 thread 1: '/data/oracle/oradata/pa/redo03.log'
解决⽅法
SQL> select group#,thread#,status from v$log;
GROUP# THREAD# STATUS
---------- ---------- ---------------
1 1 CLEARING
2 1 CLEARING
5 1 CLEARING
4 1 CLEARING
3 1 CLEARING_CURRENT
SQL> alter database clear logfile group 3;
Database altered.
SQL> select group#,thread#,status from v$log;
GROUP# THREAD# STATUS
---------- ---------- ----------------
1 1 CLEARING
2 1 CLEARING
5 1 CLEARING
4 1 CLEARING
3 1 CURRENT
SQL> alter database open RESETLOGS;
Database altered.
参考
Common Causes for RMAN-06023 and RMAN-06026 (⽂档 ID 1366610.1)
RMAN RESTORE FAILS WITH RMAN-06023 ALTHOUGH BACKUPS ARE AVAILABLE (⽂档 ID 965122.1)
RMAN-6026 RMAN-6023 when restoring to new host (⽂档 ID 1300586.1)
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论