标签:query migrate sele cal nis art validate ecif netmask
Migrating to RAC using Data Guard (Doc ID 273015.1)
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‘ **
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格式的服务。
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 |
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‘
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
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;
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)
标签:query migrate sele cal nis art validate ecif netmask
原文地址:https://www.cnblogs.com/zylong-sys/p/12041463.html