You are on page 1of 26

11g Data Guard New Features

-- Fan Xiangrong

Agenda

Common changes

Password file Redo compress shipping


Active standby Snapshot database Corrupted block automatic replacement RMAN duplicate standby from active database Online modify logical standby parameters Compressed table is supported by logical standby SQL Apply will execute parallel DDLs in parallel

Physical standby changes


Logical standby changes


Agenda

Common changes

Password file Redo compress shipping


Active standby Snapshot database Corrupted block automatic replacement Use RMAN to build physical standby Dynamic parameters change Compressed table is supported by logical standby SQL Apply will execute parallel DDLs in parallel

Physical standby changes


Logical standby changes


Password file

Create password file on standby doesnt work. You need to copy password file from primary to standby.

Redo Compress Shipping

Add compression=enable to log_archive_dest_N parameter log_archive_dest_3 = 'service="(DESCRIPTION= (ADDRESS=(PROTOCOL=TCP)(HOST=qadb27.qa.eba y.com)(PORT=1799))(CONNECT_DATA=(SID=TEST2 )))" compression=enable reopen=5 lgwr async' For 11g R1, it only uses compression when resolving gaps. If you set hidden parameter _REDO_TRANSPORT_COMPRESS_ALL=TRUE, it will use compression for all redo transport.

Redo Compress Test


SQL to generate redo: create table test tablespace data01 as select * from dba_objects; begin for i in 1..8 loop insert into test select * from test; commit; end loop; end; / Check bytes received via SQL*Net from client statistics on standby. 1st test: Compression = enable Compression = disable 2st Test: Compression = enable Compression = disable 594M- 507M = 87M 959M- 595M = 364M 1046M-959M = 87M 1410M-1047M=363M

Compression rate is 24%. Different data can have different compress rate.

It needs License

Redo transport compression is a feature of the Oracle Advanced Compression option. You must purchase a license for this option before using the redo transport compression feature.

Agenda

Common changes

Password file Redo compress shipping


Active standby Snapshot database Corrupted block automatic replacement RMAN duplicate standby from active database Dynamic parameters change Compressed table is supported by logical standby SQL Apply will execute parallel DDLs in parallel

Physical standby changes


Logical standby changes


Active Standby

Simple Steps
Stop redo apply Open the database read only
Restart redo apply
SQL> RECOVER MANAGED STANDBY DATABASE CANCEL;

SQL> ALTER DATABASE OPEN READ ONLY; SQL> RECOVER MANAGED STANDBY DATABASE DISCONNECT USING CURRENT LOGFILE;

Disallow operations

Any DML (insert, update, delete) Any DDL Access of local sequences DMLs on local temporary tables

Check Standby Apply Status

V$database.current_scn records the current apply SCN. SQL> select scn_to_timestamp(current_scn) from v$database; SCN_TO_TIMESTAMP(CURRENT_SCN) --------------------------------------------------------------------------21-NOV-09 08.42.43.000000000 AM

Session level parameter STANDBY_MAX_DATA_DELAY(11g R2) The new STANDBY_MAX_DATA_DELAY session parameter can be used to specify a session-specific apply lag tolerance, measured in seconds, for queries issued by non-administrative users to a physical standby database that is in real-time query mode. Alter session set STANDBY_MAX_DATA_DELAY = { integer | NONE }

Snapshot database

A snapshot standby database is a fully update-able standby database that is created by converting a physical standby database into a snapshot standby database. Snapshot standby database receives and archives, but does not apply the redo data. Redo data received from the primary database is applied automatically once it is converted back into a physical standby database. All local updates will be discarded when snapshot database is converted back to physical standby database. In 10g version, we can do it manually.

10g Manual Steps

http://dbmonitor.vip.qa.ebay.com/dbblog/ main.php?name=Sub%20doc/2009.11.22% 2010g%20put%20standby%20in%20readwrite%20using%20flashback.htm

Convert to Snapshot database Steps

If not already configured , configure flash recovery area as given below

Set the size for recovery area. Alter system set db_recovery_file_dest_size=<size> Set Flash recovery area. (unset db_recovery_file_dest and set db_recovery_file_dest_1) Alter system set db_recovery_file_dest=<path>

Bring the physical standby database to mount stage. Stop managed recovery if it is active. Convert to snapshot standby database. ALTER DATABASE CONVERT TO SNAPSHOT STANDBY;

Shutdown and startup

Convert back to Physical Standby Steps

Shutdown the snapshot standby database. Bring the database to the mount stage. Issue the command
ALTER DATABASE CONVERT TO PHYSICAL STANDBY;

Shutdown the database and mount it . Start the media recovery process.

Corrupted block replacement

A corrupted data block in a primary database can be automatically replaced with an uncorrupted copy of that block from a physical standby database that is operating in real-time query mode. A corrupted block in a physical standby database can also be automatically replaced with an uncorrupted copy of the block from the primary database if LOG_ARCHIVE_CONFIG, LOG_ARCHIVE_DEST_n parameters are set on standby.

RMAN Duplicate Standby

RMAN Duplicate Standby

Prepare standby system

Setup listener Create an init.ora file with only db_name in it Create or copy a password file Startup nomount database Create spfile from pfile
Create spfile from pfile

Prepare primary system

RMAN build script


rman target sys/sys@test_pri AUXILIARY sys/sys@test_target run { allocate channel prmy1 type disk; allocate auxiliary channel stby1 type disk; duplicate target database for standby from active database spfile parameter_value_convert 'GBPGW','DDS' set db_unique_name='TEST' set control_files='/oracle/DDS/archive/TEST/control.ctl' set log_archive_dest_1='location=/oracle/DDS/archive/TEST/archive' set db_file_name_convert='/oracle/GBPGW/data01/TEST','/oracle/DDS/archive/TEST' set log_file_name_convert='/oracle/GBPGW/data01/TEST/redo','/oracle/DDS/archive/TEST/re do set log_archive_dest_3= nofilenamecheck; }

Agenda

Common changes

Password file Redo compress shipping


Active standby Snapshot database Corrupted block automatic replacement Use RMAN to build physical standby Dynamic parameters change Compressed table is supported by logical standby SQL Apply will execute parallel DDLs in parallel

Physical standby changes


Logical standby changes


Dynamic parameters change


select * from dba_logstdby_parameters SQL> / NAME VALUE UNIT SETTING DYNAMIC ------------------------------ -------------------- ---------- ---------- ---------MAX_SGA 30 MEGABYTE SYSTEM YES MAX_SERVERS 9 SYSTEM YES PREPARE_SERVERS 1 SYSTEM YES APPLY_SERVERS 5 SYSTEM YES MAX_EVENTS_RECORDED 10000 SYSTEM YES RECORD_SKIP_ERRORS TRUE SYSTEM YES RECORD_SKIP_DDL TRUE SYSTEM YES RECORD_APPLIED_DDL FALSE SYSTEM YES RECORD_UNSUPPORTED_OPERATIONS FALSE SYSTEM YES EVENT_LOG_DEST DEST_EVENTS_TABLE SYSTEM YES LOG_AUTO_DELETE TRUE SYSTEM YES LOG_AUTO_DEL_RETENTION_TARGET 1440 MINUTE SYSTEM YES PRESERVE_COMMIT_ORDER TRUE SYSTEM NO _EAGER_SIZE 1000 USER YES

Compressed table is supported (11.2)

DSS table compression

Create table compress as select

OLTP table compression

Alter table compress for all operations

Parallel DDL is supported


Primary: SQL> create index test1 on test(object_name) tablespace data01 parallel 4; Index created.

Target:
583 575 595 601 576 665 574 647 oracle@qadb27 (P002) oracle@qadb27 (P003) oracle@qadb27 (P000) oracle@qadb27 (P001) oracle@qadb27 (P004) oracle@qadb27 (P006) oracle@qadb27 (P005) oracle@qadb27 (P007) log buffer space 0/0/0 0 0 0/0 log buffer space 0/0/0 0 0 0/0 direct path read temp 103/1929/1 3 direct path read temp 103/14729/1 -1 PX Deq: Execution Msg 268566527/2/0 PX Deq: Execution Msg 268566527/2/0 PX Deq: Execution Msg 268566527/1/0 PX Deq: Execution Msg 268566527/1/0 A A 0 0/0 0 0/0 0 1 0/0 0 1 0/0 0 1 0/0 0 1 0/0 14 14 13 13 A 14 A 14 I 1 I 2 I 1 I 1

14 13 13 13 13 13

Others

Statspack on standby (454848.1) Support different platforms (413484.1) Big performance boost in Oracle 11G Up to 100% increase in redo apply performance

Review

Common changes

Password file Redo compress shipping (_REDO_TRANSPORT_COMPRESS_ALL=TRUE for 11gR1)


Active standby Snapshot database Corrupted block automatic replacement RMAN duplicate standby from active database

Physical standby changes


Logical standby changes

Online modify logical standby parameters Compressed table is supported by logical standby (11g R2) SQL Apply will execute parallel DDLs in parallel