数据库管理 2023-06-05
- 第八十期 Exadata to RAC(x86) ADG
- 1 环境
- 2 搭建流程
- 2.1配置静态监听-主库
- 2.2配置静态监听-备库
- 2.3配置本地命名-主备库
- 2.4数据库配置-主库
- 2.5生成参数文件和密码文件-主库
- 2.6创建目录并上传密码文件-备库
- 2.7添加数据库服务-备库
- 2.8修改参数文件-备库
- 2.9复制数据库
- 2.10创建DG_Broker配置
- 2.11配置ADG
- 总结
第八十期 Exadata to RAC(x86) ADG
不知不觉又来到了第八个整十期。
上一期就说过,5月底就完成了之前说的Exadata和基于x86服务器RAC间ADG的灾备环境搭建,本次操作其实和一般的ADG没什么区别,主备端的节点数不一样,同时家目录配置也有些不一样。
1 环境
生产库(dbaas)- Exadata X9M-2
主机名 | 主机IP | VIP | SCANIP |
---|---|---|---|
dbadm01 | 10.10.11.204 | 10.10.11.206 | 10.10.11.208 |
dbadm02 | 10.10.11.205 | 10.10.11.207 |
灾备库(dbdg)- RAC(x86)
主机名 | 主机IP | VIP | SCANIP |
---|---|---|---|
sv419 | 10.10.10.16 | 10.10.10.20 | 10.10.10.24 |
sv420 | 10.10.10.17 | 10.10.10.21 | |
sv421 | 10.10.10.18 | 10.10.10.22 | |
sv422 | 10.10.10.19 | 10.10.10.23 |
2 搭建流程
2.1配置静态监听-主库
注:本步骤均在grid用户下执行
dbadm01:
cd /u01/app/19.0.0.0/grid/network/admin
vim listener.ora #添加以下内容
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = dbaas)
(ORACLE_HOME = /u01/app/oracle/product/19.0.0.0/dbhome_1)
(SID_NAME = dbaas1)
)
(SID_DESC =
(GLOBAL_DBNAME = dbaas_DGMGRL)
(ORACLE_HOME = /u01/app/oracle/product/19.0.0.0/dbhome_1)
(SID_NAME = dbaas1)
)
(SID_DESC =
(program = extproc)
(ORACLE_HOME = /u01/app/oracle/product/19.0.0.0/dbhome_1)
(SID_NAME = plsextproc)
)
)
SID_LIST_LISTENER_SCAN1 =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME =dbaas)
(ORACLE_HOME = /u01/app/oracle/product/19.0.0.0/dbhome_1)
(SID_NAME = dbaas1)
)
(SID_DESC =
(GLOBAL_DBNAME = dbaas_DGMGRL)
(ORACLE_HOME = /u01/app/oracle/product/19.0.0.0/dbhome_1)
(SID_NAME = dbaas1)
)
(SID_DESC =
(program = extproc)
(ORACLE_HOME = /u01/app/oracle/product/19.0.0.0/dbhome_1)
(SID_NAME = plsextproc)
)
)
dbadm02:
cd /u01/app/19.0.0.0/grid/network/admin
vim listener.ora #添加以下内容
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = dbaas)
(ORACLE_HOME = /u01/app/oracle/product/19.0.0.0/dbhome_1)
(SID_NAME = dbaas2)
)
(SID_DESC =
(GLOBAL_DBNAME = dbaas_DGMGRL)
(ORACLE_HOME = /u01/app/oracle/product/19.0.0.0/dbhome_1)
(SID_NAME = dbaas2)
)
(SID_DESC =
(program = extproc)
(ORACLE_HOME = /u01/app/oracle/product/19.0.0.0/dbhome_1)
(SID_NAME = plsextproc)
)
)
SID_LIST_LISTENER_SCAN1 =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = dbaas)
(ORACLE_HOME = /u01/app/oracle/product/19.0.0.0/dbhome_1)
(SID_NAME = dbaas2)
)
(SID_DESC =
(GLOBAL_DBNAME = dbaas_DGMGRL)
(ORACLE_HOME = /u01/app/oracle/product/19.0.0.0/dbhome_1)
(SID_NAME = dbaas2)
)
(SID_DESC =
(program = extproc)
(ORACLE_HOME = /u01/app/oracle/product/19.0.0.0/dbhome_1)
(SID_NAME = plsextproc)
)
)
静态监听配置完成后需要分节点重新加载监听配置,期间可能出现数据库访问延迟:
lsnrctl reload listener #在每个节点执行
lsnrctl reload listener_scan1 #在运行scan的节点执行
2.2配置静态监听-备库
注:本步骤均在grid用户下执行
sv419:
cd /u01/app/19.0.0/grid/network/admin
vim listener.ora #添加以下内容
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = dbdg)
(ORACLE_HOME = /u01/app/oracle/product/19.0.0/dbhome_1)
(SID_NAME = dbdg1)
)
(SID_DESC =
(GLOBAL_DBNAME = dbdg_DGMGRL)
(ORACLE_HOME = /u01/app/oracle/product/19.0.0/dbhome_1)
(SID_NAME = dbdg1)
)
(SID_DESC =
(program = extproc)
(ORACLE_HOME = /u01/app/oracle/product/19.0.0/dbhome_1)
(SID_NAME = plsextproc)
)
)
SID_LIST_LISTENER_SCAN1 =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = dbdg)
(ORACLE_HOME = /u01/app/oracle/product/19.0.0/dbhome_1)
(SID_NAME = dbdg1)
)
(SID_DESC =
(GLOBAL_DBNAME = dbdg_DGMGRL)
(ORACLE_HOME = /u01/app/oracle/product/19.0.0/dbhome_1)
(SID_NAME = dbdg1)
)
(SID_DESC =
(program = extproc)
(ORACLE_HOME = /u01/app/oracle/product/19.0.0/dbhome_1)
(SID_NAME = plsextproc)
)
)
sv420:
cd /u01/app/19.0.0/grid/network/admin
vim listener.ora #添加以下内容
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = dbdg)
(ORACLE_HOME = /u01/app/oracle/product/19.0.0/dbhome_1)
(SID_NAME = dbdg2)
)
(SID_DESC =
(GLOBAL_DBNAME = dbdg_DGMGRL)
(ORACLE_HOME = /u01/app/oracle/product/19.0.0/dbhome_1)
(SID_NAME = dbdg2)
)
(SID_DESC =
(program = extproc)
(ORACLE_HOME = /u01/app/oracle/product/19.0.0/dbhome_1)
(SID_NAME = plsextproc)
)
)
SID_LIST_LISTENER_SCAN1 =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = dbdg)
(ORACLE_HOME = /u01/app/oracle/product/19.0.0/dbhome_1)
(SID_NAME = dbdg2)
)
(SID_DESC =
(GLOBAL_DBNAME = dbdg_DGMGRL)
(ORACLE_HOME = /u01/app/oracle/product/19.0.0/dbhome_1)
(SID_NAME = dbdg2)
)
(SID_DESC =
(program = extproc)
(ORACLE_HOME = /u01/app/oracle/product/19.0.0/dbhome_1)
(SID_NAME = plsextproc)
)
)
sv421:
cd /u01/app/19.0.0/grid/network/admin
vim listener.ora #添加以下内容
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = dbdg)
(ORACLE_HOME = /u01/app/oracle/product/19.0.0/dbhome_1)
(SID_NAME = dbdg3)
)
(SID_DESC =
(GLOBAL_DBNAME = dbdg_DGMGRL)
(ORACLE_HOME = /u01/app/oracle/product/19.0.0/dbhome_1)
(SID_NAME = dbdg3)
)
(SID_DESC =
(program = extproc)
(ORACLE_HOME = /u01/app/oracle/product/19.0.0/dbhome_1)
(SID_NAME = plsextproc)
)
)
SID_LIST_LISTENER_SCAN1 =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = dbdg)
(ORACLE_HOME = /u01/app/oracle/product/19.0.0/dbhome_1)
(SID_NAME = dbdg3)
)
(SID_DESC =
(GLOBAL_DBNAME = dbdg_DGMGRL)
(ORACLE_HOME = /u01/app/oracle/product/19.0.0/dbhome_1)
(SID_NAME = dbdg3)
)
(SID_DESC =
(program = extproc)
(ORACLE_HOME = /u01/app/oracle/product/19.0.0/dbhome_1)
(SID_NAME = plsextproc)
)
)
sv422:
cd /u01/app/19.0.0/grid/network/admin
vim listener.ora #添加以下内容
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = dbdg)
(ORACLE_HOME = /u01/app/oracle/product/19.0.0/dbhome_1)
(SID_NAME = dbdg4)
)
(SID_DESC =
(GLOBAL_DBNAME = dbdg_DGMGRL)
(ORACLE_HOME = /u01/app/oracle/product/19.0.0/dbhome_1)
(SID_NAME = dbdg4)
)
(SID_DESC =
(program = extproc)
(ORACLE_HOME = /u01/app/oracle/product/19.0.0/dbhome_1)
(SID_NAME = plsextproc)
)
)
SID_LIST_LISTENER_SCAN1 =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = dbdg)
(ORACLE_HOME = /u01/app/oracle/product/19.0.0/dbhome_1)
(SID_NAME = dbdg4)
)
(SID_DESC =
(GLOBAL_DBNAME = dbdg_DGMGRL)
(ORACLE_HOME = /u01/app/oracle/product/19.0.0/dbhome_1)
(SID_NAME = dbdg4)
)
(SID_DESC =
(program = extproc)
(ORACLE_HOME = /u01/app/oracle/product/19.0.0/dbhome_1)
(SID_NAME = plsextproc)
)
)
静态监听配置完成后需要分节点重新加载监听配置:
lsnrctl reload listener #在每个节点执行
lsnrctl reload listener_scan1 #在运行scan的节点执行
2.3配置本地命名-主备库
注:本步骤均在oracle用户下执行。
主库:
cd /u01/app/oracle/product/19.0.0.0/dbhome_1/network/admin
vim tnsnames.ora #添加以下内容
dbaas =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.10.11.208)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = dbaas)
)
)
dbdg =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.10.10.24)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = dbdg)
)
)
备库:
cd /u01/app/oracle/product/19.0.0/dbhome_1/network/admin
vim tnsnames.ora #添加以下内容
dbaas =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.10.11.208)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = dbaas)
)
)
dbdg =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.10.10.24)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = dbdg)
)
)
2.4数据库配置-主库
alter database force logging;
alter system set LOG_ARCHIVE_CONFIG='DG_CONFIG=(dbaas,dbdg)' sid='*';
alter system set fal_client='dbaas' sid='*';
alter system set FAL_SERVER='dbdg' sid='*';
alter system set dg_broker_config_file1='+DATAC1/dbaas/dr1dbaas.dat' sid='*';
alter system set dg_broker_config_file2='+RECOC1/dbaas/dr2dbaas.dat' sid='*';
alter system set standby_file_management=AUTO scope=both sid='*';
alter database add standby logfile thread 1 group 31 ('+DATAC1') size 10G;
alter database add standby logfile thread 1 group 32 ('+DATAC1') size 10G;
alter database add standby logfile thread 1 group 33 ('+DATAC1') size 10G;
alter database add standby logfile thread 1 group 34 ('+DATAC1') size 10G;
alter database add standby logfile thread 1 group 35 ('+DATAC1') size 10G;
alter database add standby logfile thread 1 group 36 ('+DATAC1') size 10G;
alter database add standby logfile thread 1 group 37 ('+DATAC1') size 10G;
alter database add standby logfile thread 2 group 38 ('+DATAC1') size 10G;
alter database add standby logfile thread 2 group 39 ('+DATAC1') size 10G;
alter database add standby logfile thread 2 group 40 ('+DATAC1') size 10G;
alter database add standby logfile thread 2 group 41 ('+DATAC1') size 10G;
alter database add standby logfile thread 2 group 42 ('+DATAC1') size 10G;
alter database add standby logfile thread 2 group 43 ('+DATAC1') size 10G;
alter database add standby logfile thread 2 group 44 ('+DATAC1') size 10G;
alter database add standby logfile thread 3 group 45 ('+DATAC1') size 10G;
alter database add standby logfile thread 3 group 46 ('+DATAC1') size 10G;
alter database add standby logfile thread 3 group 47 ('+DATAC1') size 10G;
alter database add standby logfile thread 3 group 48 ('+DATAC1') size 10G;
alter database add standby logfile thread 3 group 49 ('+DATAC1') size 10G;
alter database add standby logfile thread 3 group 50 ('+DATAC1') size 10G;
alter database add standby logfile thread 3 group 51 ('+DATAC1') size 10G;
alter database add standby logfile thread 4 group 52 ('+DATAC1') size 10G;
alter database add standby logfile thread 4 group 53 ('+DATAC1') size 10G;
alter database add standby logfile thread 4 group 54 ('+DATAC1') size 10G;
alter database add standby logfile thread 4 group 55 ('+DATAC1') size 10G;
alter database add standby logfile thread 4 group 56 ('+DATAC1') size 10G;
alter database add standby logfile thread 4 group 57 ('+DATAC1') size 10G;
alter database add standby logfile thread 4 group 58 ('+DATAC1') size 10G;
注:因节点数不一样,按照节点数大的一边配置standby logfile,后期主端扩容节点超过4或备端继续增加节点也需要先添加对应的standby logfile
2.5生成参数文件和密码文件-主库
oracle用户执行:
sqlplus /as sysdba
create pfile='/home/oracle/initdbdg.ora' from spfile;
scp initdbdg.ora 10.10.10.16:~
grid用户执行:
asmcmd
asmcmd> pwcopy +DATAC1/DBAAS/PASSWORD/pwdddg.xxx.xxxxxxxxxx /home/grid/pwddbdg
asmcmd> exit
scp pwddbdg 10.10.10.16:~
2.6创建目录并上传密码文件-备库
oracle用户执行,备库所有节点执行:
mkdir -p /u01/app/oracle/audit/dbdg/
mkdir -p /u01/app/oracle/admin/dbdg/adump
grid用户执行,sv416:
asmcmd
asmcmd> mkdir +DATAC1/DBDG
asmcmd> mkdir +DATAC1/DBDG/PASSWORD
asmcmd> pwcopy /home/grid/pwddbdg +DATAC1/DBDG/PASSWORD/pwddbdg
asmcmd> exit
2.7添加数据库服务-备库
oracle用户执行,sv419:
srvctl add database -db dbdg -oraclehome $ORACLE_HOME -dbtype RAC -spfile +DATAC1/DBDG/PARAMETERFILE/spfiledbdg.ora -role PHYSICAL_STANDBY -startoption MOUNT -stopoption IMMEDIATE -dbname dbaas -diskgroup DATAC1,RECOC1
srvctl add instance -db dbdg -i dbdg1 -n sv419
srvctl add instance -db dbdg -i dbdg2 -n sv420
srvctl add instance -db dbdg -i dbdg3 -n sv421
srvctl add instance -db dbdg -i dbdg4 -n sv422
srvctl modify database -d dbdg -pwfile +DATAC1/DBDG/PASSWORD/pwddbdg
2.8修改参数文件-备库
oracle用户执行,sv416:
vim initdbdg.ora #因节点数量不同,主要对一下内容进行调整或新增
dbdg1.__oracle_base='/u01/app/oracle'#ORACLE_BASE set from environment
dbdg2.__oracle_base='/u01/app/oracle'#ORACLE_BASE set from environment
dbdg3.__oracle_base='/u01/app/oracle'#ORACLE_BASE set from environment
dbdg4.__oracle_base='/u01/app/oracle'#ORACLE_BASE set from environment
dbdg1._bct_public_dba_buffer_size=134610432#_bct_public_dba_buffer_size
dbdg2._bct_public_dba_buffer_size=134610432#_bct_public_dba_buffer_size
dbdg3._bct_public_dba_buffer_size=134610432#_bct_public_dba_buffer_size
dbdg4._bct_public_dba_buffer_size=134610432#_bct_public_dba_buffer_size
db_unique_name='dbdg' #新增
*.control_files='+DATAC1/DBDG/CONTROLFILE/current.ctl'
*.db_name='dbaas'
*.db_recovery_file_dest_size=19900G
*.dg_broker_config_file1='+DATAC1/DBDG/dr1dbdg.dat'
*.dg_broker_config_file2='+RECOC1/DBDG/dr2dbdg.dat'
*.diagnostic_dest='/u01/app/oracle'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=dbdgXDB)'
*.fal_client='dbdg'
*.fal_server='dbaas'
dbdg1.instance_number=1
dbdg2.instance_number=2
dbdg3.instance_number=3
dbdg4.instance_number=4
*.log_archive_config='DG_CONFIG=(dbdg,dbaas)'
dbdg1.thread=1
dbdg2.thread=2
dbdg3.thread=3
dbdg4.thread=4
dbdg1.undo_tablespace='UNDOTBS1'
dbdg2.undo_tablespace='UNDOTBS2'
dbdg3.undo_tablespace='UNDOTBS3'
dbdg4.undo_tablespace='UNDOTBS4'
2.9复制数据库
备库所有实例启动到nomount状态:
srvctl start database -db dbdg -o nomount
oracle用户执行:
rman target sys@dbaas auxiliary sys@dbdg
rman> duplicate target database for standby nofilenamecheck from active database;
完成复制后备库所有实例启动到mount状态:
alter database mount standby database;
主备库均执行:
alter system set dg_broker_start=true;
2.10创建DG_Broker配置
dgmgrl sys@dbaas
dgmgrl> create configuration dg as primary database is dbaas connect identifier is dbaas;
dgmgrl> add database dbdg as connect identifier is dbdg;
dgmgrl> enable configuration;
dgmgrl> show configuration; --这里先不做截图展示
2.11配置ADG
备库执行:
alter database open;
alter database recover managed standby database using current logfile disconnect;
dgmgrl sys@dbaass
dgmgrl>
edit database dbaas set property logxptmode='sync';
edit database dbdg set property logxptmode='sync';
disable configuration;
enable configuration;
show configuration;
show database dbaas;
show database dbdg;
至此ADG搭建完成。
总结
由于下周休假出去旅游,应该是不能发文,所以本周准备了3篇文章,还有两篇是关于EMCC和其升级的内容。
老规矩,知道写了些啥。