一,主库前期操作

    搭建的话和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. How to Choose the Best Way to Pass Multiple Models in ASP.NET MVC

    Snesh Prajapati, 8 Dec 2014 http://www.codeproject.com/Articles/717941/How-to-Choose-the-Best-Way-to ...

  2. 编写高质量代码改善C#程序的157个建议——建议13: 为类型输出格式化字符串

    建议13: 为类型输出格式化字符串 有两种方法可以为类型提供格式化的字符串输出.一种是意识到类型会产生格式化字符串输出,于是让类型继承接口IFormattable.这对类型来 说,是一种主动实现的方式 ...

  3. 综合学生信息管理系统(JSP+JDBC)

    原创 通过JSP+JDBC制作一个简单的操作数据库中表信息的系统. 总体界面如下,一共有5个功能块. 功能一:列出全部学生 功能二:按条件查询学生 功能三:新添加学生 功能四:按条件删除学生 功能五: ...

  4. "ServiceStack.Redis.RedisNativeClient”的方法“get_Db”没有实现。

    解决办法: 1.首先通过nuget程序包管理器将相关依赖项卸载干净 2.检查各项目模块中的package.config里还有没有redis的节点,如果已经存在就删除掉 3.去别的正常的项目中看一下re ...

  5. 数据库处理session类

    <?php /* * 使用数据库处理session * php.ini 中 session.save_handler 设为 "user" */ class Dbsession ...

  6. 基于openstack搭建百万级并发负载均衡器的解决方案

    最近,喜欢研究一些国外技术大咖们的文章,而这篇文章是基于openstack负载均衡器的解决方案,做的一些总结~希望能够给小伙伴带来一些灵感或者帮助. openstack现有的负载均衡解决方案,无论是l ...

  7. I/O(输入/输出)---字节流与字符流

    流: 分为输入流和输出流,输入/输出是相对计算机内存来说的,数据输入到内存是输入流,数据从内存中输出是输出流. 流对象构造的时候会和数据源联系起来. 数据源分为:源数据源和目标数据源.输入流联系的是源 ...

  8. json_decode转换数组过程中,结果为null处理办法,百分之百有效

    json_decode这个函数是json_encode的反函数,一般传递数据的时候为了压缩数据,会将数组格式的数据转换成json格式,用到的函数就是json_encode,然后接收到数据之后再用jso ...

  9. 关于在VS 2013 Reshaper 中不能使用Alt+Enter 的解决

    新装Vs 2013 ,感觉还是不错,但是很恶心的是居然,Resharper 万能的快捷键不能用,让洒家真是恶心极了.   通过Google 在StackOverflow 上发现了解决方法,但好像看他的 ...

  10. html基础知识,整理

    # HMTL 基础知识 ###查看网页源代码吗 ``` ctrl + u``` ###dom元素 一个标签即代表一个dom元素 ###dom元素属性 ``` <p id ="first ...