织梦CMS - 轻松建站从此开始!

欧博ABG官网-欧博官方网址-会员登入

欧博娱乐Oracle 19c DG搭建(主库RAC、备库standalone)

时间:2024-06-04 17:09来源: 作者:admin 点击: 38 次
这篇梳理一下主库不停机状态下搭建DG备库的流程。 一、环境规划 主库(RAC) 备库(standalone) 说明 db_name   xkdb   xkdb   必须一致   db_unique_name   xk

这篇梳理一下主库不停机状态下搭建DG备库的流程。

一、环境规划 主库(RAC) 备库(standalone) 说明
db_name   xkdb   xkdb   必须一致  
db_unique_name   xkdb   xkdg   必须不一致  
instance_name   xkdb   xkdg   一致不一致都行  
IP   192.168.10.101/102   192.168.10.8    
tns_name   tnsxkdb   tnsxkdg    
数据盘   +DATA   +DG_DATA    
归档盘   +CRS   +DG_REDO    

standby不用建库

二、主库设置 1. 主库是否开启归档及force logging

select log_mode,force_logging from v$database; alter database force logging;

2. 主库参数

alter system set log_archive_config='DG_CONFIG=(xkdb,xkdg)' scope=both sid='*'; alter system set log_archive_dest_1='LOCATION=+data VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=xkdb' scope=both sid='*'; alter system set log_archive_dest_2='SERVICE=tnsxkdg LGWR ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=xkdg' scope=both sid='*'; alter system set standby_file_management=auto scope=both sid='*'; alter system set fal_client='tnsxkdb' scope=both sid='*'; alter system set fal_server='tnsxkdg' scope=both sid='*'; /* 注意:以下两个参数是需要重启后生效的,欧博娱乐为了实现主库不停机,我们在duplicate的时候设置 1、db_file_name_convert 2、log_file_name_convert 另外有些教程会让修改主库的db_unique_name也是需要重启,但是该参数安装完成后就有值,欧博allbet所以没必要 */

3. TNS配置

--节点1: tnsxkdb = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.10.101)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = xkdb) ) ) tnsxkdg = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.10.8)(PORT = 1522)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = xkdb) ) ) --节点2: tnsxkdb = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.10.102)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = xkdb) ) ) tnsxkdg = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.10.8)(PORT = 1522)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = xkdb) ) )

4. 拷贝密码文件

将主库密码文件传输到备库
查询主库pw文件位置

方法1:srvctl config database -d xkdb

方法2:asmcmd 进去 pwget --dbuniquename xkdb

--grid asmcmd pwcopy +DATA/XKDB/PASSWORD/pwdxkdb.267.1099262109 /tmp/mypwfile --root scp /tmp/mypwfile 192.168.10.8:/tmp --备库 cd /tmp mv mypwfile orapwxkdg chown oracle:oinstall orapwxkdg cp orapwxkdg $ORACLE_HOME

5. 添加附加日志

redo log数量+1,注意大小一致

alter database add standby logfile thread 1 group 11 ('+DATA') size 200M; alter database add standby logfile thread 1 group 12 ('+DATA') size 200M; alter database add standby logfile thread 1 group 13 ('+DATA') size 200M;

三、备库设置 1. 创建参数文件

su - oracle cd $ORACLE_HOME/dbs vi initxkdg.ora --添加 db_name=xkdb --启动 startup nmount

2. 创建文件夹

--oracle mkdir -p /u01/app/oracle/admin/xkdg/adump

3. 静态监听

备库为什么一定要配置静态监听?
nomount状态下必须使用静态监听才能连接到实例

su - grid --监听参数文件添加名为listener1的静态监听 LISTENER1 = (DESCRIPTION_LIST = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = xkdg)(PORT = 1522)) ) ) ) SID_LIST_LISTENER1 = (SID_LIST = (SID_DESC = (GLOBAL_DBNAME = xkdb) (SID_NAME = xkdg) (ORACLE_HOME = /u01/app/oracle/product/19.0.0/dbhome_1) ) ) --启动 lsnrctl start listener1

4. TNS配置

主备库tns配置完可以分别tnsping测试通不通

--vi $ORACLE_HOME/network/admin/tnsnames.ora TNSXKDG = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.10.8)(PORT = 1522)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = xkdb) ) ) TNSXKDB = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.10.101)(PORT = 1521)) (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.10.102)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = xkdb) ) )

四、duplicate创建备库 1. duplicate脚本

--standby rman target sys/"Oracle123"@tnsxkdb auxiliary sys/"Oracle123"@tnsxkdg << EOF run { allocate channel c1 type disk; allocate channel c2 type disk; allocate channel c3 type disk; allocate channel c4 type disk; allocate channel c5 type disk; allocate channel c6 type disk; allocate channel c7 type disk; allocate channel c8 type disk; allocate auxiliary channel s1 type disk; allocate auxiliary channel s2 type disk; allocate auxiliary channel s3 type disk; allocate auxiliary channel s4 type disk; allocate auxiliary channel s5 type disk; allocate auxiliary channel s6 type disk; allocate auxiliary channel s7 type disk; allocate auxiliary channel s8 type disk; duplicate target database for standby from active database nofilenamecheck dorecover spfile parameter_value_convert 'xkdb','xkdg','+DATA','+DG_DATA','+CRS','+DG_REDO' set db_name='XKDB' set db_unique_name='xkdg' set db_create_file_dest='+DG_DATA' set db_create_online_log_dest_1='+DG_REDO' set cluster_database='FALSE' set fal_server='tnsxkdb' set remote_listener='' set local_listener='' set standby_file_management='AUTO' set log_archive_dest_1='LOCATION=+DG_DATA VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=xkdg' set log_archive_dest_2='SERVICE=tnsxkdb LGWR ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=xkdb' set control_files='+DG_DATA' set db_file_name_convert='+DATA','+DG_DATA' set log_file_name_convert='+CRS','+DG_REDO' set instance_name='xkdg' ; } EOF

执行过程太长折叠 using target database control file instead of recovery catalog allocated channel: c1 channel c1: SID=150 instance=xkdb2 device type=DISK

allocated channel: c2
channel c2: SID=31 instance=xkdb2 device type=DISK

allocated channel: c3
channel c3: SID=155 instance=xkdb2 device type=DISK

allocated channel: c4
channel c4: SID=400 instance=xkdb2 device type=DISK

allocated channel: c5
channel c5: SID=33 instance=xkdb2 device type=DISK

allocated channel: c6
channel c6: SID=152 instance=xkdb2 device type=DISK

allocated channel: c7
channel c7: SID=285 instance=xkdb2 device type=DISK

allocated channel: c8
channel c8: SID=411 instance=xkdb2 device type=DISK

allocated channel: s1
channel s1: SID=150 device type=DISK

allocated channel: s2
channel s2: SID=294 device type=DISK

allocated channel: s3
channel s3: SID=435 device type=DISK

allocated channel: s4
channel s4: SID=11 device type=DISK

allocated channel: s5
channel s5: SID=151 device type=DISK

allocated channel: s6
channel s6: SID=295 device type=DISK

allocated channel: s7
channel s7: SID=436 device type=DISK

allocated channel: s8
channel s8: SID=152 device type=DISK

Starting Duplicate Db at 2022-03-16 14:40:53
current log archived

contents of Memory Script:
{
backup as copy reuse
passwordfile auxiliary format ‘/u01/app/oracle/product/19.0.0/dbhome_1/dbs/orapwxkdg’ ;
restore clone from service ‘tnsxkdb’ spfile to
‘/u01/app/oracle/product/19.0.0/dbhome_1/dbs/spfilexkdg.ora’;
sql clone “alter system set spfile= ‘’/u01/app/oracle/product/19.0.0/dbhome_1/dbs/spfilexkdg.ora’’”;
}
executing Memory Script

Starting backup at 2022-03-16 14:40:54
Finished backup at 2022-03-16 14:40:57

Starting restore at 2022-03-16 14:40:57

channel s1: starting datafile backup set restore
channel s1: using network backup set from service tnsxkdb
channel s1: restoring SPFILE
output file name=/u01/app/oracle/product/19.0.0/dbhome_1/dbs/spfilexkdg.ora
channel s1: restore complete, elapsed time: 00:00:01
Finished restore at 2022-03-16 14:41:01

sql statement: alter system set spfile= ‘’/u01/app/oracle/product/19.0.0/dbhome_1/dbs/spfilexkdg.ora’’

contents of Memory Script:
{
sql clone “alter system set audit_file_dest =
‘’/u01/app/oracle/admin/xkdg/adump’’ comment=
‘’’’ scope=spfile”;
sql clone “alter system set dispatchers =
‘’(PROTOCOL=TCP) (SERVICE=xkdgXDB)’’ comment=
‘’’’ scope=spfile”;
sql clone “alter system set fal_client =
‘‘tnsxkdg’’ comment=
‘’’’ scope=spfile”;
sql clone “alter system set db_name =
‘‘XKDB’’ comment=
‘’’’ scope=spfile”;
sql clone “alter system set db_unique_name =
‘‘xkdg’’ comment=
‘’’’ scope=spfile”;
sql clone “alter system set db_create_file_dest =
‘’+DG_DATA’’ comment=
‘’’’ scope=spfile”;
sql clone “alter system set db_create_online_log_dest_1 =
‘’+DG_REDO’’ comment=
‘’’’ scope=spfile”;
sql clone “alter system set cluster_database =
FALSE comment=
‘’’’ scope=spfile”;
sql clone “alter system set fal_server =
‘‘tnsxkdb’’ comment=
‘’’’ scope=spfile”;
sql clone “alter system set remote_listener =
‘’’’ comment=
‘’’’ scope=spfile”;
sql clone “alter system set local_listener =
‘’’’ comment=
‘’’’ scope=spfile”;
sql clone “alter system set standby_file_management =
‘‘AUTO’’ comment=
‘’’’ scope=spfile”;
sql clone “alter system set log_archive_dest_1 =
‘‘LOCATION=+DG_REDO VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=xkdg’’ comment=
‘’’’ scope=spfile”;
sql clone “alter system set log_archive_dest_2 =
‘‘SERVICE=tnsxkdb LGWR ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=xkdb’’ comment=
‘’’’ scope=spfile”;
sql clone “alter system set control_files =
‘’+DG_DATA’’ comment=
‘’’’ scope=spfile”;
sql clone “alter system set db_file_name_convert =
‘’+DATA’’, ‘’+DG_DATA’’ comment=
‘’’’ scope=spfile”;
sql clone “alter system set log_file_name_convert =
‘’+CRS’’, ‘’+DG_REDO’’ comment=
‘’’’ scope=spfile”;
sql clone “alter system set instance_name =
‘‘xkdg’’ comment=
‘’’’ scope=spfile”;
shutdown clone immediate;
startup clone nomount;
}
executing Memory Script

sql statement: alter system set audit_file_dest = ‘’/u01/app/oracle/admin/xkdg/adump’’ comment= ‘’’’ scope=spfile

sql statement: alter system set dispatchers = ‘’(PROTOCOL=TCP) (SERVICE=xkdgXDB)’’ comment= ‘’’’ scope=spfile

sql statement: alter system set fal_client = ‘‘tnsxkdg’’ comment= ‘’’’ scope=spfile

sql statement: alter system set db_name = ‘‘XKDB’’ comment= ‘’’’ scope=spfile

sql statement: alter system set db_unique_name = ‘‘xkdg’’ comment= ‘’’’ scope=spfile

sql statement: alter system set db_create_file_dest = ‘’+DG_DATA’’ comment= ‘’’’ scope=spfile

sql statement: alter system set db_create_online_log_dest_1 = ‘’+DG_REDO’’ comment= ‘’’’ scope=spfile

sql statement: alter system set cluster_database = FALSE comment= ‘’’’ scope=spfile

sql statement: alter system set fal_server = ‘‘tnsxkdb’’ comment= ‘’’’ scope=spfile

sql statement: alter system set remote_listener = ‘’’’ comment= ‘’’’ scope=spfile

sql statement: alter system set local_listener = ‘’’’ comment= ‘’’’ scope=spfile

sql statement: alter system set standby_file_management = ‘‘AUTO’’ comment= ‘’’’ scope=spfile

sql statement: alter system set log_archive_dest_1 = ‘‘LOCATION=+DG_REDO VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=xkdg’’ comment= ‘’’’ scope=spfile

sql statement: alter system set log_archive_dest_2 = ‘‘SERVICE=tnsxkdb LGWR ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=xkdb’’ comment= ‘’’’ scope=spfile

sql statement: alter system set control_files = ‘’+DG_DATA’’ comment= ‘’’’ scope=spfile

sql statement: alter system set db_file_name_convert = ‘’+DATA’’, ‘’+DG_DATA’’ comment= ‘’’’ scope=spfile

sql statement: alter system set log_file_name_convert = ‘’+CRS’’, ‘’+DG_REDO’’ comment= ‘’’’ scope=spfile

sql statement: alter system set instance_name = ‘‘xkdg’’ comment= ‘’’’ scope=spfile

Oracle instance shut down

connected to auxiliary database (not started)
Oracle instance started

Total System Global Area 3154114128 bytes

Fixed Size 9139792 bytes
Variable Size 637534208 bytes
Database Buffers 2499805184 bytes
Redo Buffers 7634944 bytes
allocated channel: s1
channel s1: SID=130 device type=DISK
allocated channel: s2
channel s2: SID=2 device type=DISK
allocated channel: s3
channel s3: SID=137 device type=DISK
allocated channel: s4
channel s4: SID=391 device type=DISK
allocated channel: s5
channel s5: SID=15 device type=DISK
allocated channel: s6
channel s6: SID=138 device type=DISK
allocated channel: s7
channel s7: SID=265 device type=DISK
allocated channel: s8
channel s8: SID=392 device type=DISK

contents of Memory Script:
{
sql clone “alter system set control_files =
‘’+DG_DATA/XKDG/CONTROLFILE/current.271.1099492909’’ comment=
‘‘Set by RMAN’’ scope=spfile”;
restore clone from service ‘tnsxkdb’ standby controlfile;
}
executing Memory Script

sql statement: alter system set control_files = ‘’+DG_DATA/XKDG/CONTROLFILE/current.271.1099492909’’ comment= ‘‘Set by RMAN’’ scope=spfile

Starting restore at 2022-03-16 14:41:48

channel s1: starting datafile backup set restore
channel s1: using network backup set from service tnsxkdb
channel s1: restoring control file
channel s1: restore complete, elapsed time: 00:00:01
output file name=+DG_DATA/XKDG/CONTROLFILE/current.280.1099492911
Finished restore at 2022-03-16 14:41:52

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

sql statement: alter database mount standby database
RMAN-05529: warning: DB_FILE_NAME_CONVERT resulted in invalid ASM names; names changed to disk group only.

contents of Memory Script:
{
set newname for tempfile 1 to
“+DG_DATA”;
set newname for tempfile 2 to
“+DG_DATA”;
set newname for tempfile 3 to
“+DG_DATA”;
switch clone tempfile all;
set newname for datafile 1 to
“+DG_DATA”;
set newname for datafile 2 to
“+DG_DATA”;
set newname for datafile 3 to
“+DG_DATA”;
set newname for datafile 4 to
“+DG_DATA”;
set newname for datafile 5 to
“+DG_DATA”;
set newname for datafile 6 to
“+DG_DATA”;
set newname for datafile 7 to
“+DG_DATA”;
set newname for datafile 8 to
“+DG_DATA”;
set newname for datafile 9 to
“+DG_DATA”;
set newname for datafile 10 to
“+DG_DATA”;
set newname for datafile 11 to
“+DG_DATA”;
set newname for datafile 12 to
“+DG_DATA”;
set newname for datafile 13 to
“+DG_DATA”;
restore
from nonsparse from service
‘tnsxkdb’ 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 1 to +DG_DATA in control file
renamed tempfile 2 to +DG_DATA in control file
renamed tempfile 3 to +DG_DATA 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

Starting restore at 2022-03-16 14:41:59

channel s1: starting datafile backup set restore
channel s1: using network backup set from service tnsxkdb
channel s1: specifying datafile(s) to restore from backup set
channel s1: restoring datafile 00001 to +DG_DATA
channel s2: starting datafile backup set restore
channel s2: using network backup set from service tnsxkdb
channel s2: specifying datafile(s) to restore from backup set
channel s2: restoring datafile 00002 to +DG_DATA
channel s3: starting datafile backup set restore
channel s3: using network backup set from service tnsxkdb
channel s3: specifying datafile(s) to restore from backup set
channel s3: restoring datafile 00003 to +DG_DATA
channel s4: starting datafile backup set restore
channel s4: using network backup set from service tnsxkdb
channel s4: specifying datafile(s) to restore from backup set
channel s4: restoring datafile 00004 to +DG_DATA
channel s5: starting datafile backup set restore
channel s5: using network backup set from service tnsxkdb
channel s5: specifying datafile(s) to restore from backup set
channel s5: restoring datafile 00005 to +DG_DATA
channel s6: starting datafile backup set restore
channel s6: using network backup set from service tnsxkdb
channel s6: specifying datafile(s) to restore from backup set
channel s6: restoring datafile 00006 to +DG_DATA
channel s7: starting datafile backup set restore
channel s7: using network backup set from service tnsxkdb
channel s7: specifying datafile(s) to restore from backup set
channel s7: restoring datafile 00007 to +DG_DATA
channel s8: starting datafile backup set restore
channel s8: using network backup set from service tnsxkdb
channel s8: specifying datafile(s) to restore from backup set
channel s8: restoring datafile 00008 to +DG_DATA
channel s5: restore complete, elapsed time: 00:00:02
channel s5: starting datafile backup set restore
channel s5: using network backup set from service tnsxkdb
channel s5: specifying datafile(s) to restore from backup set
channel s5: restoring datafile 00009 to +DG_DATA
channel s7: restore complete, elapsed time: 00:00:02
channel s7: starting datafile backup set restore
channel s7: using network backup set from service tnsxkdb
channel s7: specifying datafile(s) to restore from backup set
channel s7: restoring datafile 00010 to +DG_DATA
channel s8: restore complete, elapsed time: 00:00:02
channel s8: starting datafile backup set restore
channel s8: using network backup set from service tnsxkdb
channel s8: specifying datafile(s) to restore from backup set
channel s8: restoring datafile 00011 to +DG_DATA
channel s4: restore complete, elapsed time: 00:00:07
channel s4: starting datafile backup set restore
channel s4: using network backup set from service tnsxkdb
channel s4: specifying datafile(s) to restore from backup set
channel s4: restoring datafile 00012 to +DG_DATA
channel s8: restore complete, elapsed time: 00:00:04
channel s8: starting datafile backup set restore
channel s8: using network backup set from service tnsxkdb
channel s8: specifying datafile(s) to restore from backup set
channel s8: restoring datafile 00013 to +DG_DATA
channel s2: restore complete, elapsed time: 00:00:10
channel s4: restore complete, elapsed time: 00:00:02
channel s8: restore complete, elapsed time: 00:00:01
channel s1: restore complete, elapsed time: 00:00:16
channel s3: restore complete, elapsed time: 00:00:15
channel s5: restore complete, elapsed time: 00:00:12
channel s6: restore complete, elapsed time: 00:00:14
channel s7: restore complete, elapsed time: 00:00:12
Finished restore at 2022-03-16 14:42:15

sql statement: alter system archive log current
current log archived

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

Starting restore at 2022-03-16 14:42:21

channel s1: starting archived log restore to default destination
channel s1: using network backup set from service tnsxkdb
channel s1: restoring archived log
archived log thread=1 sequence=50
channel s2: starting archived log restore to default destination
channel s2: using network backup set from service tnsxkdb
channel s2: restoring archived log
archived log thread=1 sequence=51
channel s3: starting archived log restore to default destination
channel s3: using network backup set from service tnsxkdb
channel s3: restoring archived log
archived log thread=2 sequence=38
channel s4: starting archived log restore to default destination
channel s4: using network backup set from service tnsxkdb
channel s4: restoring archived log
archived log thread=2 sequence=39
channel s5: starting archived log restore to default destination
channel s5: using network backup set from service tnsxkdb
channel s5: restoring archived log
archived log thread=2 sequence=40
channel s4: restore complete, elapsed time: 00:00:00
channel s1: restore complete, elapsed time: 00:00:02
channel s2: restore complete, elapsed time: 00:00:02
channel s3: restore complete, elapsed time: 00:00:01
channel s5: restore complete, elapsed time: 00:00:01
Finished restore at 2022-03-16 14:42:23

datafile 1 switched to datafile copy
input datafile copy RECID=14 STAMP=1099492943 file name=+DG_DATA/XKDG/DATAFILE/system.278.1099492921
datafile 2 switched to datafile copy
input datafile copy RECID=15 STAMP=1099492943 file name=+DG_DATA/XKDG/DA1B78DA7A70857DE053650AA8C0B956/DATAFILE/system.259.1099492921
datafile 3 switched to datafile copy
input datafile copy RECID=16 STAMP=1099492943 file name=+DG_DATA/XKDG/DATAFILE/sysaux.283.1099492921
datafile 4 switched to datafile copy
input datafile copy RECID=17 STAMP=1099492943 file name=+DG_DATA/XKDG/DA1B78DA7A70857DE053650AA8C0B956/DATAFILE/sysaux.268.1099492921
datafile 5 switched to datafile copy
input datafile copy RECID=18 STAMP=1099492943 file name=+DG_DATA/XKDG/DATAFILE/undotbs1.257.1099492921
datafile 6 switched to datafile copy
input datafile copy RECID=19 STAMP=1099492943 file name=+DG_DATA/XKDG/DA1B78DA7A70857DE053650AA8C0B956/DATAFILE/undotbs1.258.1099492923
datafile 7 switched to datafile copy
input datafile copy RECID=20 STAMP=1099492943 file name=+DG_DATA/XKDG/DATAFILE/undotbs2.256.1099492923
datafile 8 switched to datafile copy
input datafile copy RECID=21 STAMP=1099492943 file name=+DG_DATA/XKDG/DATAFILE/users.269.1099492923
datafile 9 switched to datafile copy
input datafile copy RECID=22 STAMP=1099492944 file name=+DG_DATA/XKDG/DA1C290B57902A2EE053650AA8C05C87/DATAFILE/system.279.1099492925
datafile 10 switched to datafile copy
input datafile copy RECID=23 STAMP=1099492944 file name=+DG_DATA/XKDG/DA1C290B57902A2EE053650AA8C05C87/DATAFILE/sysaux.262.1099492925
datafile 11 switched to datafile copy
input datafile copy RECID=24 STAMP=1099492944 file name=+DG_DATA/XKDG/DA1C290B57902A2EE053650AA8C05C87/DATAFILE/undotbs1.275.1099492925
datafile 12 switched to datafile copy
input datafile copy RECID=25 STAMP=1099492944 file name=+DG_DATA/XKDG/DA1C290B57902A2EE053650AA8C05C87/DATAFILE/undo_2.274.1099492929
datafile 13 switched to datafile copy
input datafile copy RECID=26 STAMP=1099492944 file name=+DG_DATA/XKDG/DA1C290B57902A2EE053650AA8C05C87/DATAFILE/users.276.1099492929

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

executing command: SET until clause

Starting recover at 2022-03-16 14:42:24

starting media recovery

archived log for thread 1 with sequence 50 is already on disk as file +DG_REDO/XKDG/ARCHIVELOG/2022_03_16/thread_1_seq_50.274.1099492943
archived log for thread 1 with sequence 51 is already on disk as file +DG_REDO/XKDG/ARCHIVELOG/2022_03_16/thread_1_seq_51.271.1099492943
archived log for thread 2 with sequence 39 is already on disk as file +DG_REDO/XKDG/ARCHIVELOG/2022_03_16/thread_2_seq_39.273.1099492943
archived log for thread 2 with sequence 40 is already on disk as file +DG_REDO/XKDG/ARCHIVELOG/2022_03_16/thread_2_seq_40.275.1099492943
archived log file name=+DG_REDO/XKDG/ARCHIVELOG/2022_03_16/thread_1_seq_50.274.1099492943 thread=1 sequence=50
archived log file name=+DG_REDO/XKDG/ARCHIVELOG/2022_03_16/thread_2_seq_39.273.1099492943 thread=2 sequence=39
archived log file name=+DG_REDO/XKDG/ARCHIVELOG/2022_03_16/thread_2_seq_40.275.1099492943 thread=2 sequence=40
archived log file name=+DG_REDO/XKDG/ARCHIVELOG/2022_03_16/thread_1_seq_51.271.1099492943 thread=1 sequence=51
media recovery complete, elapsed time: 00:00:02
Finished recover at 2022-03-16 14:42:27

contents of Memory Script:
{
delete clone force archivelog all;
}
executing Memory Script

deleted archived log
archived log file name=+DG_REDO/XKDG/ARCHIVELOG/2022_03_16/thread_1_seq_51.271.1099492943 RECID=2 STAMP=1099492942
Deleted 1 objects

deleted archived log
archived log file name=+DG_REDO/XKDG/ARCHIVELOG/2022_03_16/thread_2_seq_38.272.1099492943 RECID=4 STAMP=1099492942
Deleted 1 objects

deleted archived log
archived log file name=+DG_REDO/XKDG/ARCHIVELOG/2022_03_16/thread_1_seq_50.274.1099492943 RECID=3 STAMP=1099492942
Deleted 1 objects

deleted archived log
archived log file name=+DG_REDO/XKDG/ARCHIVELOG/2022_03_16/thread_2_seq_39.273.1099492943 RECID=1 STAMP=1099492942
Deleted 1 objects

deleted archived log
archived log file name=+DG_REDO/XKDG/ARCHIVELOG/2022_03_16/thread_2_seq_40.275.1099492943 RECID=5 STAMP=1099492942
Deleted 1 objects

Finished Duplicate Db at 2022-03-16 14:42:30

sql statement: ALTER DATABASE RECOVER MANAGED STANDBY DATABASE DISCONNECT
released channel: c1
released channel: c2
released channel: c3
released channel: c4
released channel: c5
released channel: c6
released channel: c7
released channel: c8
released channel: s1
released channel: s2
released channel: s3
released channel: s4
released channel: s5
released channel: s6
released channel: s7
released channel: s8

RMAN>

2.备库状态查看

duplicate完成,登陆备库查看状态,执行open

SQL> show pdbs; CON_ID CON_NAME OPEN MODE RESTRICTED ---------- ------------------------------ ---------- ---------- 2 PDB$SEED MOUNTED 3 TEST01 MOUNTED SQL> alter database open; Database altered. SQL> show pdbs; CON_ID CON_NAME OPEN MODE RESTRICTED ---------- ------------------------------ ---------- ---------- 2 PDB$SEED READ ONLY NO 3 TEST01 MOUNTED

3. 备库添加standby redo log

alter database add standby logfile thread 1 group 11 ('+DG_DATA') size 200M; alter database add standby logfile thread 1 group 12 ('+DG_DATA') size 200M; alter database add standby logfile thread 1 group 13 ('+DG_DATA') size 200M; alter database add standby logfile thread 2 group 14 ('+DG_DATA') size 200M; alter database add standby logfile thread 2 group 15 ('+DG_DATA') size 200M; alter database add standby logfile thread 2 group 16 ('+DG_DATA') size 200M;

五、开启同步

19c的开启同步命令与11g有变化,但是原先命令也兼容

--实时同步 alter database recover managed standby database disconnect; --日志切换才同步 alter database recover managed standby database using archived logfile disconnect; --取消同步 alter database recover managed standby database cancel; --查看状态 select name,open_mode,database_role,protection_mode,protection_level from v$database;

六、需要注意的

建完备库,发现能够正常登陆使用,但是在集群资源里没有db服务,执行下方命令加入集群资源

--详细看-h srvctl add database -db xkdg -o /u01/app/oracle/product/19.0.0/dbhome_1 -spfile /u01/app/oracle/product/19.0.0/dbhome_1/dbs/spfilexkdg.ora -role PHYSICAL_STANDBY -pwfile /u01/app/oracle/product/19.0.0/dbhome_1/dbs/orapwxkdg -instance xkdg

另外:
1、不加入集群资源,不能用dbca -silent删库
2、正常dbca静默建库能加入集群资源

透明2.png

透明背景.png

(责任编辑:)
------分隔线----------------------------
发表评论
请自觉遵守互联网相关的政策法规,严禁发布色情、暴力、反动的言论。
评价:
表情:
用户名: 验证码:
发布者资料
查看详细资料 发送留言 加为好友 用户等级: 注册时间:2024-12-22 18:12 最后登录:2024-12-22 18:12
栏目列表
推荐内容