How to create a logical standby database based on a physical standby database

The related steps about how to create a phisical standby database please refer:   http://blog.csdn.net/waterxcfg304/article/details/35991771

/* How to create a logical standby database based on a physical standby database   */

以下是主库:

下列语句可以用来检查SQL应用能否唯一识别表列,并找出不被支持的表:查询哪个表不支持logical standby传输

SQL> select owner, table_name from dba_logstdby_not_unique where (owner, table_name) not in (select distinct owner, table_name from dba_logstdby_unsupported)

and bad_column = ‘Y‘ order by owner, table_name;

OWNER                          TABLE_NAME

------------------------------ ------------------------------

TSMSYS                         SRS$

/*<---对不支持的表tsmsys操作后即可支持logical standby transforming--------------------

rely disable represents that the oracle will not maintain this function

>*/

alter table tsmsys.srs$ add primary key (cursor) rely disable;

select username from dba_users where username not in (select owner from dba_logstdby_skip) order by username;

select supplemental_log_data_min, supplemental_log_data_pk, supplemental_log_data_ui from v$database;

alter database add supplemental log data (primary key,unique index) columns;

<*----------------------以下语句主备库都要执行--------------------------*>

alter system set parallel_max_servers = 40;

alter system set control_file_record_keep_time = 30;

alter system set undo_retention = 3600;

alter system set log_archive_max_processes = 4;

create pfile from spfile;

<*--------------------------end-----------------------------------------*>

Primary Database: Logical Standby Role Initialization Parameters

alter system set LOG_ARCHIVE_DEST_3=‘LOCATION=/u01/app/oracle/arch2/chicago VALID_FOR=(STANDBY_LOGFILES,STANDBY_ROLE) DB_UNIQUE_NAME=chicago‘;

alter system set LOG_ARCHIVE_DEST_STATE_3=ENABLE;

Standby Database: Logical Standby Role Initialization Parameters

alter system set LOG_ARCHIVE_DEST_3=‘LOCATION=/u01/app/oracle/arch2/boston VALID_FOR=(STANDBY_LOGFILES,STANDBY_ROLE) DB_UNIQUE_NAME=boston‘;

alter system set LOG_ARCHIVE_DEST_STATE_3=ENABLE;

Start to implement logical standby:

1, standby database:

alter database recover managed standby database cancel;

2, Primary database:To build the LogMiner dictionary, issue the following statement:

SQL> EXECUTE DBMS_LOGSTDBY.BUILD;

3, Physical database:Convert to a Logical Standby Database

The redo logs contain the information necessary to convert your physical standby database to a logical standby database. To continue applying redo data to the physical

standby database until it is ready to convert to a logical standby database, issue the following SQL statement:

SQL> ALTER DATABASE RECOVER TO LOGICAL STANDBY boston;

For db_name, specify a database name to identify the new logical standby database. If you are using a server parameter file (spfile) at the time you issue this statement, then the database will update the file with appropriate
information about the new logical standby database. If you are not using an spfile, then the database issues a message reminding you to set the name of the DB_NAME parameter after shutting down the database. The statement waits, applying redo data until the
LogMiner dictionary is found in the log files. This may take several minutes, depending on how long it takes redo generated in Section 4.2.3.2, "Build a Dictionary in the Redo Data" to be transmitted to the standby database, and how much redo data need to
be applied. If a dictionary build is not successfully performed on the primary database, this command will never complete. You can cancel the SQL statement by issuing the ALTER DATABASE RECOVER MANAGED STANDBY DATABASE CANCEL statement from another SQL session.

4, Standby database:Create a New Password File

Because the conversion process changes the database name (that was originally set with the DB_NAME initialization parameter) for the logical standby database, you must re-create the password file. See Oracle Database Administrator‘s Guide for more information
on creating a secure authentication scheme.

[[email protected] dbs]$ orapwd file=orapwboston password=oracle entries=5 force=y

5, Logical Standby database: Adjust Initialization Parameters for the Logical Standby Database

On the logical standby database, shutdown the instance and issue the STARTUP MOUNT statement to start and mount the database. Do not open the database; it should remain closed to user access until later in the creation process. For example:

SQL> SHUTDOWN;

SQL> STARTUP MOUNT;

unlike physical standby databases, logical standby databases are open databases that generate redo data and have multiple log files (online redo log files, archived redo log files, and standby redo log files)

6, Logical standby database:Open the Logical Standby Database

The new database is logically the same as your primary database, but it is transactionally inconsistent with the primary database, and thus incompatible for recover operations. To open the new logical standby database, you must open it with the RESETLOGS option
by issuing the following statement:

SQL> ALTER DATABASE OPEN RESETLOGS;

Because this is the first time the database is being opened, the database’s global name is adjusted automatically to match the new DB_NAME initialization parameter.

Issue the following statement to begin applying redo data to the logical standby database. For example:

SQL> ALTER DATABASE START LOGICAL STANDBY APPLY IMMEDIATE;

The following are testing data from primary database and logical standby database respectively.

SQL> !hostname

chicago.oracle.com

SQL> select count(*) from test;

COUNT(*)

----------

1048576

SQL> !hostname

boston.oracle.com

SQL>  select count(*) from test;

COUNT(*)

----------

1048576

7, Using Real-Time Apply to Apply Redo Data Immediately

If the real-time apply feature is enabled, log apply services can apply redo data as it is received, without waiting for the current standby redo log file to be archived. This results in faster switchover and failover times because the standby redo log files
have been applied already to the standby database by the time the failover or switchover begins.

Use the ALTER DATABASE statement to enable the real-time apply feature, as follows:

i, For physical standby databases, issue the

ALTER DATABASE RECOVER MANAGED STANDBY DATABASE USING CURRENT LOGFILE statement.

ii, For logical standby databases, issue the

ALTER DATABASE START LOGICAL STANDBY APPLY IMMEDIATE statement.

Standby redo log files are required to use real-time apply.

How to create a logical standby database based on a physical standby database,布布扣,bubuko.com

时间: 2024-10-12 16:48:02

How to create a logical standby database based on a physical standby database的相关文章

Oracle创建Physical Standby Database案例

The following is the detail steps of how to create a physical standby database: This case is created, operated and followed on the steps from oracle online help documentation. The configuration of the two sites server as following: Primary Database:

OCM 11g升级考试第二场搭建DataGuard遇到: prod - Physical standby database (disabled) 错误

转载请注明出处:http://blog.csdn.net/guoyjoe/article/details/43989607 1.**************************DGMGRL DGMGRL> show configuration; Configuration - c1 Protection Mode: MaxPerformance  Databases:    orcl - Primary database    prod - Physical standby database

DGMGR-TO PHYSICAL STANDBY Failed (ORA12514 )解决方法

TO  PHYSICAL STANDBY  Failed  (ORA-12514: )解决方法: ==========DG 环境: DGMGRL> SHOW CONFIGURATION; Configuration - DRSolution Protection Mode: MaxAvailability Databases: PROD1 - Primary database SBDB1 - Physical standby database Fast-Start Failover: DISAB

【翻译自mos文章】将一个失败的primary database 复原为physical standby 库的步骤

将一个失败的primary database 复原为physical standby 库的步骤 参考自: Step by Step Guide on How To Reinstate Failed Primary Database into Physical Standby (文档 ID 738642.1) 适用于: Oracle Database - Enterprise Edition - Version 10.1.0.2 and later Information in this docu

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

APPLIES TO: Oracle Database Cloud Schema Service - Version N/A and laterOracle Database Exadata Cloud Machine - Version N/A and laterOracle Cloud Infrastructure - Database Service - Version N/A and laterOracle Database Exadata Express Cloud Service -

Oracle DG之--构建Physical Standby

Oracle DG之--构建Physical Standby 系统环境: 操作系统: RedHat EL4 Oracle:    Oracle 10.2.0.1.0                                   从以上图中所示:主库为bj(db_unique_name),备库为sh. 案例分析:  本案例采用RMAN Duplicate方式建立standby database. 一.配置主备库初始化参数 主库的初始化参数:initbj.ora [[email protect

[Oracle] 临时将Physical Standby激活

Oracle 10g/11g下如何将物理Standby库临时激活用于测试 在实际运营环境中,我们经常碰到类似这样的需求,譬如想不影响现网业务评估DB补丁在现网环境中运行的时间,或者是想在做DB切换前想连接Standby DB做实际业务运行的测试,如果在9i版本的时候,想做到这样,在不搭建新测试环境的前提下,可以将Standby DB激活后进行测试,但是激活后的Standby DB将不能再用于容灾,必须重建Standby DB.在10g以及11g之后,可以利用新特性很好的解决这个问题,激活的Sta

read write方式打开PHYSICAL STANDBY,闪回和还原测试

以下大部分都在STANDBY执行,主库执行(两次)的会提示 [STANDBY read write方式打开测试]检查standby状态SQL> SELECT NAME,DATABASE_ROLE,OPEN_MODE,SWITCHOVER_STATUS FROM V$DATABASE; NAME DATABASE_ROLE OPEN_MODE SWITCHOVER_STATUS--------- ---------------- -------------------- -------------

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

APPLIES TO: Oracle Database - Enterprise Edition - Version 11.2.0.1 and laterOracle Database Cloud Schema Service - Version N/A and laterOracle Database Exadata Express Cloud Service - Version N/A and laterOracle Database Exadata Cloud Machine - Vers