Interview Questions

Data Guard

Oracle Hot Standby, introduced in Oracle version 7.3, was marketed to the database community as a disaster recovery (DR) solution. In Oracle version 7.3, many of today’s automated processes had to be programmed to deliver successful implementations of disaster recovery using Oracle Hot Standby. Simple tasks such as transferring archivelogs had to be done manually by scripting the rcp/rsh or ftp process. In Oracle 8i, the Hot Standby product introduced new features such as the managed recovery process and read-only mode for standby databases.

In Oracle 9i Database, features such as logical standby database and Oracle Data Guard Broker made this product significantly more viable as a product for disaster recovery. Not only could it be used for high availability, but it could also be used for complex reporting systems. Unknown to a lot of the Oracle community, Oracle Data Guard was introduced as a product in Oracle 8i. It is in Oracle 9i Database that Hot Standby evolved into what we know today as the Data Guard technology. Oracle 9i Database introduced the marketing nomenclature known to all DBAs as Maximum Performance and Maximum Protection modes. In Oracle Database 10g, Data Guard is integrated with the flashback database and guaranteed savepoints. In this release, Oracle provides the capability to open the Data Guard database in read/write mode and flash back to a guaranteed restore point. In Oracle Database 11g, two major improvements have been added to the Data Guard product: the ability to open the database in read-only mode and still continue to apply redo known as real-time query standby and snapshot standby. The snapshot database provides the ability of the Data Guard database to open in read/write mode for operations such as stress/load testing, hotfix testing, code push validation, and so on, and be able to roll back the database to the precise point prior to opening the database in read/write mode and continue applying archivelogs.

Note :Oracle introduces another licensing option called Oracle Active Data Guard, which licenses the realtime query feature and the ability to use RMAN block change tracking on the standby database. This is an additional cost beyond the Enterprise Edition license.

Oracle packs significant new features in the Oracle Database 11g Data Guard technology stack. In this chapter, we will focus on all the latest and greatest Data Guard advancements:

  • Real-time query standby database
  • Snapshot standby database
  • Logical standby database improvements
  • Redo log compression
  • Data Guard Broker enhancements
  • Recovery Manager (RMAN) integration with Data Guard
  • Rolling upgrades with the physical standby
  • Fast-start failover improvements
Active Physical Standby Database Duplication

RMAN network-based duplication is one of the key new Oracle Database 11g features; with it, you can clone a database without a backup of the primary database server. This section will provide simple steps for creating a physical standby from an active database using RMAN. Some preparation steps are required prior to initiating an active physical standby database duplication over the network. First, create a blank initialization file with just one parameter in the file, specifically, DB_NAME=PRIMARY_DATABASE{DR} in the $ORACLE_HOME/dbs directory.

Second, the password file for sys must be the same on both the primary and Data Guard servers. You must use sftp/scp to transfer the files from the primary $ORACLE_HOME/dbs directory to the disaster recovery database server. You also need to create the required Oracle Database 11g Optimal Flexible Architecture (OFA)–related directories:

  • $ORACLE_BASE/admin/$ORACLE_SID/adump
  • $ORACLE_BASE/admin/$ORACLE_SID/pfile
  • $ORACLE_BASE/admin/$ORACLE_SID/wallet

Now, it’s time to create the listener.ora and tnsnames.ora file entries on both the primary and disaster recovery nodes. You need to make sure the appropriate entries are on both of the tnsnames.ora files. If you are planning to use the broker, you need to pay particular attention to the LISTENER file’s global_dbname parameter. The name of global_dbname must include the _dgmgrl parameter to it. For example, the following listener.ora entry is provided with the appropriate global_dbname parameter:

  SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = /apps/oracle/product/11.1.0/DB)
(PROGRAM = extproc)
)
(SID_DESC =
(GLOBAL_DBNAME = DBA11gDR_DGMGRL.dbaexpert.com)
(ORACLE_HOME = /apps/oracle/product/11.1.0/DB)
(SID_NAME = DBA11gDR)
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = bpo40.dbaexpert.com)(PORT = 1521))
)
)

After the appropriate changes are made, the database instance and the listeners need to be restarted on both the primary and physical standby database servers.

Lastly, the standby redo logs should be added on the primary standby database so that they will be duplicated as part of the active network–based physical standby duplication.

Mike Smith, a principal member of the technical staff in the High Availability group at Oracle, has provided a script to build a standby database. This RMAN script can single-handedly create a physical standby database over the network. This single integrated RMAN script will duplicate the source database over the network, copy the spfile, copy the controlfile, and duplicate the database. During the process, both the primary and standby initialization parameters will be updated to accommodate the Data Guard configuration.

You can use the following script to create a physical standby database from the remote node:

  rman <EOF>
connect target sys/oracle123@DBA11g;
connect auxiliary sys/oracle123@DBA11gDR;
  run {
allocate channel prmy1 type disk;
allocate channel prmy2 type disk;
allocate channel prmy3 type disk;
allocate channel prmy4 type disk;
allocate auxiliary channel stby type disk;

 duplicate target database for standby from active database spfile

  parameter_value_convert  'DBA11g','DBA11gDR'
set 'db_unique_name'='DBA11gDR'
set 'db_file_name_convert'='/DBA11g/','/DBA11gDR/'
set log_file_name_convert='/DBA11g/','/DBA11gDR/'
set control_files='/apps/oracle/oradata/DBA11gDR/control.ctl'
set log_archive_max_processes='5'
set fal_client='DBA11gDR'
set fal_server='DBA11g'
set standby_file_management='AUTO'
set log_archive_config='dg_config=(DBA11g,DBA11gDR)'
set log_archive_dest_1='service=DBA11g LGWR ASYNC
valid_for=(ONLINE_LOGFILES,PRIMARY_ROLE)
db_unique_name=DBA11g'
;
sql channel prmy1 "alter system set log_archive_config=''dg_
config=(DBA11g,DBA11gDR)''";
sql channel prmy1 "alter system set log_archive_dest_1=
''service=DBA11gDR LGWR ASYNC valid_for=(online_logfiles,primary_role)
db_unique_name=DBA11gDR''";
sql channel prmy1 "alter system set log_archive_max_processes=5";
sql channel prmy1 "alter system set fal_client=DBA11g";
sql channel prmy1 "alter system set fal_server=DBA11gDR";
sql channel prmy1 "alter system set standby_file_management=auto";
sql channel prmy1 "alter system set log_archive_dest_state_1=enable";
sql channel prmy1 "alter system archive log current";
allocate auxiliary channel stby type disk;
sql channel stby "alter database recover managed standby database
using current logfile disconnect";
}
EOF

Once the script successfully creates a standby database, you will be able to configure the additional options discussed in this chapter.

Note: We recommend that the DR database db_unique_name parameter should be named $ORACLE_ SID{DR}. The db_unique_name parameter of the primary database can be retrieved on the standby database by querying the PRIMARY_DB_UNIQUE_NAME column in the V$DATABASE view.

The db_unique_name parameter is treated differently in Oracle Database 11g. Databases with the same db_unique_name parameter will not be able to participate in a Data Guard configuration. If the primary and Data Guard standby database db_unique_name parameter is the same, these databases will not be able to communicate with each other after the upgrade.


Pragna Meter
Next Chapter  
e-University Search
Related Jobs