一,主库前期操作

    搭建的话和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. IIS 身份验证

    IIS 支持以下身份验证模式: 匿名.如果不需要对客户端进行身份验证(或者使用自定义身份验证机制,如窗体身份验证),则可将 IIS 配置为允许匿名访问.在该事件中,IIS 创建一个 Windows 令 ...

  2. HDU 4118 Holiday's Accommodation (dfs)

    题意:给n个点,每个点有一个人,有n-1条有权值的边,求所有人不在原来位置所移动的距离的和最大值. 析:对于每边条,我们可以这么考虑,它的左右两边的点数最少的就是要加的数目,因为最好的情况就是左边到右 ...

  3. ASP.NET框架获取数据字典数据做成树的格式

    private List<TreeEntity> treeList = new List<TreeEntity>();//创建一个树的List集合 public ActionR ...

  4. POJ3026 Borg Maze(bfs求边+最小生成树)

    Description The Borg is an immensely powerful race of enhanced humanoids from the delta quadrant of ...

  5. [other] 代码量代码复杂度统计-lizard

    [other] 代码量代码复杂度统计-lizard lizard的可以用来统计下面的一些数据 不包含代码注释的代码行数 CCN 代码的复杂度,也就是分支复杂度 token的个数(关键字,标示符,常量, ...

  6. golang subprocess tests

    golang Subprocess tests Sometimes you need to test the behavior of a process, not just a function. f ...

  7. JavaScript中创建自定义对象的方法

    本文内容参考JavaScript高级程序设计(第3版)第6章:面向对象的程序设计 ECMA-262中把对象定义为:“无序属性的集合,其属性可以包含基本值.对象或者函数.”我所理解的就是对象就是一个结构 ...

  8. Persistent and Transient Data Structures in Clojure

    此文已由作者张佃鹏授权网易云社区发布. 欢迎访问网易云社区,了解更多网易技术产品运营经验. 最近在项目中用到了Transient数据结构,使用该数据结构对程序执行效率会有一定的提高.刚刚接触Trans ...

  9. RealSense R400系列深度相机的图像获取保存和格式转换

    关于RealSense的基础使用的博文用的库有点混杂,挺多博文都是早期maneger的那个库,对那个不是很了解,主要记录一下使用最新的函数库的基础使用. 相机型号:RealSense R435 使用函 ...

  10. PLSQL Developer连接远程Oracle

    注:内容来网络 (一)不安装客户端的解决办法. 第一种方法: 1.在安装ORACLE服务器的机器上搜索下列文件, oci.dll ocijdbc10.dll ociw32.dll orannzsbb1 ...