19c搭建dg的tips

2023年 8月 29日 69.2k 0

rman target sys/xxxx@single auxiliary sys/xxxx@single_sec;

duplicate target database for standby from active database nofilenamecheck dorecover;

select * from v$passwordfile_info;

[grid@cnsh284273 ~]$ asmcmd pwcopy +DATA_T0GBS_DG/T0GBS/PASSWORD/pwdt0gbs.256.1098378283 /tmp/orapwt0gbs
copying +DATA_T0GBS_DG/T0GBS/PASSWORD/pwdt0gbs.256.1098378283 -> /tmp/orapwt0gbs

srvctl modify database -d 备库 -p +DATADG/备库/PARAMETERFILE/spfile.297.985617259

[grid@cnsh284273 ~]$ asmcmd pwcopy +DATA_T0GBS_DG/T0GBS/PASSWORD/pwdt0gbs.256.1098378283 /tmp/orapwt0gbs
copying +DATA_T0GBS_DG/T0GBS/PASSWORD/pwdt0gbs.256.1098378283 -> /tmp/orapwt0gbs

asmcmd pwcopy /tmp/orapwt0gbs +DATA_T0GBS_DG/LT0GBS/PASSWORD/pwdlt0gbs

create spfile='+DATA_T0GBS_DG/LT0GBS/spfilet0gbs.ora' from pfile='/tmp/initt0gbs1.ora';

srvctl add database -d lt0gbs -o /paic/stg/oracle/rdbms/19c/19.10.0 -n t0gbs

srvctl add database -d lt0gbs -o /paic/stg/oracle/rdbms/19c/19.10.0 -n t0gbs
srvctl add instance -d lt0gbs -i t0gbs1 -n cnsh284285
srvctl add instance -d lt0gbs -i t0gbs2 -n cnsh284286
srvctl stop database -d lt0gbs
srvctl start database -d lt0gbs -o mount

select * from V$PWFILE_USERS;
srvctl config database -d lt0gbs --help
srvctl modify database -d lt0gbs -spfile +DATA_T0GBS_DG/LT0GBS/PARAMETERFILE/spfilet0gbs.ora -pwfile +DATA_T0GBS_DG/LT0GBS/PASSWORD/pwdlt0gbs

srvctl modify database -d lt0gbs -diskgroup DATA_T0GBS_DG,FRA_T0GBS_DG -role PHYSICAL_STANDBY
srvctl modify database -d 备库 -p +DATADG/备库/PARAMETERFILE/spfile.297.985617259

1、主库生成 create pfile='/tmp/initsgbs.ora' from spfile;
2、拷贝到备库 dscp padba@cnsz083680:/tmp/initsgbs.ora padba@cnsz383193:/tmp/initsgbs.ora
备库create spfile='+DATA_GBS_DG/LGBS/PARAMETERFILE/spfilegbs.ora' from pfile='/paic/app/oracle/rdbms/soracle/licw/initsgbs.ora';
3、拷贝密码文件
主库:asmcmd pwcopy +DATA_GBS_DG/gbs/PASSWORD/pwdgbs.9000.1109545717 /tmp/orapwgbs

备库:asmcmd pwcopy /oracle_grid/grid/licw/orapwgbs +DATA_GBS_DG/LGBS/PASSWORD/pwdlgbs

srvctl add database -d lgbs -o /paic/app/oracle/rdbms/19c/19.14.0 -n gbs
srvctl add instance -d lgbs -i gbs1 -n cnsz383193
srvctl add instance -d lgbs -i gbs2 -n cnsz383194
srvctl add instance -d lgbs -i gbs3 -n cnsz383195

srvctl modify database -d lgbs -spfile +DATA_GBS_DG/LGBS/PARAMETERFILE/spfilegbs.ora -pwfile +DATA_GBS_DG/LGBS/PASSWORD/pwdlgbs
srvctl modify database -d lgbs -diskgroup DATA_GBS_DG,FRA_GBS_DG -role PHYSICAL_STANDBY

srvctl stop database -d lgbs
srvctl start database -d lgbs -o mount

5、配置dg相关参数
同城库
alter system set db_unique_name = 'lgbs' scope= spfile;
alter system set service_names = 'gbs' scope= spfile;
alter system set cluster_interconnects='1.4.128.67' scope=spfile sid='gbs1';
alter system set cluster_interconnects='1.4.128.69' scope=spfile sid='gbs2';
alter system set cluster_interconnects='1.4.128.33' scope=spfile sid='gbs3';
alter system set local_listener='(ADDRESS=(PROTOCOL=TCP)(HOST=30.88.128.66)(PORT=1526))','(ADDRESS=(PROTOCOL=TCP)(HOST=30.88.128.66)(PORT=1527))','(ADDRESS=(PROTOCOL=TCP)(HOST=30.88.128.66)(PORT=1528))' scope=spfile sid='gbs1';
alter system set local_listener='(ADDRESS=(PROTOCOL=TCP)(HOST=30.88.128.79)(PORT=1526))','(ADDRESS=(PROTOCOL=TCP)(HOST=30.88.128.79)(PORT=1527))','(ADDRESS=(PROTOCOL=TCP)(HOST=30.88.128.79)(PORT=1528))' scope=spfile sid='gbs2';
alter system set local_listener='(ADDRESS=(PROTOCOL=TCP)(HOST=30.88.128.91)(PORT=1526))','(ADDRESS=(PROTOCOL=TCP)(HOST=30.88.128.91)(PORT=1527))','(ADDRESS=(PROTOCOL=TCP)(HOST=30.88.128.91)(PORT=1528))' scope=spfile sid='gbs3';
alter system set remote_listener='oracle15279-scan:1526' scope=spfile;

gbs,gbs.world =
(description =
(address = (protocol = tcp)(host = 10.33.30.209)(port = 1526))
(address = (protocol = tcp)(host = 10.33.31.31)(port = 1526))
(address = (protocol = tcp)(host = 10.33.30.238)(port = 1526))
(address = (protocol = tcp)(host = 10.33.30.136)(port = 1526))
(connect_data = (SERVICE_NAME = gbs.world))
)

lgbs,lgbs.world =
(description =
(address = (protocol = tcp)(host = 30.88.128.66)(port = 1526))
(address = (protocol = tcp)(host = 30.88.128.79)(port = 1526))
(address = (protocol = tcp)(host = 30.88.128.91)(port = 1526))
(connect_data = (SERVICE_NAME = gbs.world))
)

rgbs,rgbs.world =
(description =
(address = (protocol = tcp)(host = 30.64.6.229)(port = 1526))
(address = (protocol = tcp)(host = 30.64.6.231)(port = 1526))
(connect_data = (SERVICE_NAME = gbs.world))
)

alter system set fal_server = gbs scope = both;
alter system set log_archive_config = 'DG_CONFIG=(gbs,lgbs,rgbs)' scope = both;
alter system set log_archive_dest_3 = 'SERVICE=rgbs lgwr async noaffirm reopen=60 valid_for=(standby_logfiles,standby_role) db_unique_name=rgbs' scope = both;
alter system set log_archive_dest_2 = 'SERVICE=gbs lgwr async noaffirm reopen=60 valid_for=(online_logfiles,primary_role) db_unique_name=gbs' scope = both;
alter system set log_archive_dest_state_2='defer' scope=both sid='*';
alter system set log_archive_dest_state_3='enable' scope=both sid='*';
alter system set standby_file_management = auto scope = both;

主库配置
alter system set log_archive_config = 'DG_CONFIG=(gbs,lgbs,rgbs)' scope = both;
alter system set log_archive_dest_3 = 'SERVICE=lgbs lgwr async noaffirm reopen=60 valid_for=(online_logfiles,primary_role) db_unique_name=lgbs' scope = both;

gbs,gbs.world =
(description =
(address = (protocol = tcp)(host = 10.33.30.209)(port = 1526))
(address = (protocol = tcp)(host = 10.33.31.31)(port = 1526))
(address = (protocol = tcp)(host = 10.33.30.238)(port = 1526))
(address = (protocol = tcp)(host = 10.33.30.136)(port = 1526))
(connect_data = (SERVICE_NAME = gbs.world))
)

lgbs,lgbs.world =
(description =
(address = (protocol = tcp)(host = 30.88.128.66)(port = 1526))
(address = (protocol = tcp)(host = 30.88.128.79)(port = 1526))
(address = (protocol = tcp)(host = 30.88.128.91)(port = 1526))
(connect_data = (SERVICE_NAME = gbs.world))
)

rgbs,rgbs.world =
(description =
(address = (protocol = tcp)(host = 30.64.6.229)(port = 1526))
(address = (protocol = tcp)(host = 30.64.6.231)(port = 1526))
(connect_data = (SERVICE_NAME = gbs.world))
)

alter system set fal_server = lgbs scope = both;
alter system set standby_file_management = auto scope = both;

alter system set cluster_interconnects='5.5.30.109' scope=spfile sid='gbs1';
alter system set cluster_interconnects='5.5.30.206' scope=spfile sid='gbs2';
alter system set cluster_interconnects='5.5.30.228' scope=spfile sid='gbs3';
alter system set cluster_interconnects='5.5.30.208' scope=spfile sid='gbs4';

备库是nomount状态,需要配置静态监听 listener.ora

LGBS1 =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST =30.88.128.66)(PORT = 1530))
)
)
SID_LIST_LGBS1 =
(SID_LIST =
(SID_DESC =
(ORACLE_HOME = /paic/app/oracle/rdbms/19c/19.14.0)
(SID_NAME = gbs1)
)
)

再配置静态监听的连接串 tnsnames.ora (主备库都要配置上这个)
gbs1 =
(description =
(address = (protocol = tcp)(host = 10.33.30.209)(port = 1526))
(connect_data =
(sid = gbs1)
)
)

lgbs1 =
(description =
(address = (protocol = tcp)(host = 30.88.128.66)(port = 1530))
(connect_data =
(sid = gbs1)
)
)

rgbs1 =
(description =
(address = (protocol = tcp)(host = 30.64.6.229)(port = 1530))
(connect_data =
(sid = gbs1)
)
)

rman进行duplicat database
rman target sys/paic1234@gbs1 auxiliary sys/paic1234@lgbs1

duplicate target database for standby from active database nofilenamecheck dorecover;

然后就可以把备库open了

主备库都创建standby log

alter database add standby logfile thread 1 group 41 size 2048M;
alter database add standby logfile thread 1 group 42 size 2048M;
alter database add standby logfile thread 1 group 43 size 2048M;
alter database add standby logfile thread 1 group 44 size 2048M;
alter database add standby logfile thread 1 group 45 size 2048M;
alter database add standby logfile thread 1 group 46 size 2048M;
alter database add standby logfile thread 1 group 47 size 2048M;
alter database add standby logfile thread 1 group 48 size 2048M;
alter database add standby logfile thread 1 group 49 size 2048M;

alter database add standby logfile thread 2 group 51 size 2048M;
alter database add standby logfile thread 2 group 52 size 2048M;
alter database add standby logfile thread 2 group 53 size 2048M;
alter database add standby logfile thread 2 group 54 size 2048M;
alter database add standby logfile thread 2 group 55 size 2048M;
alter database add standby logfile thread 2 group 56 size 2048M;
alter database add standby logfile thread 2 group 57 size 2048M;
alter database add standby logfile thread 2 group 58 size 2048M;
alter database add standby logfile thread 2 group 59 size 2048M;

alter database add standby logfile thread 3 group 61 size 2048M;
alter database add standby logfile thread 3 group 62 size 2048M;
alter database add standby logfile thread 3 group 63 size 2048M;
alter database add standby logfile thread 3 group 64 size 2048M;
alter database add standby logfile thread 3 group 65 size 2048M;
alter database add standby logfile thread 3 group 66 size 2048M;
alter database add standby logfile thread 3 group 67 size 2048M;
alter database add standby logfile thread 3 group 68 size 2048M;
alter database add standby logfile thread 3 group 69 size 2048M;

alter database add standby logfile thread 4 group 71 size 2048M;
alter database add standby logfile thread 4 group 72 size 2048M;
alter database add standby logfile thread 4 group 73 size 2048M;
alter database add standby logfile thread 4 group 74 size 2048M;
alter database add standby logfile thread 4 group 75 size 2048M;
alter database add standby logfile thread 4 group 76 size 2048M;
alter database add standby logfile thread 4 group 77 size 2048M;
alter database add standby logfile thread 4 group 78 size 2048M;
alter database add standby logfile thread 4 group 79 size 2048M;

相关文章

Oracle如何使用授予和撤销权限的语法和示例
Awesome Project: 探索 MatrixOrigin 云原生分布式数据库
下载丨66页PDF,云和恩墨技术通讯(2024年7月刊)
社区版oceanbase安装
Oracle 导出CSV工具-sqluldr2
ETL数据集成丨快速将MySQL数据迁移至Doris数据库

发布评论