数据库管理 2023-06-05
不知不觉又来到了第八个整十期。
上一期就说过,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和其升级的内容。
老规矩,知道写了些啥。
最后修改时间:2023-06-05 09:57:10
「喜欢这篇文章,您的关注和赞赏是给作者最好的鼓励」
关注作者
【米乐app官网下载的版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。