rman同步(异机RMAN数据不完全恢复)

rman同步(异机RMAN数据不完全恢复)

1 根据源库配置pfile文件

[oracle@iz2ze8d5ppmu95sr2clgqyz dbs] $  cat initorcl.ora
orcl.__db_cache_size=3825205248
orcl.__java_pool_size=67108864
orcl.__large_pool_size=67108864
orcl.__oracle_base='/oracle/app/oracle'#ORACLE_BASE set from environment
orcl.__pga_aggregate_target=2952790016
orcl.__sga_target=5637144576
orcl.__shared_io_pool_size=0
orcl.__shared_pool_size=1476395008
orcl.__streams_pool_size=134217728
*.aq_tm_processes=0
*.audit_file_dest='/oracle/app/oracle/admin/orcl/adump'
*.audit_trail='db'
*.compatible='11.2.0.0.0'
*.control_file_record_keep_time=45
*.control_files='/oracle/app/oracle/oradata/orcl/control01.ctl','/oracle/app/oracle/flash_recovery_area/orcl/control02.ctl'
*.db_block_size=8192
*.db_domain=''
*.db_name='orcl'
*.db_recovery_file_dest='/oracle/app/oracle/flash_recovery_area'
*.db_recovery_file_dest_size=4070572032
*.deferred_segment_creation=FALSE
*.diagnostic_dest='/oracle/app/oracle'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=orclXDB)'
*.job_queue_processes=10
*.log_archive_dest_1='location=/oracle/app/oracle/arch'
*.log_archive_format='arch_%t_%s_%r.log'
*.memory_max_target=8589934592
*.memory_target=8589934592
*.open_cursors=300
*.pga_aggregate_target=0
*.pre_page_sga=FALSE
*.processes=1500
*.remote_login_passwordfile='EXCLUSIVE'
*.sessions=2000
*.sga_max_size=6442450944
*.sga_target=0
*.undo_retention=1800
*.undo_tablespace='UNDOTBS1'

2 启动数据库到nomount

[oracle@rzt1 dbs]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.4.0 Production on Fri Aug 24 11:52:42 2018

Copyright (c) 1982, 2013, Oracle.  All rights reserved.

Connected to an idle instance.

SQL> startup nomount;
ORACLE instance started.

Total System Global Area 6413680640 bytes
Fixed Size                  2265224 bytes
Variable Size            2550140792 bytes
Database Buffers         3841982464 bytes
Redo Buffers               19292160 bytes
SQL>

3 备库同步

3.1 进入rman
[oracle@rzt1 orcl]$ rman target /

Recovery Manager: Release 11.2.0.4.0 - Production on Fri Aug 24 16:07:27 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.

connected to target database: ORCL (not mounted)
3.2 恢复控制文件
RMAN> restore controlfile from '/u01/app/oracle/rman_backup/2018_08_22-LEVEL0/L0_CON_20180822_30tb6hqe_1_1.bak';

Starting restore at 2018/08/24
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=1426 device type=DISK

channel ORA_DISK_1: restoring control file
channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
output file name=/oracle/app/oracle/oradata/orcl/control01.ctl
output file name=/oracle/app/oracle/flash_recovery_area/orcl/control02.ctl
Finished restore at 2018/08/24
3.3 启动mount状态
RMAN> alter database mount;

database mounted
released channel: ORA_DISK_1
3.4 restore数据库
# 跑ramn的run自编写程序块
run
{
set newname for datafile 1 to '/oracle/app/oracle/oradata/orcl/system01.dbf';
set newname for datafile 2 to '/oracle/app/oracle/oradata/orcl/sysaux01.dbf';
set newname for datafile 3 to '/oracle/app/oracle/oradata/orcl/undotbs01.dbf';
set newname for datafile 4 to '/oracle/app/oracle/oradata/orcl/users01.dbf';
set newname for datafile 5 to '/oracle/app/oracle/oradata/orcl/example01.dbf';
set newname for datafile 6 to '/oracle/app/sdtd.dbf';
set newname for datafile 7 to '/oracle/app/sdtd_idx.dbf';
set newname for datafile 8 to '/oracle/app/sdtd02.dbf';
set newname for datafile 9 to '/oracle/app/oracle/oradata/orcl/undotbs02.dbf';
restore database;
switch datafile all;
}

# 如下输出
executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

Starting restore at 2018/08/24
Starting implicit crosscheck backup at 2018/08/24
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=1426 device type=DISK
Crosschecked 44 objects
Finished implicit crosscheck backup at 2018/08/24

Starting implicit crosscheck copy at 2018/08/24
using channel ORA_DISK_1
Finished implicit crosscheck copy at 2018/08/24

searching for all files in the recovery area
cataloging files...
no files cataloged

using channel ORA_DISK_1

channel ORA_DISK_1: starting datafile backup set restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_DISK_1: restoring datafile 00001 to /oracle/app/oracle/oradata/orcl/system01.dbf
channel ORA_DISK_1: restoring datafile 00002 to /oracle/app/oracle/oradata/orcl/sysaux01.dbf
channel ORA_DISK_1: restoring datafile 00003 to /oracle/app/oracle/oradata/orcl/undotbs01.dbf
channel ORA_DISK_1: restoring datafile 00008 to /oracle/app/sdtd02.dbf
channel ORA_DISK_1: restoring datafile 00009 to /oracle/app/oracle/oradata/orcl/undotbs02.dbf
channel ORA_DISK_1: reading from backup piece /u01/app/oracle/rman_backup/2018_08_22-LEVEL0/L0_DATA_20180822_2ttb6hcs_1_1.bak
channel ORA_DISK_1: piece handle=/u01/app/oracle/rman_backup/2018_08_22-LEVEL0/L0_DATA_20180822_2ttb6hcs_1_1.bak tag=TAG20180822T110812
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:01:15
channel ORA_DISK_1: starting datafile backup set restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_DISK_1: restoring datafile 00004 to /oracle/app/oracle/oradata/orcl/users01.dbf
channel ORA_DISK_1: restoring datafile 00005 to /oracle/app/oracle/oradata/orcl/example01.dbf
channel ORA_DISK_1: restoring datafile 00006 to /oracle/app/sdtd.dbf
channel ORA_DISK_1: restoring datafile 00007 to /oracle/app/sdtd_idx.dbf
channel ORA_DISK_1: reading from backup piece /u01/app/oracle/rman_backup/2018_08_22-LEVEL0/L0_DATA_20180822_2stb6hcs_1_1.bak
channel ORA_DISK_1: piece handle=/u01/app/oracle/rman_backup/2018_08_22-LEVEL0/L0_DATA_20180822_2stb6hcs_1_1.bak tag=TAG20180822T110812
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:02:05
Finished restore at 2018/08/24
3.5 recover数据库
RMAN> recover database;

Starting recover at 2018/08/24
using channel ORA_DISK_1

starting media recovery

channel ORA_DISK_1: starting archived log restore to default destination
channel ORA_DISK_1: restoring archived log
archived log thread=1 sequence=1971
channel ORA_DISK_1: reading from backup piece /u01/app/oracle/rman_backup/2018_08_22-LEVEL0/L0_ARC_20180822_2vtb6hpv_1_1.bak
channel ORA_DISK_1: piece handle=/u01/app/oracle/rman_backup/2018_08_22-LEVEL0/L0_ARC_20180822_2vtb6hpv_1_1.bak tag=TAG20180822T111510
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
archived log file name=/oracle/app/oracle/arch/arch_1_1971_964643876.log thread=1 sequence=1971
unable to find archived log
archived log thread=1 sequence=1972
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of recover command at 08/24/2018 16:18:32
RMAN-06054: media recovery requesting unknown archived log for thread 1 with sequence 1972 and starting SCN of 521674801

#如上报错
#使用如下试一试
RMAN> recover database until cancel;

RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-00558: error encountered while parsing input commands
RMAN-01009: syntax error: found "cancel": expecting one of: "scn, sequence, time"
RMAN-01007: at line 1 column 24 file: standard input

RMAN> exit

Recovery Manager complete.

[oracle@rzt1 orcl]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.4.0 Production on Fri Aug 24 16:30:02 2018

Copyright (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

#因为我的软件版本是11.2.0.4,所以需要UPGRADE
SQL> alter database open resetlogs;
alter database open resetlogs
*
ERROR at line 1:
ORA-01092: ORACLE instance terminated. Disconnection forced
ORA-00704: bootstrap process failure
ORA-39700: database must be opened with UPGRADE option
Process ID: 41905
Session ID: 1312 Serial number: 11

SQL> alter database open upgrade;
ERROR:
ORA-03114: not connected to ORACLE

SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
[oracle@rzt1 orcl]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.4.0 Production on Fri Aug 24 16:32:50 2018

Copyright (c) 1982, 2013, Oracle.  All rights reserved.

Connected to an idle instance.

SQL> startup mount;
ORACLE instance started.

Total System Global Area 6413680640 bytes
Fixed Size                  2265224 bytes
Variable Size            2550140792 bytes
Database Buffers         3841982464 bytes
Redo Buffers               19292160 bytes
Database mounted.
SQL>  alter database open upgrade;

Database altered.

SQL>
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值