Chapter 7 - Oracle Data Guard: Surviving the Disaster Oracle Database 10g: High Availability with RAC Flashback

& Data Guard by Matthew Hart and Scott Jesse McGraw-Hill/Osborne © 2004 Citation

Creating a Physical Standby In this section we will perform our first Data Guard HA Workshop, which outlines the procedure to create a physical standby. If we strip it down to the bare essentials, we see exactly how easy it is: create a backup of the primary, create a standby controlfile, transfer the files to the standby host, and mount the standby. Although it is really that simple, we will go into great detail so that we can make the right choices up front and thus save ourselves heartache later. HA Workshop: Creating a Physical Standby Workshop Notes The following names will be used when building our configuration: Host hasun1 hasun2 Database Type Primary Physical Standby DB_UNIQUE_NAME Orlando Nashville TNS Alias Orlando_hasun1 Nashville_hasun2

Properly configuring the primary database prior to creating the standby will ensure easier maintance and will smooth the road to later role transitions. While some steps are not mandatory, we will explain the benefits to illustrate how those choices can result in a more sound disaster recovery solution. Also, as several steps involve bouncing the primary, you should attempt to consolidate those steps to reduce the number of bounces. Step 1. Enable archiving.

it is mandatory that every database in a Data Guard configuration utilize a password file. Any nologging operations performed on the primary are not fully logged within the redo stream. enter the following as sys: alter database force logging. In addition. alter database archivelog. If the primary database does not currently have a password file. Standby redo logs are highly recommended regardless of your protection mode. Due to new log transport security and authentication features. nologging operations are permitted to run. such as maximum protection and maximum availability. as generally more data can be recovered during a failover than without them. Create standby redo logs (optional). To place the primary into archivelog. you must set the following parameter in the spfile while the database is in the nomount state: alter system set remote_login_passwordfile=exclusive scope=spfile. but the changes are placed into the redo stream anyway. Create a password file. To place the primary database in forced logging mode. In this mode. alter database open. Certain protection modes. As Data Guard depends on the redo stream to maintain the standby. Enable force logging (optional). The LOG_ARCHIVE_START parameter is no longer necessary in Oracle Database 10g. One solution is to place the primary database into force logging mode. This assures that a sound disaster recovery solution is maintained. A best practice is to . create one with the following steps: $cd $ORACLE_HOME/dbs $orapwd file=orapwOrlando password=Not4U Once the password file is created. Automatic archiving is enabled by default when the database is placed into archivelog mode. startup mount. it is difficult to know when nologging operations are occurring. perform the following steps: shutdown immediate. this can cause a lot of additional work for the DBA. Step 2.As Data Guard is dependant on redo to maintain the standby. mandate that standby redo logs be present. In addition. we must assure that the primary database is in archivelog mode. Step 3. Step 4. the password for the sys user must be identical on every system for log transport services to function.

dbf') SIZE 500M.create the standby redo logs on both the primary and the standby so as to make role transitions smoother. The following syntax is used to create the standby redo logs: alter database add standby logfile thread 1 ('/database/10gDR/srl1a. By creating standby redo logs at this stage. it is important to consider future role transitions. The parameters shown here are to be placed into the primary init. we should have one more standby redo log file group than the number of online redo log file groups on the primary database.PRIMARY_ROLE) DB_UNIQUE_NAME=Nashville' LOG_ARCHIVE_DEST_STATE_1=ENABLE . the size of the standby redo logs must match exactly with the size of online redo logs.Nashville)' LOG_ARCHIVE_DEST_1= 'LOCATION=/database/10gDR/Orlando/arch/ VALID_FOR=(ALL_LOGFILES. Configure the primary initialization parameters. When creating the standby redo log groups. When configuring the initialization parameters on the primary database.ora: ## Primary Role Parameters ## DB_UNIQUE_NAME=Orlando SERVICE_NAMES=Orlando LOG_ARCHIVE_CONFIG='DG_CONFIG=(Orlando. While the database is mounted on a primary controlfile. We must configure the parameters to control log transport services and log apply services so that the database will seamlessly operate in either role with no parameter modification. the standby parameters are not read and are not put into effect. Step 5. so they will not affect the operation of the database while in the primary role. we can assure that they exist on both the primary and newly created standby. In addition.ALL_ROLES) DB_UNIQUE_NAME=Orlando' LOG_ARCHIVE_DEST_2= 'SERVICE=Nashville_hasun1 VALID_FOR=(ONLINE_LOGFILES.

If your primary database is using an spfile. Step 7.LOG_ARCHIVE_DEST_STATE_2=DEFER ## Standby Role Parameters ## DB_FILE_NAME_CONVERT= ('/database/10gDR/Orlando/'. With the primary database in either a mount or open state. Step 6. you will need to create a pfile for use by the standby. Create a backup of the primary database.'/database/10gDR/Nashville/') LOG_FILE_NAME_CONVERT= ('/database/10gDR/Orlando/'. Step 8.ctl'. .'/database/10gDR/Nashville/') STANDBY_FILE_MANAGEMENT=AUTO FAL_SERVER=Nashville_hasun1 FAL_CLIENT=Orlando_hasun1 Note We initially defer LOG_ARCHIVE_DEST_2 until the standby has been created and brought to the mount state. Create an initialization parameter file for the standby. create a standby controlfile with the following syntax: alter database create standby controlfile as '/database/10gDR/backup/control_Nashville. You can also use RMAN to create a standby controlfile: rman> backup current controlfile for standby.ora' from spfile. Also note that the DB_FILE_NAME_CONVERT and the LOG_FILE_NAME_CONVERT parameters are only needed if the paths are not identical between the primary and standby host. See Chapter 8 for information on using RMAN to back up the primary database. Enter the following command on the primary database: create pfile= '/database/10gDR/backup/initNashville. Create a standby controlfile. A physical standby can be created using either a hot or cold backup as long as all of the necessary archivelogs are available to bring the database to a consistent state.

you will need to adjust several parameters. Below are parameters that needed to be modified in our configuration: control_files=("/database/10gDR/data/control_Nashville.Nashville)' LOG_ARCHIVE_DEST_1= 'LOCATION=/database/10gDR/Orlando/arch/ VALID_FOR=(ALL_LOGFILES.'/database/10gDR/Orlando/') LOG_FILE_NAME_CONVERT= ('/database/10gDR/Nashville/'.ctl") DB_UNIQUE_NAME=Nashville SERVICE_NAMES=Nashville LOG_ARCHIVE_CONFIG='DG_CONFIG=(Orlando.'/database/10gDR/Orlando/') STANDBY_FILE_MANAGEMENT=AUTO FAL_SERVER=Orlando_hasun1 FAL_CLIENT=Nashville_hasun1 .PRIMARY_ROLE) DB_UNIQUE_NAME=Orlando' LOG_ARCHIVE_DEST_STATE_1=ENABLE LOG_ARCHIVE_DEST_STATE_2=ENABLE ## Standby Role Parameters ## DB_FILE_NAME_CONVERT= ('/database/10gDR/Nashville/'.Once you have a pfile created for your standby.ALL_ROLES) DB_UNIQUE_NAME=Nashville' LOG_ARCHIVE_DEST_2= 'SERVICE=Orlando_hasun1 VALID_FOR=(ONLINE_LOGFILES.

we must create a service for the standby database on the standby host.Please note that other parameters. you should create the appropriate environment variables. for standby’ operation to create a physical standby database with RMAN backups. If you are using RMAN. Data Guard relies on Oracle Net as the transport mechanism to get changes made on the primary to the standby.. We must configure Oracle Net listeners and Oracle Net aliases on both the primary and standby host in order to support Data Guards communication needs. such as dump destinations. may need to be modified depending on your environment. Using an operating system utility. Prepare the standby host. you can use the ‘duplicate. If so desired. and standby initialization parameter file to the standby host. If you are on the Windows operating system. See Chapter 8 for more information on RMAN and Data Guard. standby controlfile. transfer the backup of the primary database. To create the standby password file. and its password for the sys user must be the same as specified for the primary database. convert the initialization parameter file copied from the primary into an spfile by entering the following command on the standby instance: . perform the following command: oradim -NEW -SID Nashville -INTPWD Not4U -STARTMODE manual If you are running in a Unix environment. Create the standby password file. enter the following commands: $cd $ORACLE_HOME/dbs $orapwd file=orapwNashville password=Not4U Step 12.. Specifically we should configure the following: A listener running on the primary host A listener running on the standby host An Oracle Net alias on the primary that points to the standby listener An Oracle Net alias on the standby that points to the primary listener Step 13. Transfer files to the standby host. we must create a password file for the standby database. Create an spfile for the standby instance. To create the service. Configure Oracle Net components. Due to new log transport security and authentication features. Step 11. Step 9. Step 10.

when we mount a database we perform a check to determine if the controlfile is a primary or standby controlfile. Start the standby database. Now it is time to enable that destination and begin shipping redo to the standby. In the “Managing a Physical Standby” section. Finally. if you just can’t help yourself.create spfile from pfile. investigate the error listed in the error column to correct any issues. enter the following command SQL*Plus prompt: startup mount Those that are used to mounting a standby prior to Oracle Database 10g will be asking “Don’t I have to use the MOUNT STANDBY command?” Starting in Oracle Database 10g. Begin shipping redo to the standby database. . If the controlfile is found to be a standby controlfile. we will cover starting managed recovery in depth. the following statement will instruct the standby to begin applying changes from archived redo logs: alter database recover managed standby database disconnect. Next.error from v$archive_dest where dest_id=2. If the transmission was successful. we are ready to start the standby database. Step 15. If the status is invalid. However. earlier we deferred LOG_ARCHIVE_DEST_2 on the primary database until we had the standby mounted. the status of the destination should be valid. On the primary database. To do so. the database is mounted as a standby automatically. perform a log switch on the primary and verify that the transmission of that log was successful: alter system switch logfile. select status. The above command assumes that you placed the initialization file copied from the primary into the $ORACLE_HOME/dbs directory. enter the following command: alter system set log_archive_dest_state_2=enable scope=both. Step 14. If you remember.

.Feedback | Privacy Policy (updated 03/2005) RSS feed .Use of content on this site is expressly subject to the restrictions set forth in the Membership Agreement. Copyright © 1999-2010 Books24x7. Inc. Inc. Books24x7 and Referenceware are registered trademarks of Books24x7.

 f f½f¾¾ €   ° –f°¾½¾ nf° f °nf°€ f ¾ ¾¯f° ff   ff f¾ ° ffff n°€–f° f½f¾¾ € °f °  ½f¾¾ € ¾¾¾ ¯¾   °nf°  ¾¾ ¯€–f°¾½¾ n ¾€°n° € ½¯f ff f¾   ¾° n °f f½f¾¾ € n f °  €°–¾ ½¾  n .

$ ¾ f½ € f½f° ½f¾¾ -D °n  ½f¾¾ € ¾n f ¯¾¾  €°–½ff¯  ° ¾½€    ff f¾ ¾° °¯°¾f  f ¾¾ ¯¾  ¯ %–°%½f¾¾ € n¾ ¾n½ ¾½€   ½ °f  €n ––°–%½°f%  °°––°–½ f°¾½ €¯ ° ½¯ff °€–– °  ¾ f¯ ¾ fff  ½ ° ¾°  ¾ f¯¯f°f° ¾f°  ¾nf°nf¾ f€f °f €   °f ° ¾ €€n° °°––°–½ f°¾f nn°– ° ¾°¾ ½fn  ½¯f ff f¾ °€n ––°–¯ °¾¯ °––°–½ f°¾f ½ ¯  °   nf°– ¾f ½fn °  ¾ f¯f°f @¾f¾¾ ¾ff¾°  ¾f¾   n ¾°¾¯f°f°  @½fn  ½¯f ff f¾ °€n ––°–¯  °  €°–f¾¾¾  f  ff f¾ €n ––°–   ½ .%.

 f ¾f°  –¾%½°f%  .

f°½ n°¯ ¾ ¾nf¾¯f¯¯½ n°f° ¯f¯¯fff  ¯f° f f ¾f°  –¾ ½ ¾ ° f°  –¾f – n¯¯ °  –f  ¾¾€½ n° ¯ f¾– ° f¯  ffnf°  n   °–f€f f° ¯  ¾½fnn ¾ .

  ½ .n f  ¾f°  –¾°  ½¯ff°  ¾f° ¾f¾¯f  f°¾°¾ ¾¯   n f°–¾f°  –¾f¾¾f–  nf°f¾¾ f  ¾°  ½¯ff°  ° n f ¾f°  J °n f°– ¾f°  ––½¾  ¾ f ° ¯ ¾f°   –€ –½f° °¯ €°°  –€ –½¾° ½¯f ff f¾ °f °   ¾ € ¾f°  –¾¯¾¯fn fn ¾ €°°  –¾  @ €°–¾°f¾¾ n f  ¾f°  –¾  f  ff f¾ f ¾f° –€  f  % $ ff f¾ $–$¾f € %.

°€–  ½¯f°ff°½ff¯  ¾  J °n°€–°– °ff°½ff¯  ¾° ½¯f ff f¾ ¾¯½f°n°¾  €  f°¾°¾ J ¯¾n°€–  ½ff¯  ¾n°–f°¾½¾ n ¾f° –f½½ ¾ n ¾¾f  ff f¾ ¾ f¯ ¾¾½ f °   °½ff¯  ¯ €nf°  J   ff f¾ ¾¯° °f½¯fn°€  ¾f° ½ff¯  ¾f ° f f° f  °½° €€ n ¾ °f€€ n ½ f°€  ff f¾  ° ½¯f  @ ½ff¯  ¾¾°  f  ½fn ° ½¯f° f  9¯f 9ff¯  ¾  %D-. f°  I.D%-.

%-. f°  %.


- %.

- %f°  -f¾ %  %.

I%@%   .

 f°   %.@.$ ff f¾ $–$f° $fn$ I% %% %%  %D-.D%-.

I%@%   I.

%%  %D-. -f¾  %. -f¾ %f¾° I% %--% 9.D%-.

I%@%@@% -  .


I%@%@@%  f°  9ff¯  ¾  %%-.%.

-I@  % $ ff f¾ $–$f° $ $ ff f¾ $–$-f¾ $ % %%-.%.

-.-@ D@ %I -f¾ %f¾° %.-I@  % $ ff f¾ $–$f° $ $ ff f¾ $–$-f¾ $ % @- %%.

-@ f° %f¾°     J °f € %.

%.I%@%° ¾f° f¾ °n f f°  –  ¯°¾f ¾° f  %%-.

%.-I@f°   %%-.

-I@½ff¯  ¾f °° € ½f¾f ° °nf  °  ½¯ff° ¾f° ¾   ½ .

 f f fn½€ ½¯f ff f¾  ½¾nf¾f° nf° n f ¾°–  fn  fn½f¾°–f¾f€ ° n ¾¾f fn –¾f fff   °–  ff f¾ fn°¾¾ °¾f  .

- fn½ ½¯f ff f¾   ½ .f½ €°€¯f°° ¾°–.

 f f¾f° n°€  J ½¯f ff f¾ °  f¯°½ °¾f n f f¾f° n°€   €°–¾°f  f  ff f¾ n f ¾f° n°€ f¾ $ ff f¾ $–$ fn½$n°%-f¾ n  nf°f¾¾ .-n f f¾f° n°€  ¯f°  fn½n °n°€ €¾f°    ½ .

 f f°°ff°½ff¯  € € ¾f°   €½¯f ff f¾ ¾¾°–f°¾½€ ° n f f½€ €¾   ¾f°  °   €°–n¯¯f° ° ½¯f ff f¾  n f ½€  $ ff f¾ $–$ fn½$°-f¾ f €¯¾½€  .

°n f f½€ n f €¾f°  ° f ©¾¾  f½ff¯  ¾  f  ½ff¯  ¾f°  ¯ € °n°€–f°  n°%€ ¾ % $ ff f¾ $–$ ff$n°%-f¾ n %  %D-. -f¾  I.D%-.

%-. -f¾  %.


- %.

- %f°  -f¾ %  %.

I%@%   .

$ ff f¾ $–$f° $fn$ I% %% %%  %D-. -f¾  %.@.D%-.

I%@%   I.

D%-. f°   %. f° %f¾° I% %--% 9.%%  %D-.

I%@%@@% -  %.

%.I%@%@@% -   f°  9ff¯  ¾   %%-.

%.-I@  % $ ff f¾ $–$-f¾ $ $ ff f¾ $–$f° $ % %%-.

-I@  % $ ff f¾ $–$-f¾ $ $ ff f¾ $–$f° $ % @- %%.-.-@ D@ %I f° %f¾° %.

-@ -f¾ %f¾° .

.9 f¾ ° f ½ff¯  ¾ ¾nf¾ ¯½ ¾°f°¾ ¯f°  ¯ €  ½ ° °– ° °°¯ °   ½ @f°¾€ € ¾ ¾f° ¾  D¾°–f°½ f°–¾¾ ¯ f°¾€   fn½€ ½¯f ff f¾ ¾f° n°€  f° ¾f° °ff°½ff¯  €  ¾f° ¾ €f ¾°–.nf°¾   # ½nf €¾f° #½ f°n f f½¾nf¾f°  ff f¾ .- fn½¾   .

-f° fff   ½ 9 ½f  ¾f° ¾  €f ° J° ¾½ f°–¾¾ ¯  ¯¾n f f¾ n € ¾f°  ff f¾ °  ¾f° ¾ @n f  ¾ n ½ €¯ €°–n¯¯f°  f ¯ -J -f¾  -@9J-D @@.¯f°f €f °°°–°fD° °°¯ ° ¾ n f  f½½½f  °°¯ °ff  ¾   ½ .f½ €¯ °€¯f°°.

 f  ¾f° ½f¾¾ €   ° –f°¾½¾ nf° f °nf°€ f ¾  ¯¾n f f½f¾¾ € €  ¾f°  ff f¾ f° ¾½f¾¾ € ¾¾¾ ¯¾  ¾f¯ f¾¾½ n€ € ½¯f ff f¾ @n f  ¾f° ½f¾¾ €  °  €°–n¯¯f° ¾  n .

$ ¾ f½ € f½-f¾ ½f¾¾ -D  ½ .%.

°€– fn - n¯½° °¾  fff   ¾°fn - f¾ f°¾½¯ nf°¾¯– nf°– ¾¯f ° ½¯f  ¾f°  J ¯¾n°€– fn - ¾ ° ¾f° fn - ff¾ ¾°  ½¯ff°  ¾f° ¾° ¾½½fff ¾n¯¯°nf°° ¾ ½ n€nf ¾ n°€–   €°–  ¾ ° °°°–° ½¯f¾ ¾ ° °°°–° ¾f° ¾ °fn - ff¾° ½¯ff½°¾ ¾f° ¾ °  °fn - ff¾° ¾f° f½°¾ ½¯f¾ °   ½ .

 f f°¾½€ € ¾f° °¾f°n  €¾ ¾ n°  °ff°½ff¯  € n½ €¯ ½¯f°f°¾½€   ° °– €°–n¯¯f° ° ¾f° °¾f°n  .

n f ¾½€ €¯½€  @ f  n¯¯f° f¾¾¯ ¾f½fn  °ff°€ n½ €¯ ½¯f°  .

D-@@- n¯¯f° "#f°–°fn ff f¾ –  ° ¯°f ff f¾   ½ €¯fn n  ¯° € n°€ ¾f½¯f¾f° n°€ € n°€ ¾ €°  f¾f° n°€   ff f¾ ¾¯° f¾f¾f° f¯fnf   ½  –°¾½½°–  ¾f°  ff f¾  € ¯ ¯   f   €  %.%.&9¾ ½¯½  ¾f½¯° @¾ ff ¾ ¯°°–f¾f° ½fn ff f¾ – f¾°–#°#f  ¾  .$ ¾  n   ½ f ¾f°  ff f¾  °f  f  f ¾f ¾f°  ff f¾ @ ¾  °  €°–n¯¯f° .

I%@%° ½¯f ff f¾ ° f   ¾f° ¯° -¾¯  °f  f ¾°f°f°  –°¾½½°–  ¾f°   ° ½¯f ff f¾  °  €°–n¯¯f°  f ¾¾ ¯¾ –%fn % ¾%¾f % °f  ¾n½   -  ½ €¯f–¾n° ½¯ff°  €f f°¾¯¾¾°€f–f¾¾nn ¾¾€  f ¾¾ ¯¾n–€  ¾  n¾f¾ €¯fn % ¾   ¾%   € f°¾¯¾¾°f¾¾nn ¾¾€  ¾f¾€  ¾°f°¾  f € ¾f¾¾°f  ° ¾–f   ¾ °  n¯°n nf°¾¾ ¾  ° #.f°f–°–f9¾nff° #¾ n°  n ¾f°–¯f°f–  n ° ½     €©¾nf°# ½¾ €  €°–¾f ¯ °°¾n ¾f°  –° f½½°–nf°– ¾€¯fn  –¾  f  ff f¾  n ¯f°f– ¾f°  ff f¾  ¾n°° n             .

¯ ¾½ – ¯ °  ¾f°  €  °n f f  –¾  f ¯f¾€ ¾ °n  .   D¾ €n° °°¾¾ ¾ ½ ¾¾¾ © n  ¾n°¾¾ €° .

½–'  ¾ °n   fn$9fn9n%½ f $% €    .

Sign up to vote on this title
UsefulNot useful