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. ELK filebeat的安装

    安装参考官方文档: https://www.elastic.co/guide/en/beats/filebeat/current/filebeat-installation.html 注意事项: Fr ...

  2. UESTC-1975弗吉桑(回文串,manacher算法)

    弗吉桑 Time Limit: 3000 MS     Memory Limit: 64 MB Submit Status 弗吉桑是一座横跨清水河大草原的活火山,位于子科技大学主楼东北方约 80km ...

  3. 通过ansible自动化部署zabbix应用

    zabbix在实际的应用中,可能需要监控的主机非常多,而每个主机的操作系统类型.版本也都不尽相同,在这种环境下,通过手动安装zabbix的agent端已经不现实了,此时就需要借助自动化工具完成zabb ...

  4. Appium之WebView自动化

    WebView的测试:主要作用在混合(Hybrid)的应用 * 一部分是原生界面和代码,而另一部分是内嵌网页 * 比如微信.支付宝 * 内嵌了一个浏览器内核,由浏览器内核实现的 安卓应用中的内嵌的展示 ...

  5. kubernetes-单机实验(入门)

    一.安装kubernetes   实验环境: centos7.0(建议使用7.5版本) 实验机器IP:192.168.1.4 安装方式:yum安装 需求环境:Tomcat+Mysql   1:关闭防火 ...

  6. Spring Bean Scope (作用域)

    singleton: 单例模式,针对每个spring容器,只有一个该类的实例被管理,每次调用此实例都是同一个对象被返回,所以适用于无状态bean.默认情况下,singleton作为spring容器中b ...

  7. MySQL的安装、启动和基础配置 —— windows版本

    下载 第一步:打开网址,https://www.mysql.com,点击downloads之后跳转到https://www.mysql.com/downloads 第二步 :跳转至网址https:// ...

  8. Python基础-day01-7

    程序执行原理(科普) 目标 计算机中的 三大件 程序执行的原理 程序的作用 01. 计算机中的三大件 计算机中包含有较多的硬件,但是一个程序要运行,有 三个 核心的硬件,分别是: CPU 中央处理器, ...

  9. 使用ASP.NET Core 3.x 构建 RESTful API - 3.4 内容协商

    现在,当谈论起 RESTful Web API 的时候,人们总会想到 JSON.但是实际上,JSON 和 RESTful API 没有半毛钱关系,只不过 JSON 恰好是RESTful API 结果的 ...

  10. IE浏览器下载文件保存时提示:“你没有权限在此位置中保存文件”解决办法

    E浏览器下载文件保存时提示 解决办法: 1.Win + R,打开运行命令,输入gpedit.msc,如图所示 2.打开计算机本地组策略编辑器:选择计算机配置-windows设置-安全设置-本地策略-安 ...