oracle11G使用DGbroker创建dg

1.环境:  

  a.主机环境:centos6.5

  b.软件环境:oracle 11.2.0.4

  c.主机信息:

DG1:192.168.100.51(数据库sid:atest)

DG2:192.168.100.52

2.前提工作(主从都要设置):

  a.关闭防火墙:/etc/init.d/iptables stop

  b.关闭selinux:setenforce 0

查看状态:getenforce(关闭状态:Permissive)

3.3.主库设置:

  a.设置主库db_unique_name:

alter system set db_unique_name=‘patest‘ scope=spfile;

  b.设置主库为强制记录日志:

alter database force logging;

    检查状态(YEs为强制):

select name,force_logging from v$database;

  c.设置standy_file_management:

alter system set standby_file_management =‘AUTO‘;

  d.创建standbylog:

alter database add standby logfile group  11 ‘/u01/app/oracle/oradata/ATEST/standbylog/standby11.log‘ size 50m;
alter database add standby logfile group  12 ‘/u01/app/oracle/oradata/ATEST/standbylog/standby12.log‘ size 50m;
alter database add standby logfile group  13 ‘/u01/app/oracle/oradata/ATEST/standbylog/standby13.log‘ size 50m;
alter database add standby logfile group  14 ‘/u01/app/oracle/oradata/ATEST/standbylog/standby14.log‘ size 50m;

  e.开启归档(简单不详述):

alter system set log_archive_dest_1=‘location=/u01/app/oracle/oradata/ATEST/archivelog‘;
alter database archivelog;

  f.开启DGbroker:

alter system set DG_BROKER_START=TRUE;

  g.传输pfile和密码文件:

 create pfile from spfile;
 scp initatest.ora orapwatest 192.168.100.52:/u01/app/oracle/product/11.2.0/db1/dbs/

  h.设置监听:atest,patest,patest_DGMGRL

SID_LIST_LISTENER =
  (SID_LIST =
    (SID_DESC =
      (GLOBAL_DBNAME = atest)
      (ORACLE_HOME = /u01/app/oracle/product/11.2.0/db1)
      (SID_NAME = atest)
    )
    (SID_DESC =
      (GLOBAL_DBNAME = patest)
      (ORACLE_HOME = /u01/app/oracle/product/11.2.0/db1)
      (SID_NAME = atest)
    )
    (SID_DESC =
      (GLOBAL_DBNAME = patest_DGMGRL)
      (ORACLE_HOME = /u01/app/oracle/product/11.2.0/db1)
      (SID_NAME = atest)
    )
  )

LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = TCP)(HOST = vijay01.database.com)(PORT = 1521))
    )
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
    )
  )

ADR_BASE_LISTENER = /u01/app/oracle

  i.设置tnsnames.ora

ATEST =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.100.51)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = atest)
    )
  )

PATEST =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.100.51)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = atest)
    )
  )

SATEST =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.100.52)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = atest)
    )
  )

4.备库设置:

  a.设置监听:atest,satest,satest_DGMGRL

SID_LIST_LISTENER =
  (SID_LIST =
    (SID_DESC =
      (GLOBAL_DBNAME = atest)
      (ORACLE_HOME = /u01/app/oracle/product/11.2.0/db1)
      (SID_NAME = atest)
    )
    (SID_DESC =
      (GLOBAL_DBNAME = satest)
      (ORACLE_HOME = /u01/app/oracle/product/11.2.0/db1)
      (SID_NAME = atest)
    )
    (SID_DESC =
      (GLOBAL_DBNAME = satest_DGMGRL)
      (ORACLE_HOME = /u01/app/oracle/product/11.2.0/db1)
      (SID_NAME = atest)
    )
  )

LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = TCP)(HOST = vijay02.database.com)(PORT = 1521))
    )
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
    )
  )

ADR_BASE_LISTENER = /u01/app/oracle

  b.设置tnsnames.ora

ATEST =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.100.52)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = atest)
    )
  )

SATEST =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.100.52)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = atest)
    )
  )

PATEST =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.100.51)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = atest)
    )
  )

5.备份主库:

  a.rman target /

  b.backup database;

6.在备库上克隆主库:

  a.修改备库pfile上的db_unique_name=satest

  b.启动数据库到nomount:

startup nomount

  c.登陆rman:

rman target sys/123456@patest auxiliary sys/123456@satest

  d.开始克隆:

 duplicate target database for standby nofilenamecheck from active database;

7.设置DGbroker:

  a.登陆dgmgrl:

dgmgrl sys/123456@patest

  b.设置主库:

create configuration dgc as primary database is patest connect identifier is patest;

  c.添加备库:

add database satest as connect identifier is satest maintained as physical;

  d.启用配置文件:

enable configuration

  e.查看DGbroker配置:

show configuration;

show database ‘satest‘;

show database ‘patest‘ ‘StatusReport‘;

show database verbose ‘satest‘;

  f.查看数据库的DG状态:

SELECT GROUP#,dbid,archived,status from v$standby_log;

select dest_id,valid_type,valid_role,valid_now from v$archive_dest;

select process,status,group#,thread#,sequence# from v$managed_standby order by process,group#,thread#,sequence#;

select name,value,time_computed from v$dataguard_stats;

select timestamp,facility,dest_id,message_num,error_code,message from v$dataguard_status order by timestamp;

select recid,archived,applied from v$archived_log;

8.DG不同步检查步骤:

1.检查密码文件
2.检查网络
3.检查参数文件
4.检查防火墙或selinux
5.如以上均无问题,只能说明dg环境有问题,需要重新搭建dg(重新传输数据文件到主库,在重新同步)

  

时间: 2025-01-11 17:22:35

oracle11G使用DGbroker创建dg的相关文章

oracle 11g RMAN:Active Database Duplication for standby database 创建dg 命令解读

基于生产的duplicate 复制,如果事先没有手动配置pfile(设定内存,进程,dg相关配置参数,数据库相关路径参数)则会出现各种参数无法转换的问题: 因为duplicate 会从生产自动拷贝pfile,控制文件,密码文件过来,如果主库和备库环境不一样(数据库软件路径,数据文件存储路径) 如果没在duplicate的命令中完整指定新环境备库的各种参数涉及路径,及转换参数,就会默认使用从主库拷贝过来的spfile中的参数设置(会忽略oracle 自定义的的缺省配置:比如adr 缺省会放在ORA

一键DG脚本(静默安装创建实例创建DG)

首先,这只是为了练习shell而写 大神们不屑请别看 不懂shell的可以看看,做个参考,把一些功能当做魔板 我知道红黑联盟,linux公社等会盗转,所以提前问候你们全家了 脚本大致步骤是: 1.判断是否创建oracle用户,如果没有创建就创建,并设置密码为oracle 2.解析config.conf文件,获取用户输入的SID等等参数 3.做安装前的参数配置,创建所需目录 4.安装数据库软件,配置监听,创建实例 5.配置pfile,设置force_logging,传输数据文件到备库(没用rman

Oracle学习之DATAGUARD(十) 在同台机器上使用11g rman新特性创建DG

首先使用dbca建立一个数据库,db_name=primary . 2.   为两个数据库准备静态监听.及连接彼此的TNSNAME 11gdg1-> cat listener.ora tnsnames.ora  # listener.ora Network Configuration File: /u01/app/oracle/product/11.2.0/db_1/network/admin/listener.ora # Generated by Oracle configuration to

Linux下搭建Oracle11g RAC(3)----创建用户及配置相关文件

配置11gR2 RAC需要安装Oracle Grid Infrastructure软件.Oracle数据库软件,其中Grid软件等同于Oracle 10g的Clusterware集群件.Oracle建议以不同的用户分别安装Grid Infrastructure软件.Oracle数据库软件,我们这里以grid用户安装Grid Infrastructure,oracle用户安装Oracle数据库软件.并且grid.oracle用户需要属于不同的用户组.在配置RAC时,还要求这两个用户在RAC的不同节

Oracle11g 配置DG broker

在配置DG broker之前需要确保Dataguard配置正常且主库和备库均使用spfile. 1. 主库配置 配置DG_BROKER_START参数 检查主库dg_broker_start设置 SQL> show parameter dg_broker_start; NAME TYPE VALUE ------------------------------------ ----------- ------------------------------ dg_broker_start boo

duplicate from active dg 的 run 脚本 sfile 为完整配置可能导致的一些错误

oracle 11g RMAN:Active Database Duplication for standby database 创建dg 命令解读 继上篇如果没有正确配置,理解duplicate from active  dg 的 run 脚本,就会出现以下错误: 1:路径不存在: Oracle instance shut down connected to auxiliary database (not started) RMAN-00571: =======================

官方文档 恢复备份指南七 Using Flashback Database and Restore Points

本章内容: Understanding Flashback Database, Restore Points and Guaranteed Restore Points Logging for Flashback Database and Guaranteed Restore Points Prerequisites for Flashback Database and Guaranteed Restore Points Using Normal and Guaranteed Restore P

Oracle 表空间管理

Oracle磁盘管理中的最高逻辑层是表空间,Oracle11g中必须创建的4个表空间是SYSTEM,SYSAUX, TEMP, UNDOTBS1. 2 SYSTEM:存储数据字典等,pl/sql代码等. 2 SYSAUX:存储与数据库选项相关的数据 2 TEMP:用于大的排序操作 2 UNDUTBS1:为读一致性和恢复的目的,存储事务信息. 表空间的下一层是段,一个段只能驻留在一个表空间中:一个或多个区可以组成一个段,每个区只能驻留在一个数据文件中:一组连续的数据块可以组成一个区.如果要查询表空

【故障处理】 DBCA建库报错CRS-2566

[故障处理] DBCA建库报错CRS-2566 PRCR-1071 PRCR-1006 一.1  BLOG文档结构图       一.2  前言部分   一.2.1  导读和注意事项 各位技术爱好者,看完本文后,你可以掌握如下的技能,也可以学到一些其它你所不知道的知识,~O(∩_∩)O~: ① dbca静默建库 ② 将监听加入CRS中     Tips:        ① 若文章代码格式有错乱,推荐使用搜狗.QQ或360浏览器,也可以下载pdf格式的文档来查看,pdf文档下载地址:http://