Oracle 19c RAC to RAC DataGuard (ADG) 实施详细信息
本文详细介绍ORACLE 19C RAC集群到RAC集群的DataGuard 配置步骤
系统IP配置
[oracle@ora19c-pdb1:/home/oracle]$cat /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
#ora19c-pridb
172.16.108.219 openfiler
172.16.108.154 ora19c-pdb1
172.16.108.155 ora19c-pvip1
10.10.10.155 ora19c-ppriv1
172.16.108.156 ora19c-pdb2
172.16.108.157 ora19c-pvip2
10.10.10.157 ora19c-ppriv2
172.16.108.158 ora19c-pscan
#ora19c-stddb
172.16.108.202 ora19c-sdb1
172.16.108.203 ora19c-svip1
10.10.10.203 ora19c-spriv1
172.16.108.204 ora19c-sdb2
172.16.108.205 ora19c-svip2
10.10.10.205 ora19c-spriv2
172.16.108.206 ora19c-sscan
主备库数据库配置信息
主库
[oracle@ora19c-pdb1:/home/oracle]$srvctl config database -d primarydb
Database unique name: primarydb
Database name: primaryd
Oracle home: /u01/app/oracle/product/19.0.0/db_1
Oracle user: oracle
Spfile: +ORADATA/PRIMARYDB/PARAMETERFILE/spfile.256.1018264155
Password file: +oradata/PRIMARYDB/PASSWORD/pwdprimarydb.288.1018264613
Domain:
Start options: open
Stop options: immediate
Database role: PRIMARY
Management policy: AUTOMATIC
Server pools:
Disk Groups: RECOVER,ORADATA
Mount point paths:
Services:
Type: RAC
Start concurrency:
Stop concurrency:
OSDBA group: dba
OSOPER group: oper
Database instances: ora19c1,ora19c2
Configured nodes: ora19c-pdb1,ora19c-pdb2
CSS critical: no
CPU count: 0
Memory target: 0
Maximum memory: 0
Default network number for database services:
Database is administrator managed
备库
[oracle@ora19c-sdb1:/home/oracle]$srvctl config database -d standbydb
Database unique name: standbydb
Database name: primaryd
Oracle home: /u01/app/oracle/product/19.0.0/db_1
Oracle user: oracle
Spfile: +oradata/standbydb/PARAMETERFILE/spfile.374.1018532261
Password file: +ORADATA/ASM/PASSWORD/pwdasm.362.1018532119
Domain:
Start options: read only
Stop options: immediate
Database role: PHYSICAL_STANDBY
Management policy: AUTOMATIC
Server pools:
Disk Groups: ORADATA,RECOVER
Mount point paths:
Services:
Type: RAC
Start concurrency:
Stop concurrency:
OSDBA group: dba
OSOPER group: oper
Database instances: ora19c1,ora19c2
Configured nodes: ora19c-sdb1,ora19c-sdb2
CSS critical: no
CPU count: 0
Memory target: 0
Maximum memory: 0
Default network number for database services:
Database is administrator managed
SPFILE文件配置
主库
[oracle@ora19c-pdb1:/home/oracle]$cat 19c-primarydb.ora
ora19c2.__data_transfer_cache_size=0
ora19c1.__data_transfer_cache_size=0
ora19c2.__db_cache_size=3841982464
ora19c1.__db_cache_size=3825205248
ora19c2.__inmemory_ext_roarea=0
ora19c1.__inmemory_ext_roarea=0
ora19c2.__inmemory_ext_rwarea=0
ora19c1.__inmemory_ext_rwarea=0
ora19c2.__java_pool_size=0
ora19c1.__java_pool_size=0
ora19c2.__large_pool_size=117440512
ora19c1.__large_pool_size=117440512
ora19c1.__oracle_base='/u01/app/oracle'#ORACLE_BASE set from environment
ora19c2.__oracle_base='/u01/app/oracle'#ORACLE_BASE set from environment
ora19c2.__pga_aggregate_target=1694498816
ora19c1.__pga_aggregate_target=1694498816
ora19c2.__sga_target=5049942016
ora19c1.__sga_target=5049942016
ora19c2.__shared_io_pool_size=134217728
ora19c1.__shared_io_pool_size=134217728
ora19c2.__shared_pool_size=939524096
ora19c1.__shared_pool_size=956301312
ora19c2.__streams_pool_size=0
ora19c1.__streams_pool_size=0
ora19c2.__unified_pga_pool_size=0
ora19c1.__unified_pga_pool_size=0
*.audit_file_dest='/u01/app/oracle/admin/primarydb/adump'
*.audit_trail='db'
*.cluster_database=true
*.compatible='19.0.0'
*.control_files='+ORADATA/PRIMARYDB/CONTROLFILE/current.261.1018184563','+RECOVER/PRIMARYDB/CONTROLFILE/current.256.1018184563'
*.db_block_size=8192
*.db_create_file_dest='+ORADATA'
*.db_file_name_convert='PRIMARYDB','STANDBYDB'
*.db_name='primaryd'
*.db_recovery_file_dest='+RECOVER'
*.db_recovery_file_dest_size=13332m
*.db_unique_name='primarydb'
ora19c1.dg_broker_config_file1='+ORADATA/dgmgr/ora19c1.dat'
ora19c2.dg_broker_config_file1='+ORADATA/dgmgr/ora19c1.dat'
ora19c1.dg_broker_config_file2='+RECOVER/dgmgr/ora19c2.dat'
ora19c2.dg_broker_config_file2='+RECOVER/dgmgr/ora19c2.dat'
*.dg_broker_start=TRUE
*.diagnostic_dest='/u01/app/oracle'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=ora19cXDB)'
*.enable_pluggable_database=true
*.fal_client='primarydb'
*.fal_server=''
family:dw_helper.instance_mode='read-only'
ora19c2.instance_number=2
ora19c1.instance_number=1
*.local_listener='-oraagent-dummy-'
*.log_archive_config='dg_config=(primarydb,standbydb)'
*.log_archive_dest_1='LOCATION=USE_DB_RECOVERY_FILE_DEST VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=primarydb'
*.log_archive_dest_2='service="standbydb"','ASYNC NOAFFIRM delay=0 optional compression=disable max_failure=0 reopen=300 db_unique_name="standbydb" net_timeout=30','valid_for=(online_logfile,all_roles)'
*.log_archive_dest_state_2='ENABLE'
*.log_archive_format='%t_%s_%r.dbf'
*.log_file_name_convert='PRIMARYDB','STANDBYDB'
*.nls_language='AMERICAN'
*.nls_territory='CHINA'
*.open_cursors=300
*.pga_aggregate_target=1605m
*.processes=960
*.remote_login_passwordfile='exclusive'
*.sga_target=4812m
*.standby_file_management='AUTO'
ora19c2.thread=2
ora19c1.thread=1
ora19c2.undo_tablespace='UNDOTBS2'
ora19c1.undo_tablespace='UNDOTBS1'
[oracle@ora19c-pdb1:/home/oracle]$
备库
[oracle@ora19c-sdb1:/home/oracle]$cat 19c-standbydb.ora
ora19c2.__data_transfer_cache_size=0
ora19c1.__data_transfer_cache_size=0
ora19c2.__db_cache_size=3841982464
ora19c1.__db_cache_size=3841982464
ora19c2.__inmemory_ext_roarea=0
ora19c1.__inmemory_ext_roarea=0
ora19c2.__inmemory_ext_rwarea=0
ora19c1.__inmemory_ext_rwarea=0
ora19c2.__java_pool_size=0
ora19c1.__java_pool_size=0
ora19c2.__large_pool_size=117440512
ora19c1.__large_pool_size=117440512
ora19c1.__oracle_base='/u01/app/oracle'#ORACLE_BASE set from environment
ora19c2.__oracle_base='/u01/app/oracle'#ORACLE_BASE set from environment
ora19c2.__pga_aggregate_target=1694498816
ora19c1.__pga_aggregate_target=1694498816
ora19c2.__sga_target=5049942016
ora19c1.__sga_target=5049942016
ora19c2.__shared_io_pool_size=134217728
ora19c1.__shared_io_pool_size=134217728
ora19c2.__shared_pool_size=939524096
ora19c1.__shared_pool_size=939524096
ora19c2.__streams_pool_size=0
ora19c1.__streams_pool_size=0
ora19c2.__unified_pga_pool_size=0
ora19c1.__unified_pga_pool_size=0
*.audit_file_dest='/u01/app/oracle/admin/standbydb/adump'
*.audit_trail='db'
*.cluster_database=true
*.compatible='19.0.0'
*.control_files='+ORADATA/STANDBYDB/CONTROLFILE/current.371.1018533407','+RECOVER/STANDBYDB/CONTROLFILE/current.299.1018533407'#Restore Controlfile
*.db_block_size=8192
*.db_create_file_dest='+ORADATA'
*.db_file_name_convert='PRIMARYDB','STANDBYDB'
*.db_name='primaryd'
*.db_recovery_file_dest_size=13332m
*.db_recovery_file_dest='+RECOVER'
*.db_unique_name='standbydb'
ora19c1.dg_broker_config_file1='+ORADATA/dgmgr/ora19c1.dat'
ora19c2.dg_broker_config_file1='+ORADATA/dgmgr/ora19c1.dat'
ora19c1.dg_broker_config_file2='+RECOVER/dgmgr/ora19c2.dat'
ora19c2.dg_broker_config_file2='+RECOVER/dgmgr/ora19c2.dat'
*.dg_broker_start=TRUE
*.diagnostic_dest='/u01/app/oracle'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=ora19cXDB)'
*.enable_pluggable_database=true
*.fal_client='standbydb'
*.fal_server='primarydb'
family:dw_helper.instance_mode='read-only'
ora19c2.instance_number=2
ora19c1.instance_number=1
*.local_listener='-oraagent-dummy-'
*.log_archive_config='dg_config=(standbydb,primarydb)'
*.log_archive_dest_1='LOCATION=USE_DB_RECOVERY_FILE_DEST VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=standbydb'
*.log_archive_dest_2=''
*.log_archive_dest_state_2='ENABLE'
*.log_archive_format='%t_%s_%r.dbf'
*.log_file_name_convert='PRIMARYDB','STANDBYDB'
*.nls_language='AMERICAN'
*.nls_territory='CHINA'
*.open_cursors=300
*.pga_aggregate_target=1605m
*.processes=960
*.remote_login_passwordfile='exclusive'
*.sga_target=4812m
*.standby_file_management='auto'
ora19c2.thread=2
ora19c1.thread=1
ora19c2.undo_tablespace='UNDOTBS2'
ora19c1.undo_tablespace='UNDOTBS1'
[oracle@ora19c-sdb1:/home/oracle]$
监听配置-LISTENER.ORA
主库监听
[grid@ora19c-pdb1:/u01/app/19.0.0/grid/network/admin]$cat listener.ora
# listener.ora Network Configuration File: /u01/app/19.0.0/grid/network/admin/listener.ora
# Generated by Oracle configuration tools.
ENABLE_GLOBAL_DYNAMIC_ENDPOINT_LISTENER_SCAN1 = ON
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = primarydb)
(ORACLE_HOME = /u01/app/19.0.0/grid)
(SID_NAME = ora19c1)
)
(SID_DESC =
(GLOBAL_DBNAME = standbydb)
(ORACLE_HOME = /u01/app/19.0.0/grid)
(SID_NAME = ora19c1)
)
(SID_DESC =
(GLOBAL_DBNAME = primarydb_DGMGRL)
(SID_NAME = ora19c1)
(ORACLE_HOME = /u01/app/19.0.0/grid)
)
(SID_DESC =
(GLOBAL_DBNAME = standbydb_DGMGRL)
(SID_NAME = ora19c1)
(ORACLE_HOME = /u01/app/19.0.0/grid)
)
)
SID_LIST_LISTENER_SCAN1 =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = primarydb)
(SID_NAME = ora19c1)
(ORACLE_HOME = /u01/app/19.0.0/grid)
)
)
VALID_NODE_CHECKING_REGISTRATION_LISTENER_SCAN1 = OFF
VALID_NODE_CHECKING_REGISTRATION_ASMNET1LSNR_ASM = SUBNET
ASMNET1LSNR_ASM =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = ASMNET1LSNR_ASM))
)
VALID_NODE_CHECKING_REGISTRATION_LISTENER = SUBNET
LISTENER =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = LISTENER))
)
ADR_BASE_LISTENER = /u01/app/grid
ENABLE_GLOBAL_DYNAMIC_ENDPOINT_ASMNET1LSNR_ASM = ON
ENABLE_GLOBAL_DYNAMIC_ENDPOINT_LISTENER = ON
ADR_BASE_ASMNET1LSNR_ASM = /u01/app/grid
LISTENER_SCAN1 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = LISTENER_SCAN1))
)
ADR_BASE_LISTENER_SCAN1 = /u01/app/grid
[grid@ora19c-pdb1:/u01/app/19.0.0/grid/network/admin]$
备库监听
[grid@ora19c-sdb1:/u01/app/19.0.0/grid/network/admin]$cat listener.ora
# listener.ora Network Configuration File: /u01/app/19.0.0/grid/network/admin/listener.ora
# Generated by Oracle configuration tools.
ENABLE_GLOBAL_DYNAMIC_ENDPOINT_LISTENER_SCAN1 = ON
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = standbydb)
(ORACLE_HOME = /u01/app/19.0.0/grid)
(SID_NAME = ora19c1)
)
(SID_DESC =
(GLOBAL_DBNAME = primarydb)
(ORACLE_HOME = /u01/app/19.0.0/grid)
(SID_NAME = ora19c1)
)
(SID_DESC =
(GLOBAL_DBNAME = primarydb_DGMGRL)
(SID_NAME = ora19c1)
(ORACLE_HOME = /u01/app/19.0.0/grid)
)
(SID_DESC =
(GLOBAL_DBNAME = standbydb_DGMGRL)
(SID_NAME = ora19c1)
(ORACLE_HOME = /u01/app/19.0.0/grid)
)
)
SID_LIST_LISTENER_SCAN1 =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = standbydb)
(SID_NAME = ora19c1)
(ORACLE_HOME = /u01/app/19.0.0/grid)
)
)
VALID_NODE_CHECKING_REGISTRATION_LISTENER_SCAN1 = OFF
VALID_NODE_CHECKING_REGISTRATION_ASMNET1LSNR_ASM = SUBNET
ASMNET1LSNR_ASM =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = ASMNET1LSNR_ASM))
)
VALID_NODE_CHECKING_REGISTRATION_LISTENER = SUBNET
LISTENER =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = LISTENER))
)
ADR_BASE_LISTENER = /u01/app/grid
ENABLE_GLOBAL_DYNAMIC_ENDPOINT_ASMNET1LSNR_ASM = ON
ENABLE_GLOBAL_DYNAMIC_ENDPOINT_LISTENER = ON
ADR_BASE_ASMNET1LSNR_ASM = /u01/app/grid
LISTENER_SCAN1 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = LISTENER_SCAN1))
)
ADR_BASE_LISTENER_SCAN1 = /u01/app/grid
[grid@ora19c-sdb1:/u01/app/19.0.0/grid/network/admin]$
TNSNAME配置
主备库一致
[root@ora19c-pdb1 ~]# cat /u01/app/oracle/product/19.0.0/db_1/network/admin/tnsnames.ora
# tnsnames.ora Network Configuration File: /u01/app/oracle/product/19.0.0/db_1/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.
PRIMARYDB =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = ora19c-pscan)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = primarydb)
)
)
STANDBYDB =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = ora19c-sscan)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = standbydb)
)
)
PRIMARYDB1 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = ora19c-pvip1)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SID = ora19c1)
)
)
PRIMARYDB2 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = ora19c-pvip2)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SID = ora19c2)
)
)
STANDBYDB1 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = ora19c-svip1)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SID = ora19c1)
)
)
STANDBYDB2 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = ora19c-svip2)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SID = ora19c2)
)
)
[root@ora19c-pdb1 ~]#
配置过程
主库dg配置参数
[oracle@ora19c-pdb1:/home/oracle]$sqlplus / as sysdba
SQL*Plus: Release 19.0.0.0.0 - Production on Thu Sep 12 10:59:39 2019
Version 19.3.0.0.0
Copyright (c) 1982, 2019, Oracle. All rights reserved.
Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0
SQL> set line 1000
set pagesize 1000
col name format a25
col VALUE format a100
SELECT a.NAME,
i.instance_name,
a.VALUE
FROM v$parameter a, v$instance i
WHERE a.name in ('dg_broker_start','db_name','db_unique_name','log_archive_config','log_archive_dest_1','log_archive_dest_2','log_archive_dest_state_1','log_archive_dest_state_2','log_archive_max_processes','remote_login_passwordfile','db_file_name_convert','log_file_name_convert','standby_file_management','fal_server','fal_client','dg_broker_config_file1','dg_broker_config_file2')
ORDER BY a.name, i.instance_name;SQL> SQL> SQL> SQL> 2 3 4 5 6
NAME INSTANCE_NAME VALUE
------------------------- ---------------- ----------------------------------------------------------------------------------------------------
db_file_name_convert ora19c1 PRIMARYDB, STANDBYDB
db_name ora19c1 primaryd
db_unique_name ora19c1 primarydb
dg_broker_config_file1 ora19c1 +ORADATA/dgmgr/ora19c1.dat
dg_broker_config_file2 ora19c1 +RECOVER/dgmgr/ora19c2.dat
dg_broker_start ora19c1 TRUE
fal_client ora19c1 primarydb
fal_server ora19c1
log_archive_config ora19c1 dg_config=(primarydb,standbydb)
log_archive_dest_1 ora19c1 LOCATION=USE_DB_RECOVERY_FILE_DEST VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=primarydb
log_archive_dest_2 ora19c1 service="standbydb", ASYNC NOAFFIRM delay=0 optional compression=disable max_failure=0 reopen=300 db
_unique_name="standbydb" net_timeout=30, valid_for=(online_logfile,all_roles)
log_archive_dest_state_1 ora19c1 enable
log_archive_dest_state_2 ora19c1 ENABLE
log_archive_max_processes ora19c1 4
log_file_name_convert ora19c1 PRIMARYDB, STANDBYDB
remote_login_passwordfile ora19c1 EXCLUSIVE
standby_file_management ora19c1 AUTO
17 rows selected.
SQL>
备库库dg配置参数 备注:由于使用了BROCKER所以查询配置被修改,以pfile文件为准
[oracle@ora19c-sdb1:/home/oracle]$sqlplus / as sysdba
SQL*Plus: Release 19.0.0.0.0 - Production on Thu Sep 12 10:57:00 2019
Version 19.3.0.0.0
Copyright (c) 1982, 2019, Oracle. All rights reserved.
Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0
SQL>
SQL>
SQL> set line 1000
set pagesize 1000
col name format a25
col VALUE format a100
SELECT a.NAME,
i.instance_name,
a.VALUE
FROM v$parameter a, v$instance i
WHERE a.name in ('dg_broker_start','db_name','db_unique_name','log_archive_config','log_archive_dest_1','log_archive_dest_2','log_archive_dest_state_1','log_archive_dest_state_2','log_archive_max_processes','remote_login_passwordfile','db_file_name_convert','log_file_name_convert','standby_file_management','fal_server','fal_client','dg_broker_config_file1','dg_broker_config_file2')
ORDER BY a.name, i.instance_name;SQL> SQL> SQL> SQL> 2 3 4 5 6
NAME INSTANCE_NAME VALUE
------------------------- ---------------- ----------------------------------------------------------------------------------------------------
db_file_name_convert ora19c1 PRIMARYDB, STANDBYDB
db_name ora19c1 primaryd
db_unique_name ora19c1 standbydb
dg_broker_config_file1 ora19c1 +ORADATA/dgmgr/ora19c1.dat
dg_broker_config_file2 ora19c1 +RECOVER/dgmgr/ora19c2.dat
dg_broker_start ora19c1 TRUE
fal_client ora19c1 standbydb
fal_server ora19c1 primarydb
log_archive_config ora19c1 dg_config=(standbydb,primarydb)
log_archive_dest_1 ora19c1 LOCATION=USE_DB_RECOVERY_FILE_DEST VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=standbydb
log_archive_dest_2 ora19c1
log_archive_dest_state_1 ora19c1 enable
log_archive_dest_state_2 ora19c1 ENABLE
log_archive_max_processes ora19c1 4
log_file_name_convert ora19c1 PRIMARYDB, STANDBYDB
remote_login_passwordfile ora19c1 EXCLUSIVE
standby_file_management ora19c1 AUTO
17 rows selected.
SQL>
NAME INSTANCE_NAME VALUE
------------------------- ---------------- ----------------------------------------------------------------------------------------------------
#########################################################主库
db_file_name_convert ora19c1 PRIMARYDB, STANDBYDB
db_name ora19c1 primaryd
db_unique_name ora19c1 primarydb
dg_broker_config_file1 ora19c1 +ORADATA/dgmgr/ora19c1.dat
dg_broker_config_file2 ora19c1 +RECOVER/dgmgr/ora19c2.dat
dg_broker_start ora19c1 TRUE
fal_client ora19c1 primarydb
fal_server ora19c1 standbydb
log_archive_config ora19c1 dg_config=(primarydb,standbydb)
log_archive_dest_1 ora19c1 LOCATION=USE_DB_RECOVERY_FILE_DEST VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=primarydb
log_archive_dest_2 ora19c1 service=standbydb VALID_FOR=(online_logfiles,primary_role) DB_UNIQUE_NAME=standbydb
log_archive_dest_state_1 ora19c1 enable
log_archive_dest_state_2 ora19c1 enable
log_archive_max_processes ora19c1 4
log_file_name_convert ora19c1 PRIMARYDB, STANDBYDB
remote_login_passwordfile ora19c1 EXCLUSIVE
standby_file_management ora19c1 AUTO
#########################################################备库
db_file_name_convert ora19c1 PRIMARYDB, STANDBYDB
db_name ora19c1 primaryd
db_unique_name ora19c1 standbydb
dg_broker_config_file1 ora19c1 +ORADATA/dgmgr/ora19c1.dat
dg_broker_config_file2 ora19c1 +RECOVER/dgmgr/ora19c2.dat
dg_broker_start ora19c1 TRUE
fal_client ora19c1 standbydb
fal_server ora19c1 primarydb
log_archive_config ora19c1 dg_config=(primarydb,standbydb)
log_archive_dest_1 ora19c1 LOCATION=USE_DB_RECOVERY_FILE_DEST VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=standbydb
log_archive_dest_2 ora19c1 service=primarydb VALID_FOR=(online_logfiles,primary_role) DB_UNIQUE_NAME=primarydb
log_archive_dest_state_1 ora19c1 enable
log_archive_dest_state_2 ora19c1 enable
log_archive_max_processes ora19c1 4
log_file_name_convert ora19c1 PRIMARYDB, STANDBYDB
remote_login_passwordfile ora19c1 EXCLUSIVE
standby_file_management ora19c1 AUTO
添加standby log
alter database add standby logfile thread 1 group 11 ('+RECOVER','+ORADATA') size 200m;
alter database add standby logfile thread 1 group 12 ('+RECOVER','+ORADATA') size 200m;
alter database add standby logfile thread 1 group 13 ('+RECOVER','+ORADATA') size 200m;
alter database add standby logfile thread 2 group 14 ('+RECOVER','+ORADATA') size 200m;
alter database add standby logfile thread 2 group 15 ('+RECOVER','+ORADATA') size 200m;
alter database add standby logfile thread 2 group 16 ('+RECOVER','+ORADATA') size 200m;
dg参数配置查询脚本
set line 1000
set pagesize 1000
col name format a25
col VALUE format a100
SELECT a.NAME,
i.instance_name,
a.VALUE
FROM gv$parameter a, gv$instance i
WHERE a.inst_id = i.inst_id and a.name in ('dg_broker_start','db_name','db_unique_name','log_archive_config','log_archive_dest_1','log_archive_dest_2','log_archive_dest_state_1','log_archive_dest_state_2','log_archive_max_processes','remote_login_passwordfile','db_file_name_convert','log_file_name_convert','standby_file_management','fal_server','fal_client','dg_broker_config_file1','dg_broker_config_file2')
ORDER BY a.name, i.instance_name;
参数修改配置
alter system set LOG_ARCHIVE_DEST_1='LOCATION=USE_DB_RECOVERY_FILE_DEST VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=primarydb' sid='*';
alter system set LOG_ARCHIVE_DEST_2='service=standbydb VALID_FOR=(online_logfiles,primary_role) DB_UNIQUE_NAME=primarydb' sid='*';
alter system set log_archive_config='dg_config=(primarydb,standbydb)' sid='*';
alter system set db_file_name_convert='+ORADATA','+ORADATA','+RECOVER','+RECOVER' scope=spfile sid='*';
alter system set log_file_name_convert='+ORADATA','+ORADATA','+RECOVER','+RECOVER' scope=spfile sid='*';
alter system set standby_file_management=auto scope=spfile sid='*';
alter system set fal_client='primarydb' sid='*';
alter system set fal_server='standbydb' sid='*';
备库添加数据库相关操作
srvctl add database -d standbydb -o /u01/app/oracle/product/19.0.0/db_1 -n primaryd -p +oradata/standbydb/PARAMETERFILE/spfile.374.1018532261 -pwfile +ORADATA/ASM/PASSWORD/pwdasm.362.1018532119 -dbtype RAC
srvctl modify database -d standbydb -a "ORADATA,RECOVER"
srvctl add instance -d standbydb -i ora19c1 -n ora19c-sdb1
srvctl add instance -d standbydb -i ora19c2 -n ora19c-sdb2
rman target sys/oracle@primarydb auxiliary sys/oracle@standbydb
duplicate target database for standby from active database nofilenamecheck;
srvctl modify database -d standbydb -role PHYSICAL_STANDBY
srvctl modify database -d primarydb -p +ORADATA/PRIMARYDB/PARAMETERFILE/spfile.256.1018264155;
srvctl modify database -d primarydb -pwfile +oradata/PRIMARYDB/PASSWORD/pwdprimarydb.288.1018264613
srvctl add database -d standbydb -o /u01/app/oracle/product/19.0.0/db_1 -n primaryd -p +oradata/STANDBYDB/PARAMETERFILE/spfile.260.1018265063
srvctl modify database -d standbydb -a "ORADATA,RECOVER"
srvctl add instance -d standbydb -i ora19c1 -n ora19c-sdb1
srvctl add instance -d standbydb -i ora19c2 -n ora19c-sdb2
srvctl config database -d standbydb
create configuration 'ora19c_cfg' as primary database is 'primarydb' connect identifier is 'primarydb';
add database 'standbydb' as connect identifier is 'standbydb';