返回顶部
首页 > 资讯 > 数据库 >ORACLE12C ADG搭建
  • 594
分享到

ORACLE12C ADG搭建

2024-04-02 19:04:59 594人浏览 独家记忆
摘要

oracle12C_DG配置主库:orcl备库:orclbk 1、/etc/hosts配置 172.16.140.3 node1172.16.140.4 node2 2、主库force logging sq

oracle12C_DG配置
主库:orcl
备库:orclbk

1、/etc/hosts配置

172.16.140.3 node1
172.16.140.4 node2

2、主库force logging

sql> select name,open_mode from v$pdbs;
SQL> alter database force logging;
SQL> select force_logging from v$database;

FORCE_LOGGING

YES

3、主库添加standby redo logfile(连接到CDB$ROOT中执行)
SQL> show con_name;

CON_NAME

CDB$ROOT
SQL> select group#, members, bytes from v$log;

GROUP#    MEMBERS      BYTES

     1          1  209715200
     2          1  209715200
     3          1  209715200

SQL> select member from v$logfile;

MEMBER

/u01/app/oracle/oradata/orcl/redo01.log
/u01/app/oracle/oradata/orcl/redo02.log
/u01/app/oracle/oradata/orcl/redo03.log

添加4(3+1)个standby logfile
SQL> alter database add standby logfile '/u01/app/oracle/oradata/orcl/standby_redo01.log' size 200m;
SQL> alter database add standby logfile '/u01/app/oracle/oradata/orcl/standby_redo02.log' size 200m;
SQL> alter database add standby logfile '/u01/app/oracle/oradata/orcl/standby_redo03.log' size 200m;
SQL> alter database add standby logfile '/u01/app/oracle/oradata/orcl/standby_redo04.log' size 200m;

4、配置tnsnames.ora
主库:
LISTENER_ORCL =
(ADDRESS = (PROTOCOL = tcp)(HOST = node1)(PORT = 1521))

orcl =
(DESCRIPTioN =
(ADDRESS = (PROTOCOL = TCP)(HOST = node1)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl)
)
)

orclbk =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = node2)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orclbk)
)
)

orclpdb =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = node1)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orclpdb)
)
)

备库:
LISTENER_ORCL =
(ADDRESS = (PROTOCOL = TCP)(HOST = node2)(PORT = 1521))

orcl =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = node1)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl)
)
)

orclbk =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = node2)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orclbk)
)
)

orclpdb =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = node2)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orclpdb)
)
)

5、修改主备库的参数文件:
主库操作:
SQL> create pfile from spfile;

修改后的pfile
orcl.data_transfer_cache_size=0
orcl.db_cache_size=1459617792
orcl.
inmemory_ext_roarea=0
orcl.inmemory_ext_rwarea=0
orcl.
java_pool_size=16777216
orcl.large_pool_size=33554432
orcl.
oracle_base='/u01/app/oracle'#ORACLE_BASE set from environment
orcl.pga_aggregate_target=687865856
orcl.
sga_target=2046820352
orcl.
shared_io_pool_size=100663296
orcl.shared_pool_size=419430400
orcl.
streams_pool_size=0
._undo_autotune=FALSE
.arcHive_lag_target=0
.audit_file_dest='/u01/app/oracle/admin/orcl/adump'
.audit_trail='none'
.compatible='12.2.0'
.control_files='/u01/app/oracle/oradata/orcl/control01.ctl','/u01/app/oracle/oradata/orcl/control02.ctl'
.data_guard_sync_latency=0
.db_block_size=8192
.db_file_name_convert='/u01/app/oracle/oradata/orclbk','/u01/app/oracle/oradata/orcl'
.db_name='orcl'
.db_unique_name='orcl'
.dg_broker_start=TRUE
.diagnostic_dest='/u01/app/oracle'
.dispatchers='(PROTOCOL=TCP) (SERVICE=orclXDB)'
.enable_pluggable_database=true
.fal_client='orcl'
.fal_server=''
.local_listener='LISTENER_ORCL'
.log_archive_config='dg_config=(orcl,orclbk)'
.log_archive_dest_1='location=/u01/arch valid_for=(all_logfiles,all_roles) db_unique_name=orcl'
.log_archive_dest_2='service="orclbk"','ASYNC NOAFFIRM delay=0 optional compression=disable max_failure=0 max_connections=1 reopen=300 db_unique_name="orclbk" net_timeout=30','valid_for=(online_logfile,all_roles)'
.log_archive_dest_state_1='ENABLE'
.log_archive_dest_state_2='ENABLE'
.log_archivefORMat='orcl%t%s%r.arc'
.log_archive_max_processes=4
.log_archive_min_succeed_dest=1
orcl.log_archive_trace=0
.log_file_name_convert='/u01/app/oracle/oradata/orclbk','/u01/app/oracle/oradata/orcl'
.nls_language='AMERICAN'
.nls_territory='AMERICA'
.open_cursors=1500
.pga_aggregate_target=650m
.processes=300
.remote_login_passWordfile='EXCLUSIVE'
.resource_limit=TRUE
.session_cached_cursors=1500
.sga_target=1948m
.standby_file_management='AUTO'
.undo_retention=7200
*.undo_tablespace='UNDOTBS1'

改动的部分:
._undo_autotune=FALSE
.db_file_name_convert='/u01/app/oracle/oradata/orclbk','/u01/app/oracle/oradata/orcl'
.db_name='orcl'
.db_unique_name='orcl'
.dg_broker_start=TRUE
.fal_client='orcl'
.fal_server=''
.log_archive_config='dg_config=(orcl,orclbk)'
.log_archive_dest_1='location=/u01/arch valid_for=(all_logfiles,all_roles) db_unique_name=orcl'
.log_archive_dest_2='service="orclbk"','ASYNC NOAFFIRM delay=0 optional compression=disable max_failure=0 max_connections=1 reopen=300 db_unique_name="orclbk" net_timeout=30','valid_for=(online_logfile,all_roles)'
.log_archive_dest_state_1='ENABLE'
.log_archive_dest_state_2='ENABLE'
.log_archiveformat='orcl%t%s%r.arc'
.log_file_name_convert='/u01/app/oracle/oradata/orclbk','/u01/app/oracle/oradata/orcl'
*.standby_file_management='AUTO'

备库的参数文件改动后如下:

orclbk.data_transfer_cache_size=0
orclbk.db_cache_size=1560281088
orclbk.
inmemory_ext_roarea=0
orclbk.inmemory_ext_rwarea=0
orclbk.
java_pool_size=16777216
orclbk.large_pool_size=33554432
orclbk.
oracle_base='/u01/app/oracle'#ORACLE_BASE set from environment
orclbk.pga_aggregate_target=687865856
orclbk.
sga_target=2046820352
orclbk.
shared_io_pool_size=0
orclbk.shared_pool_size=419430400
orclbk.
streams_pool_size=0
._undo_autotune=FALSE
.archive_lag_target=0
.audit_file_dest='/u01/app/oracle/admin/orclbk/adump'
.audit_trail='none'
.compatible='12.2.0'
.control_files='/u01/app/oracle/oradata/orclbk/control01.ctl','/u01/app/oracle/oradata/orclbk/control02.ctl'#Restore Controlfile
.data_guard_sync_latency=0
.db_block_size=8192
.db_file_name_convert='/u01/app/oracle/oradata/orcl','/u01/app/oracle/oradata/orclbk'
.db_name='orcl'
.db_unique_name='orclbk'
.dg_broker_start=TRUE
.diagnostic_dest='/u01/app/oracle'
.dispatchers='(PROTOCOL=TCP) (SERVICE=orclXDB)'
.enable_pluggable_database=true
.fal_client='orclbk'
.fal_server='ORCL'
.log_archive_config='dg_config=(orclbk,orcl)'
.log_archive_dest_1='location=/u01/arch valid_for=(all_logfiles,all_roles) db_unique_name=orclbk'
.log_archive_dest_2=''
.log_archive_dest_state_1='ENABLE'
.log_archive_dest_state_2='ENABLE'
.log_archiveformat='orclbk%t%s%r.arc'
orclbk.log_archiveformat='orclbk%t%s%r.arc'
.log_archive_max_processes=4
.log_archive_min_succeed_dest=1
orcl.log_archive_trace=0
orclbk.log_archive_trace=0
.log_file_name_convert='/u01/app/oracle/oradata/orcl','/u01/app/oracle/oradata/orclbk'
.nls_language='AMERICAN'
.nls_territory='AMERICA'
.open_cursors=1500
.pga_aggregate_target=650m
.processes=300
.remote_login_passwordfile='EXCLUSIVE'
.resource_limit=TRUE
.session_cached_cursors=1500
.sga_target=1948m
.standby_file_management='AUTO'
.undo_retention=7200
.undo_tablespace='UNDOTBS1'

主要的改动部分如下:
._undo_autotune=FALSE
.audit_trail='none'
.db_file_name_convert='/u01/app/oracle/oradata/orcl','/u01/app/oracle/oradata/orclbk'
.db_name='orcl'
.db_unique_name='orclbk'
.enable_pluggable_database=true
.fal_client='orclbk'
.fal_server='ORCL'
.log_archive_config='dg_config=(orclbk,orcl)'
.log_archive_dest_1='location=/u01/arch valid_for=(all_logfiles,all_roles) db_unique_name=orclbk'
.log_archive_dest_2=''
.log_archive_dest_state_1='ENABLE'
.log_archive_dest_state_2='ENABLE'
.log_file_name_convert='/u01/app/oracle/oradata/orcl','/u01/app/oracle/oradata/orclbk'

6、备份源端数据库,将备份文件传到目标端
RMAN> run{
allocate channel c1 type disk;
allocate channel c2 type disk;
backup filesperset 2 database format '/home/oracle/dbbackup/full%d%T%s_%p';
sql 'alter system archive log current';
sql 'alter system archive log current';
sql 'alter system archive log current';
backup archivelog all format '/home/oracle/dbbackup/arch%d%T%s_%p' delete input;
backup current controlfile format '/home/oracle/dbbackup/ctl%d%T%s_%p';
}

cd /home/oracle/db_backup/
scp * node2:/home/oracle/db_backup

7、源端生成备库的控制文件,并传到目标端
SQL> alter database create standby controlfile as '/home/oracle/db_backup/ctl';
cd /home/oracle/db_backup
scp ctl node2:/home/oracle/db_backup

8、备库恢复
SQL> startup nomount;
RMAN> restore controlfile from '/home/oracle/db_backup/ctl';
SQL> alter database mount standby database;
RMAN> restore database;
SQL> alter database recover managed standby database using current logfile disconnect from session;

ADG
1、查看备库openmode
SQL> select open_mode from v$database; --MOUNTED
2、取消备库自动恢复
SQL> alter database recover managed standby database cancel;
SQL> alter database open;
SQL> select open_mode from v$database; --此时为READ ONLY
3、read only下备库恢复
SQL> alter database recover managed standby database using current logfile disconnect;
SQL> select open_mode from v$database; --此时为READ ONLY WITH APPLY

DG_BROKER

--在主备库同时执行

--启动dg_broker
alter system set dg_broker_start=true sid='*';

--配置监听
主库:
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = node1)(PORT = 1521))
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
)
)

SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = orcl)
(ORACLE_HOME = /u01/app/oracle/product/12.2.0/db_1)
(SID_NAME = orcl)
)
(SID_DESC =
(GLOBAL_DBNAME = orcl_DGMGRL)
(ORACLE_HOME = /u01/app/oracle/product/12.2.0/db_1)
(SID_NAME = orcl)
)
)

ADR_BASE_LISTENER = /u01/app/oracle

备库:
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = node2)(PORT = 1521))
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
)
)

SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = orcl)
(ORACLE_HOME = /u01/app/oracle/product/12.2.0/db_1)
(SID_NAME = orcl)
)
(SID_DESC =
(GLOBAL_DBNAME = orclbk_DGMGRL)
(ORACLE_HOME = /u01/app/oracle/product/12.2.0/db_1)
(SID_NAME = orclbk)
)
)

ADR_BASE_LISTENER = /u01/app/oracle

--连接dg_broker进行配置
连接测试
$ dgmgrl
DGMGRL> connect sysdg@orcl
DGMGRL> connect sysdg@orclbk

测试是否能连上,如果连不上可能是sysdg用户被定,给一个密码并解锁

--在主库配置
DGMGRL> connect sysdg

DGMGRL> create configuration 'orcl_dg' as primary database is 'orcl' connect identifier is 'orcl';
show configuration;

--说明:
orcl_dg是配置名称,可以随便填。
primary database is 'orcl' orcl是db_unique_name
connect identifier is 'orcl' orcl是tnsname.ora连接到主库的net service name

--添加备库:
add database 'orclbk' as connect identifier is orclbk maintained as physical;
--说明:
add database 'orclbk': orclbk是 db_unique_name
as connect identifier is orclbk: orclbk是tnsnames.ora的service name

--查看配置
show configuration;

--启用配置
enable configuration;

--查看库
show database orcl;

show database orclbk;

--切换测试
switchover to orclbk;

switchover to orcl;

您可能感兴趣的文档:

--结束END--

本文标题: ORACLE12C ADG搭建

本文链接: https://lsjlt.com/news/37180.html(转载时请注明来源链接)

有问题或投稿请发送至: 邮箱/279061341@qq.com    QQ/279061341

猜你喜欢
  • ORACLE12C ADG搭建
    ORACLE12C_DG配置主库:orcl备库:orclbk 1、/etc/hosts配置 172.16.140.3 node1172.16.140.4 node2 2、主库force logging SQ...
    99+
    2024-04-02
  • Oracle11g ADG 搭建
    环境:Oracle 11.2.0.4 single instance 两套备库只安装Oracle软件及监听。一、主库操作1、主库备份pfile以便记录原参数 SQL>create pfile='/h...
    99+
    2024-04-02
  • 如何搭建ADG
    小编给大家分享一下如何搭建ADG,相信大部分人都还不怎么了解,因此分享这篇文章给大家参考一下,希望大家阅读完这篇文章后大有收获,下面让我们一起去了解一下吧! 1.主库备库上配置监听:在主备上都要改list...
    99+
    2024-04-02
  • Oracle 11g R2 ADG 搭建
    --============Oracle ADG搭建==============--==========准备阶段=========1.检查primary为archivelog模式。select l...
    99+
    2024-04-02
  • Oracle 12C Rac到Rac搭建ADG
    1、环境介绍搭建一套ADG灾备环境。主库环境为12.1.2.0 RAC,备库同主库,软件补丁均已安装。2、配置步骤2.1 归档 select log_mode from v$database; ...
    99+
    2024-04-02
  • ADG系列之oracle rac到单机的ADG环境搭建
    地址规划:RAC: 1.1.1.62 rac5-vip      1.1.1.64 rac6-vipdb_name hxzgdb_unique_name  hxzgr...
    99+
    2024-04-02
  • DBCA命令行搭建Oracle ADG的流程
    目录前言二、ADG搭建准备三、DBCA创建物理备库四、配置主库+备库DG参数五、开启日志应用六、测试同步前言 Oracle Data Guard是Oracle MAA(Maximum...
    99+
    2024-04-02
  • Oracle12c 手动创建pdb
    Oracle12c中采用容器数据库方式和插拔式数据库 进行存储数据时,随着业务量增加,采用分库的方式来存储,分布到不同存储设备上,可提高整体性能.以下为 采用sql脚本创建pdb: 创建pdb数据库对应的...
    99+
    2024-04-02
  • oracle12c rac搭建时主机名无效问题的解决
    在windows 2012 64位企业版上搭建oracle 12c  rac集群,hosts文件如下:#add for rac config11.14.72.83 rac111.14.7...
    99+
    2024-04-02
  • oracle12C 创建用户学习
    Oracle 12C中,账号分为两种,一种是公用账号,一种是本地账号(亦可理解为私有账号)。共有账号是指在CDB下创建,并在全部PDB中生效的账号,另一种是在PDB中创建的账号。针对这两种账号的测试如下:1...
    99+
    2024-04-02
  • oracle12c RAC如何创建ADVM和ACFS
    这篇文章给大家分享的是有关oracle12c RAC如何创建ADVM和ACFS的内容。小编觉得挺实用的,因此分享给大家做个参考,一起跟随小编过来看看吧。    ACFS是oracle d...
    99+
    2024-04-02
  • Oracle12c怎么创建与删除CDB、PDBs
    本篇内容介绍了“Oracle12c怎么创建与删除CDB、PDBs”的有关知识,在实际案例的操作过程中,不少人都会遇到这样的困境,接下来就让小编带领大家学习一下如何处理这些情况吧!希望大家仔细阅读,能够学有所...
    99+
    2024-04-02
  • 怎么在Oracle12C数据库创建wm_concat函数
    本篇内容介绍了“怎么在Oracle12C数据库创建wm_concat函数”的有关知识,在实际案例的操作过程中,不少人都会遇到这样的困境,接下来就让小编带领大家学习一下如何处理这些情况吧!希望大家仔细阅读,能...
    99+
    2024-04-02
  • oracle12c如何创建公用用户和本地用户
    小编给大家分享一下oracle12c如何创建公用用户和本地用户,相信大部分人都还不怎么了解,因此分享这篇文章给大家参考一下,希望大家阅读完这篇文章后大有收获,下面让我们一起去了解一下吧!12c推出了可插拔库...
    99+
    2024-04-02
  • centos7搭建gitlab服务器搭建
    在当今的技术领域,代码管理和版本控制变得越来越重要。为了组织和管理代码,越来越多的开发团队开始使用GitLab进行代码管理。GitLab是一个流行的基于Git的开源代码管理平台,提供了多种功能,例如版本控制、问题跟踪、CI/CD等。在本篇文...
    99+
    2023-10-22
  • Oracle 11gR2 RAC搭建(虚拟机搭建)
    安装环境说明与虚拟机规化: 安装环境主机操作系统:windows 10 虚拟机VMware15:两台CentOS-7.6Oracle Database software: Oracle11gR2 (11.2...
    99+
    2024-04-02
  • mongodb搭建
    最新版mongodb3.0的搭建,最简单的是新建mongodb-org-3.0.repo的yum源(官网www.mongodb.org)  [root@n2 ~]# cat /etc/yum.re...
    99+
    2024-04-02
  • zabbix搭建
    1、添加zabbix用户groupadd zabbix -g 201useradd -g zabbix -u 201 -m zabbixyum install net-snmp-devel curl cur...
    99+
    2024-04-02
  • Oracle搭建
    简介:Oracle Database,又名Oracle RDBMS,或简称Oracle。是甲骨文公司的一款关系数据库管理系统。它是在数据库领域一直处于领先地位的产品。可以说Oracle数据库系统是目前世界上...
    99+
    2024-04-02
  • MHA 搭建
    备注: 此处搭建的MHA 为 一主一从的环境manager:192.168.162.132master:192.168.162.134 node134slave:192.168.162.133 node13...
    99+
    2024-04-02
软考高级职称资格查询
编程网,编程工程师的家园,是目前国内优秀的开源技术社区之一,形成了由开源软件库、代码分享、资讯、协作翻译、讨论区和博客等几大频道内容,为IT开发者提供了一个发现、使用、并交流开源技术的平台。
  • 官方手机版

  • 微信公众号

  • 商务合作