[oracle@rzt1 dbs]$ sqlplus / as sysdba
SQL*Plus: Release11.2.0.4.0 Production on Fri Aug 2411:52:422018
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: Release11.2.0.4.0 - Production on Fri Aug 2416:07:272018
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 at2018/08/24
using target database control fileinstead 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 filename=/oracle/app/oracle/oradata/orcl/control01.ctl
output filename=/oracle/app/oracle/flash_recovery_area/orcl/control02.ctl
Finished restore at2018/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 1to'/oracle/app/oracle/oradata/orcl/system01.dbf';set newname for datafile 2to'/oracle/app/oracle/oradata/orcl/sysaux01.dbf';set newname for datafile 3to'/oracle/app/oracle/oradata/orcl/undotbs01.dbf';set newname for datafile 4to'/oracle/app/oracle/oradata/orcl/users01.dbf';set newname for datafile 5to'/oracle/app/oracle/oradata/orcl/example01.dbf';set newname for datafile 6to'/oracle/app/sdtd.dbf';set newname for datafile 7to'/oracle/app/sdtd_idx.dbf';set newname for datafile 8to'/oracle/app/sdtd02.dbf';set newname for datafile 9to'/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 at2018/08/24
Starting implicit crosscheck backup at2018/08/24
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=1426 device type=DISK
Crosschecked 44 objects
Finished implicit crosscheck backup at2018/08/24
Starting implicit crosscheck copy at2018/08/24using channel ORA_DISK_1
Finished implicit crosscheck copy at2018/08/24
searching forall 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 00001to /oracle/app/oracle/oradata/orcl/system01.dbf
channel ORA_DISK_1: restoring datafile 00002to /oracle/app/oracle/oradata/orcl/sysaux01.dbf
channel ORA_DISK_1: restoring datafile 00003to /oracle/app/oracle/oradata/orcl/undotbs01.dbf
channel ORA_DISK_1: restoring datafile 00008to /oracle/app/sdtd02.dbf
channel ORA_DISK_1: restoring datafile 00009to /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 00004to /oracle/app/oracle/oradata/orcl/users01.dbf
channel ORA_DISK_1: restoring datafile 00005to /oracle/app/oracle/oradata/orcl/example01.dbf
channel ORA_DISK_1: restoring datafile 00006to /oracle/app/sdtd.dbf
channel ORA_DISK_1: restoring datafile 00007to /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 at2018/08/24
3.5 recover数据库
RMAN> recover database;
Starting recover at2018/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 logfilename=/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 at08/24/201816:18:32
RMAN-06054: media recovery requesting unknown archived logfor thread 1with sequence 1972and starting SCN of521674801#如上报错#使用如下试一试
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 24file: 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 2416:30:022018
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 2416:32:502018
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>