Creating a Physical Standby from Primary on Version 12c (Doc ID 1570958.1)

APPLIES TO:

Oracle Database Cloud Schema Service - Version N/A and later
Oracle Database Exadata Cloud Machine - Version N/A and later
Oracle Cloud Infrastructure - Database Service - Version N/A and later
Oracle Database Exadata Express Cloud Service - Version N/A and later
Oracle Database Backup Service - Version N/A and later
Information in this document applies to any platform.
ship

GOAL

NOTE: In the images and/or the document content below, the user information and environment data used represents fictitious data from the Oracle sample schema(s), Public Documentation delivered with an Oracle database product or other training material. Any similarity to actual environments, actual persons, living or dead, is purely coincidental and not intended in any manner.

For the purposes of this document, the following fictitious environment is used as an example to describe the procedure:  为了本文档的目的,以下虚拟环境用作描述此过程的示例

Primary db_name and db_unique_name: BOSTON
Standby db_name: BOSTON (same as primary db_name)
Standby db_unique_name: CHICAGO
Directory: u01/app/oracle
 
NOTE : We cannot create a physical standby at PDB(plugable Database) level. It should be at CDB(Container Database) level i.e entire primary CDB should be cloned/created as physical Standby.
注意:我们无法在PDB(可插入数据库)级别上创建物理备用数据库。它应处于CDB(容器数据库)级别,即应克隆/创建整个主CDB作为物理备用数据库。

Steps includes,  步骤包括

1. Create necessary Directory on standby server.  在备用服务器上创建必要的目录

2.Create pfile and password.  创建pfile和密码

3. Make static listener entry on standby server.  在备用服务器上进行静态侦听器条目

4. Use RMAN Duplicate ..from Active Database to clone Primary CDB.  使用RMAN Duplicate ..from Active Database克隆主CDB

5. Configure primary for remote log shipping and verify MRP progress on standby.  配置主数据库进行远程日志传送,并验证备用数据库上的MRP进度

SOLUTION

1. Create addition Directory on standby server  在备用服务器上创建附加目录

mkdir -p /u01/app/oracle/admin/chicago/adump
mkdir -p /u01/app/oracle/oradata/chicago
mkdir -p /u01/app/oracle/fast_recovery_area/chicago
mkdir -p /u01/app/oracle/oradata/chicago1/pdbseed
mkdir -p /u01/app/oracle/oradata/chicago/db1

NOTE : Direcories like pdbseed,chicago1 are specific to 12c.  注意:像 pdbseed,chicago1 这样的目录特定于12c

2. Create pfile

echo 'db_name=boston' > /u01/app/oracle/product/12.1.0/dbhome_1/dbs/initchicago.ora

3. Create Password file or copy from primary

orapwd file=/u01/app/oracle/product/12.1.0/dbhome_1/dbs/orapwchicago password=<password>

4. Make static listener entry

cd $ORACLE_HOME/network/admin
vi listener.ora SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC=
(GLOBAL_DBNAME = chicago)
(ORACLE_HOME=/u01/app/oracle/product/12.1.0/dbhome_1)
(SID_NAME = chicago)
)
) -reload or restart listener.
lsnrctl stop
lsnrctl start

5. Start the AUX instance at standby side.  在备用端启动AUX实例

sqlplus / as sysdba
startup nomount pfile='$ORACLE_HOME/dbs/initchicago.ora';

6. Initiate RMAN DUPLICATE from.. active database to create standby with target connected to primary instance.
  从活动数据库启动RMAN DUPLICATE,以将目标连接到主实例来创建备用数据库

rman target sys/<password>@boston auxiliary sys/<password>@chicago

run
{
allocate channel c1 type disk;
allocate channel c2 type disk;
allocate channel c3 type disk;
allocate channel c4 type disk;
allocate channel prim type disk;
allocate auxiliary channel aux type disk;
duplicate target database for standby from active database spfile
parameter_value_convert 'boston','chicago'
set db_file_name_convert='boston','chicago'
set log_file_name_convert='boston','chicago'
set log_archive_max_processes='10'
set db_unique_name='chicago'
set standby_file_management='AUTO'
set log_archive_config='dg_config=(boston,chicago)'
set log_archive_dest_1='location=USE_DB_RECOVERY_FILE_DEST valid_for=(all_logfiles,all_roles) db_unique_name=chicago'
set log_Archive_dest_2='service=boston async noaffirm reopen=15 valid_for=(all_logfiles,primary_role) db_unique_name=boston'
set log_archive_config='dg_config=(boston,chicago)';
sql channel aux "alter database add standby logfile ''/u01/app/oracle/oradata/chicago/stdbyredo1.log'' size 50M";
sql channel aux "alter database add standby logfile ''/u01/app/oracle/oradata/chicago/stdbyredo2.log'' size 50M";
sql channel aux "alter database add standby logfile ''/u01/app/oracle/oradata/chicago/stdbyredo3.log'' size 50M";
sql channel aux "alter database add standby logfile ''/u01/app/oracle/oradata/chicago/stdbyredo4.log'' size 50M";
sql channel prim "alter system archive log current";
sql channel aux "alter database recover managed standby database disconnect";
}

日志

Recovery Manager: Release 12.1.0.1.0 - Production on Thu Jul 11 16:11:51 2013

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

connected to target database: BOSTON (DBID=2509966093)
connected to auxiliary database: BOSTON (not mounted) RMAN> 2> 3> 4> 5> 6> 7> 8> 9> 10> 11> 12> 13> 14> 15> 16> 17> 18> 19> 20> 21> 22> 23> 24> 25>
using target database control file instead of recovery catalog
allocated channel: c1
channel c1: SID=38 device type=DISK allocated channel: c2
channel c2: SID=61 device type=DISK
.
.
Starting Duplicate Db at 11-JUL-13 contents of Memory Script:
{
backup as copy reuse
targetfile '/u01/app/oracle/product/12.1.0/dbhome_1/dbs/orapwboston' auxiliary format
'/u01/app/oracle/product/12.1.0/dbhome_1/dbs/orapwchicago' targetfile
'/u01/app/oracle/product/12.1.0/dbhome_1/dbs/spfileboston.ora' auxiliary format
'/u01/app/oracle/product/12.1.0/dbhome_1/dbs/spfilechicago.ora' ;
sql clone "alter system set spfile= ''/u01/app/oracle/product/12.1.0/dbhome_1/dbs/spfilechicago.ora''";
}
executing Memory Script Starting backup at 11-JUL-13
Finished backup at 11-JUL-13 sql statement: alter system set spfile= ''/u01/app/oracle/product/12.1.0/dbhome_1/dbs/spfilechicago.ora'' contents of Memory Script:
{
sql clone "alter system set audit_file_dest =
''/u01/app/oracle/admin/chicago/adump'' comment=
'''' scope=spfile";
sql clone "alter system set control_files =
''/oradata/chicago/control01.ctl'', ''/u01/app/oracle/fast_recovery_area/chicago/control02.ctl'' comment=
'''' scope=spfile";
sql clone "alter system set dispatchers =
''(PROTOCOL=TCP) (SERVICE=chicagoXDB)'' comment=
'''' scope=spfile";
sql clone "alter system set db_file_name_convert =
''boston'', ''chicago'' comment=
'''' scope=spfile";
sql clone "alter system set log_file_name_convert =
''boston'', ''chicago'' comment=
'''' scope=spfile";
sql clone "alter system set log_archive_max_processes =
10 comment=
'''' scope=spfile";
sql clone "alter system set db_unique_name =
''chicago'' comment=
'''' scope=spfile";
sql clone "alter system set standby_file_management =
''AUTO'' comment=
'''' scope=spfile";
sql clone "alter system set log_archive_config =
''dg_config=(boston,chicago)'' comment=
'''' scope=spfile";
sql clone "alter system set log_archive_dest_1 =
''location=USE_DB_RECOVERY_FILE_DEST valid_for=(all_logfiles,all_roles) db_unique_name=chicago'' comment=
'''' scope=spfile";
sql clone "alter system set log_Archive_dest_2 =
''service=boston async noaffirm reopen=15 valid_for=(all_logfiles,primary_role) db_unique_name=boston'' comment=
'''' scope=spfile";
shutdown clone immediate;
startup clone nomount;
}
executing Memory Script sql statement: alter system set audit_file_dest = ''/u01/app/oracle/admin/chicago/adump'' comment= '''' scope=spfile
sql statement: alter system set control_files = ''/oradata/chicago/control01.ctl'', ''/u01/app/oracle/fast_recovery_area/chicago/control02.ctl'' comment= '''' scope=spfile sql statement: alter system set dispatchers = ''(PROTOCOL=TCP) (SERVICE=chicagoXDB)'' comment= '''' scope=spfile sql statement: alter system set db_file_name_convert = ''boston'', ''chicago'' comment= '''' scope=spfile sql statement: alter system set log_file_name_convert = ''boston'', ''chicago'' comment= '''' scope=spfile sql statement: alter system set log_archive_max_processes = 10 comment= '''' scope=spfile sql statement: alter system set db_unique_name = ''chicago'' comment= '''' scope=spfile sql statement: alter system set standby_file_management = ''AUTO'' comment= '''' scope=spfile sql statement: alter system set log_archive_config = ''dg_config=(boston,chicago)'' comment= '''' scope=spfile sql statement: alter system set log_archive_dest_1 = ''location=USE_DB_RECOVERY_FILE_DEST valid_for=(all_logfiles,all_roles) db_unique_name=boston'' comment= '''' scope=spfile sql statement: alter system set log_Archive_dest_2 = ''service=chicago async noaffirm reopen=15 valid_for=(all_logfiles,primary_role) db_unique_name=chicago'' comment= '''' scope=spfile sql statement: alter system set log_archive_config="dg_config=(boston,chicago)" comment=""scope=spfile Oracle instance shut down connected to auxiliary database (not started)
Oracle instance started Total System Global Area 1043886080 bytes Fixed Size 2296280 bytes
Variable Size 696256040 bytes
Database Buffers 339738624 bytes
Redo Buffers 5595136 bytes
allocated channel: aux
channel aux: SID=19 device type=DISK contents of Memory Script: {
sql clone 'alter database mount standby database';
}
executing Memory Script sql statement: alter database mount standby database contents of Memory Script:
{
set newname for tempfile 1 to
"/oradata/chicago/temp01.dbf";
set newname for tempfile 2 to
"/oradata/chicago/pdbseed/pdbseed_temp01.dbf";
set newname for tempfile 3 to
"/oradata/chicago/chicago1/chicago1_temp01.dbf";
switch clone tempfile all;
set newname for datafile 1 to
"/oradata/chicago/system01.dbf";
set newname for datafile 3 to
"/oradata/chicago/sysaux01.dbf";
set newname for datafile 4 to
"/oradata/chicago/undotbs01.dbf";
set newname for datafile 5 to
"/oradata/chicago/pdbseed/system01.dbf";
set newname for datafile 6 to
"/oradata/chicago/users01.dbf";
set newname for datafile 7 to
"/oradata/chicago/pdbseed/sysaux01.dbf";
set newname for datafile 8 to
"/oradata/chicago/chicago1/system01.dbf";
set newname for datafile 9 to
"/oradata/chicago/chicago1/sysaux01.dbf";
set newname for datafile 10 to
"/oradata/chicago/chicago1/SAMPLE_SCHEMA_users01.dbf";
set newname for datafile 11 to
"/oradata/chicago/chicago1/example01.dbf";
backup as copy reuse
datafile 1 auxiliary format
"/oradata/chicago/system01.dbf" datafile
3 auxiliary format
"/oradata/chicago/sysaux01.dbf" datafile
4 auxiliary format
"/oradata/chicago/undotbs01.dbf" datafile
5 auxiliary format
"/oradata/chicago/pdbseed/system01.dbf" datafile
6 auxiliary format
"/oradata/chicago/users01.dbf" datafile
7 auxiliary format
"/oradata/chicago/pdbseed/sysaux01.dbf" datafile
8 auxiliary format
"/oradata/chicago/chicago1/system01.dbf" datafile
9 auxiliary format
"/oradata/chicago/chicago1/sysaux01.dbf" datafile
10 auxiliary format
"/oradata/chicago/chicago1/SAMPLE_SCHEMA_users01.dbf" datafile
11 auxiliary format
"/oradata/chicago/chicago1/example01.dbf" ;
sql 'alter system archive log current';
}
executing Memory Script executing command: SET NEWNAME
.
.
executing command: SET NEWNAME executing command: SET NEWNAME renamed tempfile 1 to /oradata/chicago/temp01.dbf in control file
renamed tempfile 2 to /oradata/chicago/pdbseed/pdbseed_temp01.dbf in control file
renamed tempfile 3 to /oradata/chicago/chicago1/chicago1_temp01.dbf in control file executing command: SET NEWNAME executing command: SET NEWNAME executing command: SET NEWNAME executing command: SET NEWNAME
Starting backup at 11-JUL-13
channel c1: starting datafile copy
input datafile file number=00001 name=/oradata/boston/system01.dbf
channel c2: starting datafile copy
input datafile file number=00003 name=/oradata/boston/sysaux01.dbf
channel c3: starting datafile copy
input datafile file number=00009 name=/oradata/boston/boston1/sysaux01.dbf
channel c4: starting datafile copy
input datafile file number=00007 name=/oradata/boston/pdbseed/sysaux01.dbf
channel prim: starting datafile copy
input datafile file number=00011 name=/oradata/boston/boston1/example01.dbf
output file name=/oradata/chicago/chicago1/example01.dbf tag=TAG20130711T161217
channel prim: datafile copy complete, elapsed time: 00:02:16
channel prim: starting datafile copy
input datafile file number=00008 name=/oradata/boston/boston1/system01.dbf
output file name=/oradata/chicago/chicago1/sysaux01.dbf tag=TAG20130711T161217
channel c3: datafile copy complete, elapsed time: 00:03:42
channel c3: starting datafile copy
input datafile file number=00005 name=/oradata/boston/pdbseed/system01.dbf
output file name=/oradata/chicago/pdbseed/sysaux01.dbf tag=TAG20130711T161217
channel c4: datafile copy complete, elapsed time: 00:03:43
channel c4: starting datafile copy
input datafile file number=00004 name=/oradata/boston/undotbs01.dbf
output file name=/oradata/chicago/chicago1/system01.dbf tag=TAG20130711T161217
channel prim: datafile copy complete, elapsed time: 00:01:52
channel prim: starting datafile copy
input datafile file number=00006 name=/oradata/boston/users01.dbf
output file name=/oradata/chicago/users01.dbf tag=TAG20130711T161217
channel prim: datafile copy complete, elapsed time: 00:00:07
channel prim: starting datafile copy
input datafile file number=00010 name=/oradata/boston/boston1/SAMPLE_SCHEMA_users01.dbf
output file name=/oradata/chicago/undotbs01.dbf tag=TAG20130711T161217
channel c4: datafile copy complete, elapsed time: 00:00:47
output file name=/oradata/chicago/chicago1/SAMPLE_SCHEMA_users01.dbf tag=TAG20130711T161217
channel prim: datafile copy complete, elapsed time: 00:00:03
output file name=/oradata/chicago/sysaux01.dbf tag=TAG20130711T161217
channel c2: datafile copy complete, elapsed time: 00:04:55
output file name=/oradata/chicago/pdbseed/system01.dbf tag=TAG20130711T161217
channel c3: datafile copy complete, elapsed time: 00:01:12
output file name=/oradata/chicago/system01.dbf tag=TAG20130711T161217
channel c1: datafile copy complete, elapsed time: 00:05:05
Finished backup at 11-JUL-13 sql statement: alter system archive log current contents of Memory Script:
{
switch clone datafile all;
}
executing Memory Script datafile 1 switched to datafile copy
input datafile copy RECID=7 STAMP=820513044 file name=/oradata/chicago/system01.dbf
datafile 3 switched to datafile copy
input datafile copy RECID=8 STAMP=820513044 file name=/oradata/chicago/sysaux01.dbf
datafile 4 switched to datafile copy
input datafile copy RECID=9 STAMP=820513044 file name=/oradata/chicago/undotbs01.dbf
datafile 5 switched to datafile copy
input datafile copy RECID=10 STAMP=820513044 file name=/oradata/chicago/pdbseed/system01.dbf
datafile 6 switched to datafile copy
input datafile copy RECID=11 STAMP=820513044 file name=/oradata/chicago/users01.dbf
datafile 7 switched to datafile copy
input datafile copy RECID=12 STAMP=820513044 file name=/oradata/chicago/pdbseed/sysaux01.dbf
datafile 8 switched to datafile copy
input datafile copy RECID=13 STAMP=820513044 file name=/oradata/chicago/chicago1/system01.dbf
datafile 9 switched to datafile copy
input datafile copy RECID=14 STAMP=820513044 file name=/oradata/chicago/chicago1/sysaux01.dbf
datafile 10 switched to datafile copy
input datafile copy RECID=15 STAMP=820513045 file name=/oradata/chicago/chicago1/SAMPLE_SCHEMA_users01.dbf
datafile 11 switched to datafile copy
input datafile copy RECID=16 STAMP=820513045 file name=/oradata/chicago/chicago1/example01.dbf
Finished Duplicate Db at 11-JUL-13 sql statement: alter database add standby logfile ''/u01/app/oracle/oradata/chicago/stdbyredo1.log'' size 50M sql statement: alter database add standby logfile ''/u01/app/oracle/oradata/chicago/stdbyredo2.log'' size 50M sql statement: alter database add standby logfile ''/u01/app/oracle/oradata/chicago/stdbyredo3.log'' size 50M sql statement: alter database add standby logfile ''/u01/app/oracle/oradata/chicago/stdbyredo4.log'' size 50M sql statement: alter system archive log current sql statement: alter database recover managed standby database disconnect released channel: c1
released channel: c2
released channel: c3
released channel: c4
released channel: prim
released channel: aux RMAN> Recovery Manager complete.

7. Prepare Primary database to ship REDO to standby.  准备主数据库以将REDO发送到备用数据库

a, Define log_archive_config value,  定义log_archive_config值

This parameter should have all the participating databases in the same DG configuration. Lets say this parameter tells about primary and all the participating standby(physical,logical,far sync) in DG configuration.
此参数应使所有参与的数据库处于同一DG配置中。可以说,此参数说明了DG配置中的主要和所有参与的备用数据库(physical,logical,far sync)

SQL>ALTER SYSTEM SET log_archive_config='dg_config=(boston,Chicago)' SCOPE=BOTH;

System altered.

NOTE : log_archive_config value is not case sensitive.  --不区分大小写

b. Set remote log shipping,  设置远程日志传送

@primary,

SQL>alter system set log_archive_dest_6='service=chicago async valid_for=(all_logfiles,primary_role) db_unique_name=chicago';

System altered.                                                                         
NOTE : Here primary use ASYNC redo transport method to ship REDO to standby.  注意:这里主要使用ASYNC重做传输方法将REDO发送到备用数据库
For details on REDO transport related parameters refer,
Data Guard Concepts and Administration
12c Release 1 (12.1)

TOPIC : 17 LOG_ARCHIVE_DEST_n Parameter Attributes

c. Verify redo log shipping,  验证重做日志传送

SQL> alter system switch logfile;

System altered.

SQL> col error for a30
SQL> select dest_id,error,status,log_sequence,applied_scn from v$archive_dest where dest_id=2; DEST_ID ERROR STATUS LOG_SEQUENCE APPLIED_SCN
---------- ------------------------------ --------- ------------ -----------
2 VALID 63 2133221

8. Verify Standby is applying,  确认备用服务器正在应用

NOTE : MRP already started after the RMAN duplicate.  注意:RMAN复制后,MRP已经启动

SQL> select process,status,thread#,sequence#,blocks from v#managed_standby where process like '%MRP%';

process      status                   thread# sequence# blocks

-------------  ----------------------  --------------  -------------  --------
MRP WAITING_FOR_LOG 1 64 0

Creating a Physical Standby from Primary on Version 12c (Doc ID 1570958.1)的更多相关文章

  1. Data Guard Physical Standby - RAC Primary to RAC Standby 使用第二个网络 (Doc ID 1349977.1)

    Data Guard Physical Standby - RAC Primary to RAC Standby using a second network (Doc ID 1349977.1) A ...

  2. Creating a Physical Standby Database 11g

    1.Environment Item Primary database standby database Platform Redhat 5.4 Redhat 5.4 Hostname gc1 gc2 ...

  3. 【原】Configuring Oracle Data Guard In Physical Standby Database

    作者:david_zhang@sh [转载时请以超链接形式标明文章] http://www.cnblogs.com/david-zhang-index/p/5042640.html参照文档:https ...

  4. ORACLE Physical Standby DG 之fail over

    SQL> select thread#, low_sequence#, high_sequence# from v$archive_gap;确认下是否存在日志间隙,发现gap现象,说明failo ...

  5. [Oracle][DATAGUARD] PHYSICAL STANDBY环境里,使用CATALOG管理Primary和Standby

    1.先使用控制文件构筑好PHYSICAL STANDBY环境(Primary:Single 11.2.0.4,Standby Single 11.2.0.4) 2.构筑好Catalog用的服务器(Ca ...

  6. Flashing Back a Failed Primary Database into a Physical Standby Database(闪回FAILOVER失败的物理备库)

    文档操作依据来自官方网址:https://docs.oracle.com/cd/E11882_01/server.112/e41134/scenarios.htm#SBYDB4888 闪回FAILOV ...

  7. 11g Physical Standby配置

    一,准备   Database DB_UNIQUE_NAME Oracle Net Service Name Primary PROD PROD Physical standby PRODDG PRO ...

  8. DG - physical standby switchover切换过程

    一.切换前检查1.检查备库已经全部接收到主库的redo如果是最大可用性.最大保护性模式,可以在primary端查看v$archive_dest_status,确认是否所有的redo已经传送到备库#在主 ...

  9. 建立ORACLE10G DATA GUARD---&gt;Physical Standby

    下面是我自己建Physical Standby,按照下面的步骤一步我一步,当然,打造成功,以下步骤可以作为建筑物Data Guard结构操作手册. HA和DG差额:HA:可以做IP切换自己主动  DG ...

随机推荐

  1. GZIP怎么运用在.NET MVC 简单实现

    ZIP压缩其实就是将网页内容压缩,减少HTML代码网络传输的代价,来提高Web性能. 这个请求的过程解释一下: 1:客户端Request请求.Http_header中会根据相应的浏览器发送相应的编码规 ...

  2. UVA11324 The Lagest Lique(SCC缩点+DP)

    Given a directed graph G, con- sider the following transformation. First, create a new graph T(G) to ...

  3. 基于STM32 HID 游戏手柄开发调试

    stm32自带usb接口,非常适合做hid设备,免驱开发也很方便. 使用stm32通过正确的报告描述符配置后,插入usb,电脑正确识别如下(设备和打印机) 可以通过右键,游戏控制器设置 通过选择属性 ...

  4. 从零开始的openGL——四、纹理贴图与n次B样条曲线

    前言 在上篇文章中,介绍了如何加载绘制模型以及鼠标交互的实现,并且遗留了个问题,就是没有模型表面没有纹理,看起来很丑.这篇文章将介绍如何贴纹理,以及曲线的绘制. 纹理贴图 纹理加载 既然是贴图,那首先 ...

  5. 联合查询和数据库设计e-r图

    联合查询: 联合查询的关键字是: union 基本含义 联合查询就是将两个select语句的查询结果“层叠”到一起成为一个“大结果”. 两个查询结果的能够进行“联合”的先觉条件是:结果字段数相等. 就 ...

  6. Java读取Properties文件 Java加载配置Properties文件

    static{ Properties prop = new Properties(); prop.load(Thread.currentThread().getContextClassLoader() ...

  7. 【设计模式】单例模式-Singleton

    [设计模式]单例模式-SingletonEnsure a class has only one instance, and provide a global point to access of it ...

  8. 11条MySQL规范,你知道的有几个?

    一.数据库命令规范 · 所有数据库对象名称必须使用小写字母并用下划线分割 · 所有数据库对象名称禁止使用mysql保留关键字(如果表名中包含关键字查询时,需要将其用单引号括起来) · 数据库对象的命名 ...

  9. Ubuntu 18.04 美化配置

    网上很多关于Ubuntu 18.04 美化的配置,但每个人遇见的问题都有些不太一样, 现将本人配置的过程整理如下 更新源为阿里云 找到Software & Updates,将源更新为阿里云的源 ...

  10. 2.java三大特性

    1. 封装 方法:将属性值修饰为私有,提供get和set方法.造成所有对对象的访问都是通过方法的调用来完成(配合this的使用) 结果:用户不能直接随意改变一个对象内的属性,必须通过调用方法(验证)来 ...