一,主库前期操作

    搭建的话和11g差不多,点点点.
两台服务器,一台主库,一台从库

01,配置主库hosts

cat /etc/hosts
192.168.0.31 node12c01
192.168.0.32 node12c02

02,主库启动FORCE LOGGING

SQL>  select name,open_mode from v$pdbs;

NAME
--------------------------------------------------------------------------------
OPEN_MODE
----------
PDB$SEED
READ ONLY ORCLPDB
MOUNTED SQL> select force_logging from v$database; FORCE_LOGGING
---------------------------------------
NO SQL> alter database force logging; Database altered. SQL> select force_logging from v$database; FORCE_LOGGING
---------------------------------------
YES

03,启动归档模式

SQL>  archive log list;
Database log mode No Archive Mode
Automatic archival Disabled
Archive destination USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence 1
Current log sequence 3
SQL> show pdbs CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 ORCLPDB MOUNTED
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup mount;
ORACLE instance started. Total System Global Area 2516582400 bytes
Fixed Size 8795904 bytes
Variable Size 671090944 bytes
Database Buffers 1828716544 bytes
Redo Buffers 7979008 bytes
Database mounted.
SQL> alter database archivelog; Database altered. SQL>oh /orcl/app/oracle/oradata/orcl/archivelog SQL> alter system set log_archive_dest_1='location=/orcl/app/oracle/oradata/orcl/archivelog'; SQL> archive log list
Database log mode Archive Mode
Automatic archival Enabled
Archive destination /orcl/app/oracle/oradata/orcl/archivelog
Oldest online log sequence 1
Next log sequence to archive 3
Current log sequence 3 SQL> show parameter recovery; NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
db_recovery_file_dest string /orcl/app/oracle/fast_recovery
_area/orcl
db_recovery_file_dest_size big integer 12780M
recovery_parallelism integer 0
remote_recovery_file_dest string
SQL> alter system set db_recovery_file_dest_size=1G; System altered. SQL> show parameter recovery; NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
db_recovery_file_dest string /orcl/app/oracle/fast_recovery
_area/orcl
db_recovery_file_dest_size big integer 1G
recovery_parallelism integer 0
remote_recovery_file_dest string
SQL> select name,open_mode from v$pdbs; NAME
--------------------------------------------------------------------------------
OPEN_MODE
----------
PDB$SEED
MOUNTED ORCLPDB
MOUNTED SQL> alter database open; Database altered. SQL> select name,open_mode from v$pdbs; NAME
--------------------------------------------------------------------------------
OPEN_MODE
----------
PDB$SEED
READ ONLY ORCLPDB
MOUNTED SQL> alter pluggable database all open; Pluggable database altered. SQL> select name ,open_mode from v$pdbs; NAME
--------------------------------------------------------------------------------
OPEN_MODE
----------
PDB$SEED
READ ONLY ORCLPDB
READ WRITE

04,添加redo日志

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
--------------------------------------------------------------------------------
/orcl/app/oracle/oradata/orcl/redo03.log
/orcl/app/oracle/oradata/orcl/redo02.log
/orcl/app/oracle/oradata/orcl/redo01.log SQL> alter database add standby logfile '/orcl/app/oracle/oradata/orcl/stdredo01.log' size 50M; Database altered. SQL> alter database add standby logfile '/orcl/app/oracle/oradata/orcl/stdredo02.log' size 50M; Database altered. SQL> alter database add standby logfile '/orcl/app/oracle/oradata/orcl/stdredo03.log' size 50M; Database altered. SQL> alter database add standby logfile '/orcl/app/oracle/oradata/orcl/stdredo04.log' size 50M; Database altered. SQL> select member from v$logfile; MEMBER
--------------------------------------------------------------------------------
/orcl/app/oracle/oradata/orcl/redo03.log
/orcl/app/oracle/oradata/orcl/redo02.log
/orcl/app/oracle/oradata/orcl/redo01.log
/orcl/app/oracle/oradata/orcl/stdredo01.log
/orcl/app/oracle/oradata/orcl/stdredo02.log
/orcl/app/oracle/oradata/orcl/stdredo03.log
/orcl/app/oracle/oradata/orcl/stdredo04.log 7 rows selected.

05,备份主库

创建备份目录
SQL> ho mkdir /home/oracle/dgback/ 备份
RMAN> configure channel device type disk format '/home/oracle/dgback/%d_%I_%s_%p.bkp';
RMAN> backup as compressed backupset database include current controlfile for standby plus archivelog;

06,配置监听

主和从库配置并且能ping 通

主库
[oracle@node12c01 ~]$ cat /orcl/app/oracle/product/12.1.0/db_1/network/admin/listener.ora
# listener.ora Network Configuration File: /orcl/app/oracle/product/12.1.0/db_1/network/admin/listener.ora
# Generated by Oracle configuration tools.
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = /orcl/app/oracle/product/12.1.0/db_1/)
(PROGRAM = extproc)
)
(SID_DESC =
(GLOBAL_DBNAME = node12c01)
(ORACLE_HOME = /orcl/app/oracle/product/12.1.0/db_1)
(SID_NAME = ORCL)
)
(SID_DESC =
(GLOBAL_DBNAME = node12c01_dgmgrl)
(ORACLE_HOME = /orcl/app/oracle/product/12.1.0/db_1)
(SID_NAME = ORCL)
)
(SID_DESC =
(GLOBAL_DBNAME = node12c)
(ORACLE_HOME = /orcl/app/oracle/product/12.1.0/db_1)
(SID_NAME = ORCL)
)
) LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = node12c01)(PORT = 1521))
)
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
)
) ADR_BASE_LISTENER = /orcl/app/oracle/
[oracle@node12c01 ~]$ cat /orcl/app/oracle/product/12.1.0/db_1/network/admin/tnsnames.ora
# tnsnames.ora Network Configuration File: /orcl/app/oracle/product/12.1.0/db_1/network/admin/tnsnames.ora
# Generated by Oracle configuration tools. LISTENER_ORCL =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.31)(PORT = 1521)) ORCL =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.31)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = NODE12C01)
(UR=A)
)
)
node12c01 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.31)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = NODE12C01)
(UR=A)
)
)
node12c02 =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.32)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = NODE12C02)
(UR=A)
)
)
从库
[oracle@node12c02 ~]$ cat /orcl/app/oracle/product/12.1.0/db_1/network/admin/listener.ora
# listener.ora Network Configuration File: /orcl/app/oracle/product/12.1.0/db_1/network/admin/listener.ora
# Generated by Oracle configuration tools.
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = /orcl/app/oracle/product/12.1.0/db_1/)
(PROGRAM = extproc)
)
(SID_DESC =
(GLOBAL_DBNAME = node12c02)
(SID_NAME = ORCL)
(ORACLE_HOME = /orcl/app/oracle/product/12.1.0/db_1/)
)
(SID_DESC =
(GLOBAL_DBNAME = node12c01)
(SID_NAME = ORCL)
(ORACLE_HOME = /orcl/app/oracle/product/12.1.0/db_1/)
)
) LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.32)(PORT = 1521))
)
) [oracle@node12c02 ~]$ cat /orcl/app/oracle/product/12.1.0/db_1/network/admin/tnsnames.ora
# tnsnames.ora Network Configuration File: /orcl/app/oracle/product/12.1.0/db_1/network/admin/tnsnames.ora
# Generated by Oracle configuration tools. LISTENER_ORCL =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.32)(PORT = 1521)) ORCL =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.32)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = node12c02)
)
) ORCL =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.31)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = node12c01)
)
) 相互ping
tnsping node12c01
tnsping node12c02

07, 配置连接

SQL> show parameter name

NAME				     TYPE	 VALUE
------------------------------------ ----------- ------------------------------
cdb_cluster_name string NODE12C01
cell_offloadgroup_name string
db_file_name_convert string
db_name string orcl
db_unique_name string NODE12C01
global_names boolean FALSE
instance_name string orcl
lock_name_space string
log_file_name_convert string
pdb_file_name_convert string
processor_group_name string NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
service_names string NODE12C01

这些配置的话需要一 一对应

配置操作命令有下:

alter system set service_names='NODE12C02'; ---更改服务名
alter system set db_unique_name='NODE12C02' scope=spfile;
create spfile from pfile='/orcl/app/oracle/product/12.1.0/db_1/dbs/initorcl.ora'; --创建spfile
startup nomount pfile='/orcl/app/oracle/product/12.1.0/db_1/dbs/initorcl.ora'; --指定启动

要相互能连接上

[oracle@node12c02 admin]$ sqlplus sys/123456@NODE12C01 as sysdba

SQL*Plus: Release 12.2.0.1.0 Production on Tue Apr 2 22:42:25 2019

Copyright (c) 1982, 2016, Oracle.  All rights reserved.

Connected to:
Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production [oracle@node12c01 admin]$ sqlplus sys/123456@NODE12C02 as sysdba

8,备库生成数据

[oracle@node12c02 admin]$ rman target sys/123456@NODE12C01 auxiliary sys/123456@NODE12C02

Recovery Manager: Release 12.2.0.1.0 - Production on Tue Apr 2 23:15:51 2019

Copyright (c) 1982, 2017, Oracle and/or its affiliates.  All rights reserved.

connected to target database: ORCL (DBID=1532278336)
connected to auxiliary database: ORCL (not mounted) RMAN>
RMAN> duplicate target database for standby from active database nofilenamecheck;

没有错误显示就成功了

9,dgbroker

  主备都开启
       alter system set dg_broker_start=true

尝试进入主库

[oracle@node12c01 ecpect]$ dgmgrl sys/123456
DGMGRL for Linux: Release 12.2.0.1.0 - Production on Tue Apr 2 23:22:55 2019 Copyright (c) 1982, 2017, Oracle and/or its affiliates. All rights reserved. Welcome to DGMGRL, type "help" for information.
Connected to "NODE12C01"
Connected as SYSDG.
DGMGRL>

把主库添加进dg配置 --->具体操作查看往期文章

DGMGRL> help create

Creates a broker configuration

Syntax:

  CREATE CONFIGURATION <configuration name> [AS]
PRIMARY DATABASE IS <database name>
CONNECT IDENTIFIER IS <connect identifier>; DGMGRL> CREATE CONFIGURATION node12c as primary database is node12c01 connect identifier is node12c01
> ;
Configuration "node12c" created with primary database "node12c01"

把备库添加进dg配置

DGMGRL> add database node12c02 as connect identifier is node12c02 maintained as physical;
DGMGRL> enable configuration --启动配置

oracle12C--DG搭建配置的更多相关文章

  1. 一步一步搭建11gR2 rac+dg之DG 机器配置(七)【转】

    DG 机器配置 转自: 一步一步搭建11gR2 rac+dg之DG 机器配置(七)-lhrbest-ITPUB博客http://blog.itpub.net/26736162/viewspace-12 ...

  2. Oracle RAC 11g DG Broker配置和测试

    Oracle RAC 11g DG Broker配置和测试 之前在<RHEL6.4 + Oracle 11g DG测试环境快速搭建参考>已经简单说过. 本篇在实验环境中实际配置 环境: R ...

  3. oracle 单实例DG(搭建篇一)

    一,介绍 lodding... 二,安装前环境配置 01,依赖包的安装: yum install binutils-* yum install compat-libstdc++-* yum insta ...

  4. linux下oracle11G DG搭建(三):环绕备库搭建操作

    linux下oracle11G DG搭建(三):环绕备库搭建操作 环境 名称 主库 备库 主机名 bjsrv shsrv 软件版本号 RedHat Enterprise5.5.Oracle 11g 1 ...

  5. oracle DG搭建

    Oracle DG 搭建1. 环境 OS IP hostname db_name DB_UNIQUE_NAME主库 RHEL 5.4 192.168.12.20 edgzrip1.oracle.com ...

  6. Keepalive双主搭建配置

    Keepalive 双主搭建配置 keepalived保证双主数据库的可用性 环境说明 192.168.1.10  keepalive 主1 192.168.1.20  keepalive 主2 19 ...

  7. Samba服务器搭建配置

    本次环境: 服务端-centos6.8-192.168.2.200 客户端1-centos6.8-192.168.2.201 客户端2-Windows7-192.168.2.104 假设条件如下: 使 ...

  8. Varnish缓存服务器的搭建配置手册

    Varnish缓存服务器的搭建配置手册 1.Varnish官方环境依赖提示 Installing Varnish Cache is as simple as enabling our package ...

  9. 转载-Linux下svn搭建配置流程

    Linux下svn搭建配置流程     一.    源文件编译安装.源文件共两个,为: 1.   下载subversion源文件 subversion-1.6.1.tar.gz http://d136 ...

  10. 基于认证的代理平台搭建配置squid-20130730

    基于认证的代理平台搭建配置squid-20130730 功能:通过squid代理实现 (1)基于用户名密码认证的出口ip路由选择 (2)基于client源ip的出口ip路由选择 (3)基于连接本机ip ...

随机推荐

  1. Java 起名规范

    注重代码编写规范: 1)都得遵循标识号的规范 2)不能以关键字,数字开头.也不要以拼音起名,最好用英文单词,单词组合来起名. 3)采用驼峰表示法,使用英文单词组合,单词首字母要大些,起到分割作用. - ...

  2. 编写高质量代码改善C#程序的157个建议——建议22:确保集合的线程安全

    建议22:确保集合的线程安全 集合线程安全是指多个线程上添加或删除元素时,线程键必须保持同步. 下面代码模拟了一个线程在迭代过程中,另一个线程对元素进行了删除. class Program { sta ...

  3. oracle 中用法dual

    dual是一个虚拟表,用来构成select的语法规则,oracle保证dual里面永远只有一条记录.我们可以用它来做很多事情. dual是一个虚拟表,用来构成select的语法规则,oracle保证d ...

  4. Android ViewPager + Fragment的布局

    ViewPager And Fragment 1.之前有篇博客是讲ViewPager的用法的:http://www.cnblogs.com/liangstudyhome/p/3773156.html ...

  5. C# Path类常用方法

    Path 类 对包含文件或目录路径信息的 String 实例执行操作. 1.Path.GetExtension 方法 —— 返回指定的路径字符串的扩展名. public static string G ...

  6. docker 镜像 容器删除

    Docker 容器镜像删除   1.停止所有的container,这样才能够删除其中的images: docker stop $(docker ps -a -q) 如果想要删除所有container的 ...

  7. Mybatis-generator逆向工程

    $.Mybatis-generator介绍 MyBatis Generator(MBG)是MyBatis MyBatis 和iBATIS的代码生成器.它将为所有版本的MyBatis以及版本2.2.0之 ...

  8. cinder侧挂载卷流程分析

    cinder侧挂载卷流程分析,存储类型以lvm+iscsi的方式为分析基础cinder侧主要调用了三个接口1)reserve_volume: 把volume的状态改为attaching,阻止其它节点执 ...

  9. 2018数学建模国赛总结(A题/编程选手视角)

    2018数学建模已经告一段落了,先说说基本情况吧,我们队伍专业分别为:金融(A),会计(B),计算机(我),配置还算可以,他们俩会数据分析软件也会写论文,我可以写代码,画图.他们俩打过美赛(M奖),我 ...

  10. [SinGuLaRiTy] 2017 百度之星程序设计大赛 复赛

    [SinGuLaRiTy-1038] Copyright (c) SinGuLaRiTy 2017. All Rights Reserved. Arithmetic of Bomb Problem D ...