Migrating to RAC using Data Guard (Doc ID 273015.1)

APPLIES TO:

Oracle Database Cloud Exadata Service - Version N/A and later
Oracle Database Cloud Service - Version N/A and later
Oracle Database - Enterprise Edition - Version 9.2.0.1 to 9.2.0.8 [Release 9.2]
Oracle Database Cloud Schema Service - Version N/A and later
Oracle Database Exadata Express Cloud Service - Version N/A and later
Information in this document applies to any platform.
***Checked for relevance on 16-Jul-2014***
** Checked for relevance '25-Nov-2015' **

PURPOSE

The following procedure can be used to quickly and efficiently migrate a non RAC primary database that utilizes a filesystem for datafile storage to a RAC database that utilizes ASM for datafile storage. This procedure creates a RAC standby from a non RAC primary database which can then be used for a role transition. Redo Transport Services are configured to use EZ Connect format for services.

以下过程可用于快速有效地将利用文件系统存储数据文件的非RAC主数据库迁移到利用ASM数据存储文件的RAC数据库。此过程从非RAC主数据库创建RAC备用数据库,然后将其用于角色转换。重做传输服务配置为使用EZ Connect格式的服务。

SCOPE

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:  为了本文档的目的,以下虚拟环境用作描述此过程的示例:

The example that follows utilizes the following values:  下面的示例使用以下值

Initial Primary Database: 初始主数据库

HOSTNAME prim1
ORACLE_SID MTS10
DB_UNIQUE_NAME MTS10_prim1
SERVICE_NAMES MTS10

Initial RAC Standby Database:  初始RAC备用数据库

  Node1  Node2
HOSTNAME stdby1 stdby2
ORACLE_SID MTS101 MTS102
DB_UNIQUE_NAME MTS101_stdby MTS10_stdby
SERVICE_NAMES MTS10 MTS10
INSTANCE_NAME MTS101 MTS102
INSTANCE_NUMBER 1 2
THREAD 1 2
UNDO_TABLESPACE UNDOTBS1 UNDOTBS2

DETAILS

Configure the Primary Database for Data Guard  为Data Guard配置主数据库

1. Enable archiving.

If the primary database is not currently in archivelog mode perform the following steps to enable archiving:  如果主数据库当前不在归档日志模式下,请执行以下步骤以启用归档

SQL> shutdown immediate;
SQL> startup mount;
SQL> alter database archivelog;
SQL> alter database open;

2. Create a password file on the primary database.  在主数据库上创建一个密码文件

To support 10g log transport authentication it is mandatory that every database in a Data Guard configuration utilize a password file. In addition, the sys password must be the same within in the password file for each database. If the primary database does not currently have a password file use the following steps to create one:  为了支持10g日志传输身份验证,Data Guard配置中的每个数据库都必须使用密码文件。此外,每个数据库的密码文件中的sys密码必须相同。如果主数据库当前没有密码文件,请使用以下步骤创建一个

$ cd $ORACLE_HOME/dbs
$ orapwd file=orapwOrlando password=<password>

After creating the password file you must take the database to the mount state and set the following parameter:  创建密码文件后,必须使数据库进入mount状态并设置以下参数

SQL> alter system set remote_login_passwordfile=exclusive scope=spfile;

3. Enable force logging.

It is a best practice to place the primary database in force logging mode so that all operation are captured in the redo stream. To place the primary database in force logging mode issue the following SQL:  最佳实践是将主数据库置于强制日志记录模式,以便所有操作均在重做流中捕获。要将主数据库置于强制日志记录模式,请发出以下SQL

SQL> alter database force logging;

4. Configure the Primary Database Initialization Parameters. 配置主数据库初始化参数

#### Primary Role Parameters ####

db_unique_name=MTS10_prim1
service_names=MTS10
db_file_recovery_dest='/u03/oracle/10/flash_recovery_area'
log_archive_config='dg_config=(MTS10_prim1,MTS10_stdby)'
log_archive_dest_2='service=stdby1/MTS101 valid_for=(online_logfiles,primary_role) db_unique_name=MTS10_stdby'
log_archive_dest_state_2=defer

#### Standby Role Parameters ####

db_file_name_convert=('+DATA/mts10/datafile/','/u03/oracle/10/oradata/MTS10/')
log_file_name_convert=('+DATA/mts10/onlinelog/','/u03/oracle/10/oradata/MTS10/')
standby_file_management=AUTO
fal_server='stdby1/MTS101','stdby2/MTS102'
fal_client='prim1/MTS10'

Prepare for RAC conversion:  准备RAC转换

1. Add additional threads of redo and standby redo logs.  添加其他重做和备用重做日志线程。

Each instance in a RAC database must have it's own thread of redo. Prior to creating the RAC standby and prior to switchover we must create the additional threads of redo.  RAC数据库中的每个实例必须具有其自己的重做线程。在创建RAC备用数据库之前和切换之前,我们必须创建其他重做线程

SQL> alter database
        add logfile thread 2
        group 4 ('/u03/oracle/10/oradata/MTS10/redo2_01.log') size 10M,
        group 5 ('/u03/oracle/10/oradata/MTS10/redo2_02.log') size 10M,
        group 6 ('/u03/oracle/10/oradata/MTS10/redo2_03.log') size 10M;

SQL> alter database enable public thread 2;

2. Add an undo tablespace for each instance.  为每个实例添加一个撤消表空间

Each instance in a RAC database must have it's own undo tablespace. Using the following syntax to create a undo tablespace for each instance that you will have:  RAC数据库中的每个实例都必须具有自己的撤消表空间。使用以下语法为每个实例创建一个撤消表空间

SQL> create undo tablespace "undotbs2" datafile
         '/u03/oracle/10/oradata/MTS10/undotsb2.dbf' size 200m;

3. Run catclust.sql  运行catclust.sql

To create RAC specific views in preparation for switchover run the catclust.sql script located in $ORACLE_HOME/rdbms/admin on the primary database:  要创建RAC特定视图以准备进行切换,请在主数据库上运行$ORACLE_HOME/rdbms/admin中的catclust.sql脚本

SQL> @?/rdbms/admin/catclust.sql

Create the Standby

1. Create standby initialization parameter files for each instance of the standby RAC database.  为备用RAC数据库的每个实例创建备用初始化参数文件

On the primary database create a text initialization parameter file from the spfile: 在主数据库上,从spfile创建一个文本初始化参数文件

SQL> create pfile from spfile;

Edit the text initialization parameter file to include instance specific parameters as such:  编辑文本初始化参数文件以包括实例特定的参数,例如

#### Primary Role Parameters ####

*.control_files='+DATA/mts10_stdby/controlfile/control01.ctl'
*.db_create_file_dest='+DATA'
*.db_recovery_file_dest='+DATA'
*.cluster_database=true
MTS101.instance_name='MTS101'
MTS102.instance_name='MTS102'
MTS101.instance_number=1
MTS102.instance_number=2
MTS101.thread=1
MTS102.thread=2
MTS101.undo_tablespace='UNDOTBS1'
MTS102.undo_tablespace='UNDOTBS2'
*.db_unique_name=MTS10_stdby
*.service_names=MTS101
*.db_recovery_file_dest='+DATA'
*.log_archive_config='dg_config=(MTS10_prim1,MTS10_stdby)'
*.log_archive_dest_2='service=prim1/MTS10 valid_for=(online_logfiles,primary_role) db_unique_name=MTS10_prim1'

#### Standby Role Parameters ####

*.db_file_name_convert=('/u03/oracle/10/oradata/mts10/','+data/mts10/datafile/')
*.log_file_name_convert=('/u03/oracle/10/oradata/mts10/','+data/mts10/onlinelog/')
*.standby_file_management=auto
*.fal_server='prim1/MTS10'
MTS101.fal_client='stdby1/MTS101'
MTS102.fal_client='stdby1/MTS102'

Transfer the modified init.ora to the ORACLE_HOME/dbs directory on each node. Rename the init.ora's to the match the ORACLE_SID.  将修改后的init.ora传输到每个节点上的ORACLE_HOME/dbs目录。重命名init.ora以匹配ORACLE_SID。

2. On each standby host, create a password file.  在每个备用主机上,创建一个密码文件

$ orapwd file=orapwMTS101 password=<password>
$ orapwd file=orapwMTS102 password=<password>

3. After setting up the appropriate environment variables, start the standby database instance without mounting the control file.  设置适当的环境变量后,在不装入控制文件的情况下启动备用数据库实例

SQL> startup nomount pfile=?/dbs/initMTS10.ora

4. Perform an RMAN backup of the primary database placing the backup pieces in a location that is accessible from both the primary host as well as the standby hosts.  对主数据库执行RMAN备份,将备份片段放置在可从主主机和备用主机访问的位置

RMAN> backup device type disk format '/u01/home/mtsmith/%U' database plus archivelog;
RMAN> backup device type disk format '/u01/home/mtsmith/%U'current controlfile for standby;

5. Duplicate the primary database as a standby into the ASM diskgroup. From the standby host on which the standby instance is not mounted:  将主数据库Duplicate到standby 的ASM磁盘组中。 从not mounted备用实例的备用主机上:

$ rman target sys/<password>@prim1/MTS10 auxiliary /
RMAN> duplicate target database for standby;

6. Define the new physical RAC standby using srvctl.  使用srvctl定义新的物理RAC备用数据库

As the Oracle user on the standby host:  作为备用主机上的Oracle用户

srvctl add database -d MTS10_stdby -o /u03/app/oracle/product/10.1.0/db -r PHYSICAL_STANDBY -s mount
srvctl add instance -d MTS10_stdby -i MTS101 -n stdby1
srvctl add instance -d MTS10_stdby -i MTS102 -n stdby2
srvctl add service -d MTS10_stdby -s MTS10 -r MTS101,MTS102

As root on the standby host (10.1 only):  以root身份在备用主机上(仅10.1)

srvctl add nodeapps -n stdby1 -o /u03/app/oracle/product/10.1.0/db -A x.xx.xxx.xxxx\x.xx.xxx.xxxx # IP\netmask

7. On the primary database enable the previously deferred remote destination.  在主数据库上,启用先前延迟的远程目标

SQL> alter system set log_archive_dest_state_2=enable scope=both;

8. Place the standby in managed recovery.  将备用数据库置于托管恢复中。

SQL> alter database recover managed standby database disconnect;

9. Validate that the standby is correctly applying redo from the primary.  验证备用数据库是否正确地从主数据库应用重做。

On the standby database, query the V$ARCHIVED_LOG view to identify existing archived redo logs. For example:  在备用数据库上,查询V$ARCHIVED_LOG视图以标识现有的归档重做日志。例如:

SQL> select sequence#, first_time, next_time
        from v$archived_log order by sequence#;

On the primary database, archive the current log using the following SQL statement: 在主数据库上,使用以下SQL语句归档当前日志

SQL> alter system archive log current;

On the standby database, query the V$ARCHIVED_LOG view again to ensure that the latest log is registered.  在备用数据库上,再次查询V$ARCHIVED_LOG视图以确保已注册最新日志

SQL> select sequence#, first_time, next_time
          from v$archived_log order by sequence#;

On the standby database find out where the temporary data files should be by querying DBA_TABLESPACES.  在备用数据库上,通过查询DBA_TABLESPACES找出临时数据文件应在的位置

SQL> select tablespace_name from dba_tablespaces
           where contents = 'TEMPORARY';

For each tablespace identified above, add a new temporary file to the standby database.  对于上面标识的每个表空间,将一个新的临时文件添加到备用数据库

SQL> alter tablespace temp add tempfile size 40m;

Switchover Production to the new RAC Database  将生产切换到新的RAC数据库

When the redo is being shipped from the Primary to your new RAC Standby wait for the standby to be fully synchronized with the Primary database and then perform a switchover to move production to your RAC database. Refer to the MAA paper "Data Guard Switchover and Failover" and the Data Guard Concepts and Administration manual "7.2 Role Transitions Involving Physical Standby Databases" for the details on how to perform the switchover.

当重做从主数据库传送到新的RAC备用数据库时,请等待备用数据库与主数据库完全同步,然后执行切换以将生产移至RAC数据库。有关如何执行切换的详细信息,请参阅MAA论文“ Data Guard切换和Failove r”以及Data Guard概念和管理手册“ 7.2涉及物理备用数据库的角色转换 ”。

使用Data Guard迁移到RAC (Doc ID 273015.1)的更多相关文章

  1. 使用Active Database Duplication创建跨平台Data Guard设置 (Windows/Linux) (Doc ID 881421.1)

    Using Active Database Duplication to Create Cross Platform Data Guard Setup (Windows/Linux) (Doc ID ...

  2. 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 ...

  3. Oracle 11gR2 Database和Active Data Guard迁移案例

    客户一套核心系统由一台Oracle Database 11.2.0.3.4单机和一台Active Data Guard组成,分别运行在两台PC服务器上,Oracle Linux 5.8 x86_64b ...

  4. Undo 相关的等待事件和已知问题 (Doc ID 1575701.1)

    Undo Related Wait Events & Known Issues (Doc ID 1575701.1) APPLIES TO: Oracle Database - Enterpr ...

  5. 如何计算Data Guard环境中Redo所需的网络带宽传输 (Doc ID 736755.1)

    How To Calculate The Required Network Bandwidth Transfer Of Redo In Data Guard Environments (Doc ID ...

  6. 12c Data guard Switchover Best Practices using SQLPLUS (Doc ID 1578787.1)

    12c Data guard Switchover Best Practices using SQLPLUS (Doc ID 1578787.1) APPLIES TO: Oracle Databas ...

  7. 11.2 Data Guard Physical Standby Switchover Best Practices using SQL*Plus (Doc ID 1304939.1)

    11.2 Data Guard Physical Standby Switchover Best Practices using SQL*Plus (Doc ID 1304939.1) APPLIES ...

  8. Data Guard:Oracle 12c –新增和更新的功能 (Doc ID 1558256.1)

    Data Guard: Oracle 12c – New and updated Features (Doc ID 1558256.1) APPLIES TO: Oracle Database - E ...

  9. 12.2 中的Data Guard Standby 密码文件自动同步 (Doc ID 2307365.1)

    Data Guard Standby Automatic Password file Synchronization in 12.2 (Doc ID 2307365.1) APPLIES TO: Or ...

随机推荐

  1. 通信协议TLV的介绍及在python下的代码实现及仿真

    TLV协议是一种通讯协议,一般将数据封装成TLV的形式,即Tag,Length,Value.协议就是指通信双方对数据传输控制的一种规定,规定了数据格式,同步方式,传送速度,传送步骤的问题作出统一的规定 ...

  2. 超简单!asp.net core前后端分离项目使用gitlab-ci持续集成到IIS

    现在好多使用gitlab-ci的持续集成的教程,大部分都是发布到linux系统上的,但是目前还是有很大一部分企业使用的都是windows系统使用IIS在部署.NET应用程序.这里写一下如何使用gitl ...

  3. 8种经常被忽视的SQL错误用法,你有没有踩过坑?

    1.LIMIT 语句 分页查询是最常用的场景之一,但也通常也是最容易出问题的地方.比如对于下面简单的语句,一般 DBA 想到的办法是在 type, name, create_time 字段上加组合索引 ...

  4. CCF-CSP题解 201609-3 炉石传说

    模拟. 注意随从的编号在\(summon\)和\(attack\)随从死亡时都可能改变. #include <bits/stdc++.h> using namespace std; str ...

  5. javascript对url进行编码和解码

    这里总结下JavaScript对URL进行编码和解码的三个方法. 为什么要对URL进行编码和解码 只有[0-9[a-Z] $ - _ . + ! * ' ( ) ,]以及某些保留字,才能不经过编码直接 ...

  6. JPA中实现双向一对一的关联关系

    场景 JPA入门简介与搭建HelloWorld(附代码下载): https://blog.csdn.net/BADAO_LIUMANG_QIZHI/article/details/103473937 ...

  7. 「SAP技术」SAP VL02N 执行批次拆分报错,说不允许批次拆分?

    1,如下新建的DN 80017843,storage location 字段值为空.VL02N 试图去做批次拆分失败,系统报错说,Batch split is not permitted for ma ...

  8. adb shell常用命令

    一.文件操作相关命令 1.文件操作命令 子命令 参数 说明 cd 无 进入目录 cat [-beflnstuv] [-B bsize] [file...] 查看文件内容-n:显示行号-b:显示行号,但 ...

  9. mysql数据库排坑过程

    刚安装mysql后想通过navicat来连接mysql,发现报错 1251这个错误,不慌.这个很简单. 首先通过cmd进入mysql. 然后修改密码规则 ALTER USER 'root'@'loca ...

  10. Django的Form验证(2)

    Django的Form验证(2) Form的含义及作用: 用于验证用户请求数据合法性的一个组件(校验数据的合法性) Django的Form实现步骤: 创建一个验证用户请求的模板 from django ...