资讯专栏INFORMATION COLUMN

19C_ADG_数据网络_搭建思路

IT那活儿 / 1580人阅读
19C_ADG_数据网络_搭建思路

点击上方“IT那活儿”,关注后了解更多内容,不管IT什么活儿,干就完了!!!





配置数据网络




1. 配置监听

1.1 主库
[root@pdg ~]# su - grid
[grid@pdg ~]$ vim /oracle/19.0.0/grid/network/admin/listener.ora
LISTENER_DG =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.100.11)(PORT = 1525))
)
)
)
SID_LIST_LISTENER_DG =
(SID_LIST =
(SID_DESC =
(ORACLE_HOME = /oracle/app/oracle/product/19.0.0/dbhome_1)
(SID_NAME = test)
(GLOBAL_DBNAME = test)
)
)
开启静态监听(grid用户):
lsnrctl start LISTENER_DG

lsnrctl status LISTENER_DG
1.2 备库
LISTENER_DG =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.100.21)(PORT = 1525))
)
)
)

SID_LIST_LISTENER_DG =
(SID_LIST =
(SID_DESC =
(ORACLE_HOME = /oracle/app/oracle/product/19.0.0/dbhome_1)
(SID_NAME = test)
(GLOBAL_DBNAME = test)
)
)
开启静态监听(grid用户):
lsnrctl start LISTENER_DG

lsnrctl status LISTENER_DG
2. tns配置
2.1 主库
[root@pdg ~]# su - oracle
[oracle@pdg ~]$ vim /oracle/app/oracle/product/19.0.0/dbhome_1/network/admin/tnsnames.ora
pdg =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.100.11)(PORT = 1525))
)
(CONNECT_DATA =
(SERVICE_NAME = test)
)
)

sdg =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.100.21)(PORT = 1525))
)
(CONNECT_DATA =
(SERVICE_NAME = test)
(UR=A)
)
)
2.2 备库
[root@sdg ~]# su – oracle
[oracle@sdg ~]$ vim /oracle/app/oracle/product/19.0.0/dbhome_1/network/admin/tnsnames.ora
pdg =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.100.11)(PORT = 1525))
)
(CONNECT_DATA =
(SERVICE_NAME = test)
)
)

sdg =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.100.21)(PORT = 1525))
)
(CONNECT_DATA =
(SERVICE_NAME = test)
(UR=A)
)
)
2.3 测试tns
tnsping pdg
tnsping sdg


注:配置数据网络时提前配置好第二张网卡。







主库配置



1. 开启归档
SQL> shutdown immediate;

SQL>
 startup mount;

SQL>
 alter system set log_archive_dest_1=location=+data/arch;

SQL>
 alter database archivelog;

SQL>
 alter database open;
2. 开启强制归档
SQL> select name,log_mode,force_logging from v$database;
NAME LOG_MODE FORCE_LOGGING
--------- ------------ ---------------------------------------
TEST ARCHIVELOG NO
SQL>  alter database force logging;
Database altered.
SQL> select name,log_mode,force_logging from v$database;
NAME LOG_MODE FORCE_LOGGING
--------- ------------ ---------------------------------------
TEST ARCHIVELOG YES
3. 主库添加standby日志
alter database add standby logfile group 11 +data/test/onlinelog/stb01.log size 200M;
alter database add standby logfile group 12 +data/test/onlinelog/stb02.log size 200M;
alter database add standby logfile group 13 +data/test/onlinelog/stb03.log size 200M;
alter database add standby logfile group 14 +data/test/onlinelog/stb04.log size 200M;

SQL> select group#,bytes/1024/1024 from v$standby_log;
4. 主库修改参数
alter system set db_unique_name=test scope=spfile;
alter system set log_archive_config=dg_config=(test,sdg);
alter system set log_archive_dest_1=LOCATION=+data/arch valid_for=(all_logfiles,all_roles) db_unique_name=test;
alter system set log_archive_dest_2=service=sdg lgwr sync valid_for=(online_logfile,primary_role) db_unique_name=sdg;
alter system set log_archive_dest_state_1=enable;
alter system set log_archive_dest_state_2=enable;
alter system set fal_client=test;
alter system set fal_server=sdg;
alter system set standby_file_management=AUTO;
alter system set db_file_name_convert=+data/test/adg,+data/test/adgscope=spfile;
alter system set log_file_name_convert=+data/test/adg,+data/test/adgscope=spfile;
5. 创建pfile,传送pfile和密码文件
create pfile=/oracle/app/oracle/product/19.0.0/dbhome_1/dbs/pfile.ora

scp pfile.ora oracle@192.168.168.21: /oracle/app/oracle/product/19.0.0/dbhome_1/dbs/pfile.ora

scp orapwtest oracle@192.168.168.21: /oracle/app/oracle/product/19.0.0/dbhome_1/dbs/orapwtest






备库操作



1. 修改备库参数
*.db_file_name_convert=+data/test,+data/test
*.db_name=test
*.db_unique_name=sdg
*.fal_client=sdg
*.fal_server=test
*.log_archive_config=dg_config=(sdg,test)
*.log_archive_dest_1=LOCATION=+data/arch valid_for=(all_logfiles,all_roles) db_unique_name=sdg
*.log_archive_dest_2=service=test lgwr sync valid_for=(online_logfile,primary_role) db_unique_name=test
*.log_archive_dest_state_1=enable
*.log_archive_dest_state_2=enable
*.log_file_name_convert=+data/test,+data/test
2. 备库启动到nomount状态
SQL> startup nomount pfile=/oracle/app/oracle/product/19.0.0/dbhome_1/dbs/pfile.ora;
ORACLE instance started.
Total System Global Area 2516581464 bytes
Fixed Size 8899672 bytes
Variable Size 536870912 bytes
Database Buffers 1962934272 bytes
Redo Buffers 7876608 bytes
3. 创建与主库相同的路径
4. 测试联通性
[oracle@sdg dbs]$ rman target=sys/oracle@pdg auxiliary sys/oracle@sdg
5. 同步主库
duplicate target database for standby nofilenamecheck from active database;






启动备库



1. 开启备库
启动日志应用:
alter database recover managed standby database disconnect from session;
取消日志应用:
recover managed standby database cancel;
开启备库:
alter database open;
启动事实应用:
ALTER DATABASE recover managed standby database using current logfile disconnect;
2. 检查备库当前状态
SQL> select database_role,open_mode,switchover_status from v$database;
DATABASE_ROLE OPEN_MODE SWITCHOVER_STATUS
---------------- -------------------- --------------------
PHYSICAL STANDBY READ ONLY NOT ALLOWED




本文作者:胡晓明

本文来源:IT那活儿(上海新炬王翦团队)

文章版权归作者所有,未经允许请勿转载,若此文章存在违规行为,您可以联系管理员删除。

转载请注明本文地址:https://www.ucloud.cn/yun/129603.html

相关文章

  • 深入理解Redis系列之单机Redis环境搭建

    摘要:序言在实际开发项目过程中如果说要用到缓存那么第一个想到的一定是但是为什么选大多数人都不会去了解也不会去思考只知道它能当缓存使用比数据库快一点恰巧我也是这样的一个人所以当我想写一篇关于介绍的时候我竟然无从说起这也是对于以及主流内存数据库不熟的 showImg(https://segmentfault.com/img/bVbi2tN?w=240&h=80); 序言 在实际开发项目过程中,...

    PrototypeZ 评论0 收藏0
  • TensorFlow实战:Neural Style

    摘要:作者使用实现了,并将其开源放在了上。在年的两个问题上分别取得了第一名和第二名。的获取方式是第层,形状为,的获取方式是第层,形状为。每个卷积核可以看做是图形的一种特征抽取。相关性的描述使用余弦相似性,而余弦相似性又正比于两种特征的点积。 showImg(https://segmentfault.com/img/bVPmNA?w=1056&h=707); Neural Style是一个非常...

    stackfing 评论0 收藏0

发表评论

0条评论

IT那活儿

|高级讲师

TA的文章

阅读更多
最新活动
阅读需要支付1元查看
<