oracle 容灾执行过程及问题分析

1. 采用两台带有虚拟机的电脑,虚拟机中操作系统 centos6,虚拟机中已装好oracle(也可以准备一台电脑装两个虚拟机)
  • 两台电脑在同一个局域网下(可以同一个家用路由器下),使用桥接模式连通
  • 两台虚拟机配置静态ip
2.一台电脑做主库,另一台做备库
  1. 主库查询确认组数
$sqlplus /  as sysdba
select group#,thread#,members,status from v$log;

oracle 容灾执行过程及问题分析_第1张图片

  1. 增加standbylogfile
$sqlplus /  as sysdba
alter database add standby logfile  group 8 '/home/oracle/app/oracle/oradata/orcl/stdredo1.log' size 50m;
alter database add standby logfile  group 9 '/home/oracle/app/oracle/oradata/orcl/stdredo2.log' size 50m;
alter database add standby logfile  group 10 '/home/oracle/app/oracle/oradata/orcl/stdredo3.log' size 50m;
alter database add standby logfile  group 11 '/home/oracle/app/oracle/oradata/orcl/stdredo4.log' size 50m;
  1. 在备库oracle用户创建归档目录,数据目录并设置权限oracle用户
mkdir -p /home/oracle/app/oracle/diag/orcl
mkdir -p /home/oracle/app/oracle/oradata/stdorcl/
mkdir -p /home/oracle/app/oracle/oradata/stdorcl/pdborcl
mkdir -p /home/oracle/arch
mkdir -p /home/oracle/rman
mkdir -p /home/oracle/app/oracle/oradata/stdorcl/pdbseed/
mkdir -p /home/oracle/app/oracle/oradata/stdorcl/pdb/
  1. 主库环境开启强制归档
$sqlplus /  as sysdba
ALTER DATABASE FORCE LOGGING;
  1. 在主库已开启归档模式下修改如下参数
$sqlplus /  as sysdba
alter system set LOG_ARCHIVE_CONFIG='DG_CONFIG=(orcl,stdorcl)' scope=both sid='*';         //sql>
alter system set log_archive_dest_1='LOCATION=/home/oracle/arch VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=orcl' scope=spfile;
alter system set LOG_ARCHIVE_DEST_2='SERVICE=stdorcl LGWR ASYNC  VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=stdorcl' scope=both sid='*';
alter system set fal_client='orcl' scope=both sid='*';    
alter system set FAL_SERVER='stdorcl' scope=both sid='*';  
alter system set standby_file_management=AUTO scope=both sid='*';
alter system set DB_FILE_NAME_CONVERT='/home/oracle/app/oracle/oradata/stdorcl/','/home/oracle/app/oracle/oradata/orcl/' scope=spfile sid='*';  
alter system set LOG_FILE_NAME_CONVERT='/home/oracle/app/oracle/oradata/stdorcl/','/home/oracle/app/oracle/oradata/orcl/' scope=spfile sid='*';
alter system set log_archive_format='%t_%s_%r.arc' scope=spfile sid='*';
alter system set remote_login_passwordfile='EXCLUSIVE' scope=spfile;
alter system set PARALLEL_EXECUTION_MESSAGE_SIZE=8192 scope=spfile;
  1. 编辑主库以及备库的tnsnames.ora文件
#打开文件
$gedit /home/oracle/app/oracle/product/12.1.0/dbhome_1/network/admin/tnsnames.ora

加入一下内容:
ORCL =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.104)(PORT = 1521))
)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl)
)
)

stdorcl = (DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.103)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SID = orcl)
) )

  1. 在主库上生成备库的参数文件
$sqlplus /  as sysdba
create pfile from spfile;
  1. 将主库的参数文件,密码文件拷贝到备库
scp /home/oracle/app/oracle/product/12.1.0/dbhome_1/dbs/initorcl.ora 192.168.1.103:/home/oracle/app/oracle/product/12.1.0/dbhome_1/dbs/
scp /home/oracle/app/oracle/product/12.1.0/dbhome_1/dbs/orapworcl 192.168.1.103:/home/oracle/app/oracle/product/12.1.0/dbhome_1/dbs/
  1. 在备库上更改参数文件
$gedit /home/oracle/app/oracle/product/12.1.0/dbhome_1/dbs/initorcl.ora

内容如下:
orcl.__data_transfer_cache_size=0
orcl.__db_cache_size=671088640
orcl.__java_pool_size=16777216
orcl.__large_pool_size=33554432
orcl.__oracle_base=’/home/oracle/app/oracle’#ORACLE_BASE set from environment
orcl.__pga_aggregate_target=536870912
orcl.__sga_target=1258291200
orcl.__shared_io_pool_size=50331648
orcl.__shared_pool_size=301989888
orcl.__streams_pool_size=0
*.allow_resetlogs_corruption=TRUE
*.catalog_foreign_restore=FALSE
*.audit_file_dest=’/home/oracle/app/oracle/admin/orcl/adump’
*.audit_trail=‘db’
*.compatible=‘12.1.0.2.0’
*.control_files=’/home/oracle/app/oracle/oradata/orcl/control01.ctl’,’/home/oracle/app/oracle/fast_recovery_area/orcl/control02.ctl’,’/home/oracle/app/oracle/fast_recovery_area/orcl/control03.ctl’
*.db_block_size=8192
*.db_domain=’’
*.db_file_name_convert=’/home/oracle/app/oracle/oradata/orcl/’,’/home/oracle/app/oracle/oradata/stdorcl/’
*.db_name=‘orcl’
*.db_unique_name=‘stdorcl’
*.db_recovery_file_dest=’/home/oracle/app/oracle/fast_recovery_area’
*.db_recovery_file_dest_size=4823449600
*.diagnostic_dest=’/home/oracle/app/oracle’
*.dispatchers=’(PROTOCOL=TCP)(dispatchers=1)(pool=on)(ticks=1)(connections=500)(sessions=1000)’
*.enable_pluggable_database=true
*.fal_client=‘stdorcl’
*.fal_server=‘orcl’
*.inmemory_max_populate_servers=2
*.inmemory_size=157286400
*.local_listener=’’
*.log_archive_config=‘DG_CONFIG=(stdorcl,orcl)’
*.log_archive_dest_1=‘LOCATION=/home/oracle/arch VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=stdorcl’
*.log_archive_dest_2=‘SERVICE=orcl LGWR ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=orcl’
*.log_archive_format=’%t
%s
%r.arc’
*.log_file_name_convert=’/home/oracle/app/oracle/oradata/orcl/’,’/home/oracle/app/oracle/oradata/stdorcl/’
*.max_dispatchers=5
*.max_shared_servers=20
*.open_cursors=400
*.parallel_execution_message_size=8192
*.pga_aggregate_target=511m
*.processes=300
*.recovery_parallelism=0
*.remote_login_passwordfile=‘EXCLUSIVE’
*.service_names=‘ORCL’
*.sga_max_size=1572864000
*.sga_target=1258291200
*.shared_server_sessions=200
*.standby_file_management=‘AUTO’
*.undo_tablespace=‘UNDOTBS1’

  1. 在备库增加静态监听
$gedit /home/oracle/app/oracle/product/12.1.0/dbhome_1/network/admin/listener.ora

SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(ORACLE_HOME = /home/oracle/app/oracle/product/12.1.0/db_1)
(SID_NAME = orcl)
)
)

  1. 主库进入rman模式
$rman target sys/123@orcl auxiliary sys/123@stdorcl

运行下面程序
run{
allocate channel c1 type disk;
allocate channel c2 type disk;
allocate channel c3 type disk;
allocate AUXILIARY channel c4 type disk;
allocate AUXILIARY channel c5 type disk;
allocate AUXILIARY channel c6 type disk;
DUPLICATE TARGET DATABASE
FOR STANDBY
FROM ACTIVE DATABASE
DORECOVER
NOFILENAMECHECK;
release channel c1;
release channel c2;
release channel c3;
release channel c4;
release channel c5;
release channel c6;
}

输出结果如下:
using target database control file instead of recovery catalog
allocated channel: c1
channel c1: SID=133 device type=DISK

allocated channel: c2 channel c2: SID=254 device type=DISK

allocated channel: c3 channel c3: SID=366 device type=DISK

allocated channel: c4 channel c4: SID=355 device type=DISK

allocated channel: c5 channel c5: SID=6 device type=DISK

allocated channel: c6 channel c6: SID=126 device type=DISK

Starting Duplicate Db at 26-11月-19 current log archived

contents of Memory Script: { backup as copy reuse targetfile
‘/home/oracle/app/oracle/product/12.1.0/dbhome_1/dbs/orapworcl’
auxiliary format
‘/home/oracle/app/oracle/product/12.1.0/dbhome_1/dbs/orapworcl’ ; }
executing Memory Script

Starting backup at 26-11月-19 Finished backup at 26-11月-19

contents of Memory Script: { restore clone from service ‘orcl’
standby controlfile; } executing Memory Script

Starting restore at 26-11月-19

channel c4: starting datafile backup set restore channel c4: using
network backup set from service orcl channel c4: restoring control
file channel c4: restore complete, elapsed time: 00:00:03 output file
name=/home/oracle/app/oracle/oradata/orcl/control01.ctl output file
name=/home/oracle/app/oracle/fast_recovery_area/orcl/control02.ctl
output file
name=/home/oracle/app/oracle/fast_recovery_area/orcl/control03.ctl
Finished restore at 26-11月-19

contents of Memory Script: { sql clone ‘alter database mount
standby database’; } executing Memory Script

sql statement: alter database mount standby database

contents of Memory Script: { set newname for tempfile 4 to
“/home/oracle/app/oracle/oradata/orcl/pdborcl/pdborcl_temp2-PM.dbf”;
set newname for tempfile 5 to
“/home/oracle/app/oracle/oradata/orcl/temp02.dbf”; set newname for
tempfile 6 to
“/home/oracle/app/oracle/oradata/orcl/pdbseed/pdbseed_temp012.dbf”;
switch clone tempfile all; set newname for datafile 1 to
“/home/oracle/app/oracle/oradata/orcl/system01.dbf”; set newname
for datafile 3 to
“/home/oracle/app/oracle/oradata/orcl/sysaux01.dbf”; set newname
for datafile 4 to
“/home/oracle/app/oracle/oradata/orcl/undotbs01.dbf”; set newname
for datafile 5 to
“/home/oracle/app/oracle/oradata/orcl/pdbseed/system01.dbf”; set
newname for datafile 6 to
“/home/oracle/app/oracle/oradata/orcl/users01.dbf”; set newname for
datafile 7 to
“/home/oracle/app/oracle/oradata/orcl/pdbseed/sysaux01.dbf”; set
newname for datafile 8 to
“/home/oracle/app/oracle/oradata/orcl/pdborcl/system01.dbf”; set
newname for datafile 9 to
“/home/oracle/app/oracle/oradata/orcl/pdborcl/sysaux01.dbf”; set
newname for datafile 10 to
“/home/oracle/app/oracle/oradata/orcl/pdborcl/SAMPLE_SCHEMA_users01.dbf”;
set newname for datafile 11 to
“/home/oracle/app/oracle/oradata/orcl/pdborcl/example01.dbf”; set
newname for datafile 12 to
“/home/oracle/app/oracle/oradata/orcl/pdborcl/pdbtest_users02_1.dbf”;
set newname for datafile 13 to
“/home/oracle/app/oracle/oradata/orcl/pdborcl/pdbtest_users02_2.dbf”;
set newname for datafile 16 to
“/home/oracle/app/oracle/oradata/orcl/pdborcl/pdbtest_users02_3.dbf”;
set newname for datafile 17 to
“/home/oracle/app/oracle/oradata/orcl/pdborcl/pdbtest_users02_4.dbf”;
set newname for datafile 77 to
“/home/oracle/app/oracle/oradata/orcl/pdborcl/pdbtest_users03_1.dbf”;
set newname for datafile 78 to
“/home/oracle/app/oracle/oradata/orcl/pdborcl/pdbtest_users03_2.dbf”;
set newname for datafile 79 to
“/home/oracle/app/oracle/oradata/orcl/pdborcl/pdbtest_qhl001_1.dbf”;
set newname for datafile 80 to
“/home/oracle/app/oracle/oradata/orcl/pdborcl/pdbtest_qhl001_2.dbf”;
set newname for datafile 81 to
“/home/oracle/app/oracle/oradata/orcl/pdborcl/pdbtest_qhl002_1.dbf”;
set newname for datafile 82 to
“/home/oracle/app/oracle/oradata/orcl/pdborcl/pdbtest_qhl002_2.dbf”;
restore from service ‘orcl’ clone database ; sql ‘alter
system archive log current’; } executing Memory Script

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

renamed tempfile 4 to
/home/oracle/app/oracle/oradata/orcl/pdborcl/pdborcl_temp2-PM.dbf in
control file renamed tempfile 5 to
/home/oracle/app/oracle/oradata/orcl/temp02.dbf in control file
renamed tempfile 6 to
/home/oracle/app/oracle/oradata/orcl/pdbseed/pdbseed_temp012.dbf in
control file

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

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

executing command: SET NEWNAME

executing command: SET NEWNAME

Starting restore at 26-11月-19

channel c4: starting datafile backup set restore channel c4: using
network backup set from service orcl channel c4: specifying
datafile(s) to restore from backup set channel c4: restoring datafile
00001 to /home/oracle/app/oracle/oradata/orcl/system01.dbf channel c5:
starting datafile backup set restore channel c5: using network backup
set from service orcl channel c5: specifying datafile(s) to restore
from backup set channel c5: restoring datafile 00003 to
/home/oracle/app/oracle/oradata/orcl/sysaux01.dbf channel c6: starting
datafile backup set restore channel c6: using network backup set from
service orcl channel c6: specifying datafile(s) to restore from backup
set channel c6: restoring datafile 00004 to
/home/oracle/app/oracle/oradata/orcl/undotbs01.dbf channel c6: restore
complete, elapsed time: 00:00:34 channel c6: starting datafile backup
set restore channel c6: using network backup set from service orcl
channel c6: specifying datafile(s) to restore from backup set channel
c6: restoring datafile 00005 to
/home/oracle/app/oracle/oradata/orcl/pdbseed/system01.dbf channel c6:
restore complete, elapsed time: 00:02:15 channel c6: starting datafile
backup set restore channel c6: using network backup set from service
orcl channel c6: specifying datafile(s) to restore from backup set
channel c6: restoring datafile 00006 to
/home/oracle/app/oracle/oradata/orcl/users01.dbf channel c6: restore
complete, elapsed time: 00:00:36 channel c6: starting datafile backup
set restore channel c6: using network backup set from service orcl
channel c6: specifying datafile(s) to restore from backup set channel
c6: restoring datafile 00007 to
/home/oracle/app/oracle/oradata/orcl/pdbseed/sysaux01.dbf channel c4:
restore complete, elapsed time: 00:04:03 channel c4: starting datafile
backup set restore channel c4: using network backup set from service
orcl channel c4: specifying datafile(s) to restore from backup set
channel c4: restoring datafile 00008 to
/home/oracle/app/oracle/oradata/orcl/pdborcl/system01.dbf channel c5:
restore complete, elapsed time: 00:04:08 channel c5: starting datafile
backup set restore channel c5: using network backup set from service
orcl channel c5: specifying datafile(s) to restore from backup set
channel c5: restoring datafile 00009 to
/home/oracle/app/oracle/oradata/orcl/pdborcl/sysaux01.dbf channel c4:
restore complete, elapsed time: 00:01:35 channel c4: starting datafile
backup set restore channel c4: using network backup set from service
orcl channel c4: specifying datafile(s) to restore from backup set
channel c4: restoring datafile 00010 to
/home/oracle/app/oracle/oradata/orcl/pdborcl/SAMPLE_SCHEMA_users01.dbf
channel c6: restore complete, elapsed time: 00:02:47 channel c6:
starting datafile backup set restore channel c6: using network backup
set from service orcl channel c6: specifying datafile(s) to restore
from backup set channel c6: restoring datafile 00011 to
/home/oracle/app/oracle/oradata/orcl/pdborcl/example01.dbf channel c4:
restore complete, elapsed time: 00:00:57 channel c4: starting datafile
backup set restore channel c4: using network backup set from service
orcl channel c4: specifying datafile(s) to restore from backup set
channel c4: restoring datafile 00012 to
/home/oracle/app/oracle/oradata/orcl/pdborcl/pdbtest_users02_1.dbf
channel c5: restore complete, elapsed time: 00:02:38 channel c5:
starting datafile backup set restore channel c5: using network backup
set from service orcl channel c5: specifying datafile(s) to restore
from backup set channel c5: restoring datafile 00013 to
/home/oracle/app/oracle/oradata/orcl/pdborcl/pdbtest_users02_2.dbf
channel c4: restore complete, elapsed time: 00:00:02 channel c4:
starting datafile backup set restore channel c4: using network backup
set from service orcl channel c4: specifying datafile(s) to restore
from backup set channel c4: restoring datafile 00016 to
/home/oracle/app/oracle/oradata/orcl/pdborcl/pdbtest_users02_3.dbf
channel c5: restore complete, elapsed time: 00:00:03 channel c5:
starting datafile backup set restore channel c5: using network backup
set from service orcl channel c5: specifying datafile(s) to restore
from backup set channel c5: restoring datafile 00017 to
/home/oracle/app/oracle/oradata/orcl/pdborcl/pdbtest_users02_4.dbf
channel c4: restore complete, elapsed time: 00:00:03 channel c4:
starting datafile backup set restore channel c4: using network backup
set from service orcl channel c4: specifying datafile(s) to restore
from backup set channel c4: restoring datafile 00077 to
/home/oracle/app/oracle/oradata/orcl/pdborcl/pdbtest_users03_1.dbf
channel c5: restore complete, elapsed time: 00:00:06 channel c5:
starting datafile backup set restore channel c5: using network backup
set from service orcl channel c5: specifying datafile(s) to restore
from backup set channel c5: restoring datafile 00078 to
/home/oracle/app/oracle/oradata/orcl/pdborcl/pdbtest_users03_2.dbf
channel c4: restore complete, elapsed time: 00:00:07 channel c4:
starting datafile backup set restore channel c4: using network backup
set from service orcl channel c4: specifying datafile(s) to restore
from backup set channel c4: restoring datafile 00079 to
/home/oracle/app/oracle/oradata/orcl/pdborcl/pdbtest_qhl001_1.dbf
channel c5: restore complete, elapsed time: 00:00:02 channel c5:
starting datafile backup set restore channel c5: using network backup
set from service orcl channel c5: specifying datafile(s) to restore
from backup set channel c5: restoring datafile 00080 to
/home/oracle/app/oracle/oradata/orcl/pdborcl/pdbtest_qhl001_2.dbf
channel c4: restore complete, elapsed time: 00:00:04 channel c4:
starting datafile backup set restore channel c4: using network backup
set from service orcl channel c4: specifying datafile(s) to restore
from backup set channel c4: restoring datafile 00081 to
/home/oracle/app/oracle/oradata/orcl/pdborcl/pdbtest_qhl002_1.dbf
channel c4: restore complete, elapsed time: 00:00:04 channel c4:
starting datafile backup set restore channel c4: using network backup
set from service orcl channel c4: specifying datafile(s) to restore
from backup set channel c4: restoring datafile 00082 to
/home/oracle/app/oracle/oradata/orcl/pdborcl/pdbtest_qhl002_2.dbf
channel c5: restore complete, elapsed time: 00:00:07 channel c4:
restore complete, elapsed time: 00:00:03 channel c6: restore complete,
elapsed time: 00:00:51 Finished restore at 26-11月-19

sql statement: alter system archive log current current log archived

contents of Memory Script: { restore clone force from service
‘orcl’
archivelog from scn 49141009; switch clone datafile all; } executing Memory Script

Starting restore at 26-11月-19

channel c4: starting archived log restore to default destination
channel c4: using network backup set from service orcl channel c4:
restoring archived log archived log thread=1 sequence=1635 channel c5:
starting archived log restore to default destination channel c5: using
network backup set from service orcl channel c5: restoring archived
log archived log thread=1 sequence=1636 channel c4: restore complete,
elapsed time: 00:00:01 channel c5: restore complete, elapsed time:
00:00:01 Finished restore at 26-11月-19

datafile 1 switched to datafile copy input datafile copy RECID=22
STAMP=1025370182 file
name=/home/oracle/app/oracle/oradata/orcl/system01.dbf datafile 3
switched to datafile copy input datafile copy RECID=23
STAMP=1025370182 file
name=/home/oracle/app/oracle/oradata/orcl/sysaux01.dbf datafile 4
switched to datafile copy input datafile copy RECID=24
STAMP=1025370182 file
name=/home/oracle/app/oracle/oradata/orcl/undotbs01.dbf datafile 5
switched to datafile copy input datafile copy RECID=25
STAMP=1025370182 file
name=/home/oracle/app/oracle/oradata/orcl/pdbseed/system01.dbf
datafile 6 switched to datafile copy input datafile copy RECID=26
STAMP=1025370182 file
name=/home/oracle/app/oracle/oradata/orcl/users01.dbf datafile 7
switched to datafile copy input datafile copy RECID=27
STAMP=1025370183 file
name=/home/oracle/app/oracle/oradata/orcl/pdbseed/sysaux01.dbf
datafile 8 switched to datafile copy input datafile copy RECID=28
STAMP=1025370183 file
name=/home/oracle/app/oracle/oradata/orcl/pdborcl/system01.dbf
datafile 9 switched to datafile copy input datafile copy RECID=29
STAMP=1025370183 file
name=/home/oracle/app/oracle/oradata/orcl/pdborcl/sysaux01.dbf
datafile 10 switched to datafile copy input datafile copy RECID=30
STAMP=1025370183 file
name=/home/oracle/app/oracle/oradata/orcl/pdborcl/SAMPLE_SCHEMA_users01.dbf
datafile 11 switched to datafile copy input datafile copy RECID=31
STAMP=1025370183 file
name=/home/oracle/app/oracle/oradata/orcl/pdborcl/example01.dbf
datafile 12 switched to datafile copy input datafile copy RECID=32
STAMP=1025370183 file
name=/home/oracle/app/oracle/oradata/orcl/pdborcl/pdbtest_users02_1.dbf
datafile 13 switched to datafile copy input datafile copy RECID=33
STAMP=1025370183 file
name=/home/oracle/app/oracle/oradata/orcl/pdborcl/pdbtest_users02_2.dbf
datafile 16 switched to datafile copy input datafile copy RECID=34
STAMP=1025370183 file
name=/home/oracle/app/oracle/oradata/orcl/pdborcl/pdbtest_users02_3.dbf
datafile 17 switched to datafile copy input datafile copy RECID=35
STAMP=1025370183 file
name=/home/oracle/app/oracle/oradata/orcl/pdborcl/pdbtest_users02_4.dbf
datafile 77 switched to datafile copy input datafile copy RECID=36
STAMP=1025370183 file
name=/home/oracle/app/oracle/oradata/orcl/pdborcl/pdbtest_users03_1.dbf
datafile 78 switched to datafile copy input datafile copy RECID=37
STAMP=1025370183 file
name=/home/oracle/app/oracle/oradata/orcl/pdborcl/pdbtest_users03_2.dbf
datafile 79 switched to datafile copy input datafile copy RECID=38
STAMP=1025370183 file
name=/home/oracle/app/oracle/oradata/orcl/pdborcl/pdbtest_qhl001_1.dbf
datafile 80 switched to datafile copy input datafile copy RECID=39
STAMP=1025370183 file
name=/home/oracle/app/oracle/oradata/orcl/pdborcl/pdbtest_qhl001_2.dbf
datafile 81 switched to datafile copy input datafile copy RECID=40
STAMP=1025370183 file
name=/home/oracle/app/oracle/oradata/orcl/pdborcl/pdbtest_qhl002_1.dbf
datafile 82 switched to datafile copy input datafile copy RECID=41
STAMP=1025370183 file
name=/home/oracle/app/oracle/oradata/orcl/pdborcl/pdbtest_qhl002_2.dbf

contents of Memory Script: { set until scn 49142428; recover
standby clone database
delete archivelog ; } executing Memory Script

executing command: SET until clause

Starting recover at 26-11月-19

starting media recovery

archived log for thread 1 with sequence 1635 is already on disk as
file /home/oracle/arch/1_1635_865166162.arc archived log for thread 1
with sequence 1636 is already on disk as file
/home/oracle/arch/1_1636_865166162.arc archived log file
name=/home/oracle/arch/1_1635_865166162.arc thread=1 sequence=1635
archived log file name=/home/oracle/arch/1_1636_865166162.arc thread=1
sequence=1636 media recovery complete, elapsed time: 00:00:01 Finished
recover at 26-11月-19 Finished Duplicate Db at 26-11月-19

released channel: c1

released channel: c2

released channel: c3

released channel: c4

released channel: c5

released channel: c6

  1. 备库开启实时应用模式
alter database recover managed standby database disconnect;
  1. 测试
# 主库
create table ta(id number);

#备库
select * from ta;

  1. 容灾完成!
3.可能遇到的问题
  1. 查看监听是否错误
# 查看监听器命令
lsnrctl status 
# 启动监听器
lsnrctl start 
# 成功后会显示
The command completed successfully
# 停止监听器
lsnrctl stop
  1. 执行 11步时出错
  • 备库没用进入nomount 模式
# 执行一下代码
shutdown immediate
startup nomount
  1. 关机先关主机再关从机,开机先开从机再开主机

你可能感兴趣的:(oracle)