Sun Cluster Geographic Edition Data Replication Guide for Oracle Data Guard

ProcedureHow to Set Up Your Primary Database

In the following steps, the primary cluster is called cluster-paris (nodes phys-paris-1 and phys-paris-2), and the standby cluster is called cluster-newyork (phys-newyork-1 and phys-newyork-2). The suffix -crs is appended to the Oracle Clusterware virtual IP host names.

The primary database on cluster-paris is called sales and has instances sales1 and sales2. The standby database on cluster-newyork is called salesdr and has instances salesdr1 and salesdr2. The suffix -svc is appended to each net naming service name for each of the databases and individual instances, for example, sales-svc or sales1 -svc.

Before You Begin

Ensure that you have edited your Oracle user .profile or .cshrc file to set the correct Oracle SID, ORACLE_HOME, and PATH environment variables for the local Oracle RAC database instance. Unless otherwise stated, you only need to run the commands from a node in the primary cluster that hosts a protected database instance.

  1. Verify that you can resolve the Oracle virtual IP addresses that are used by Oracle Clusterware on all primary and standby nodes.

    phys-paris-1# getent hosts phys-paris-1-crs    phys-paris-1-crs
  2. Create a database on the primary cluster.

    Use either the Oracle Database Configuration Assistant (dbca) or the SQL*Plus utility.

  3. Verify that an Oracle password file exists for the primary database.

    oracle (phys-paris-1)$ cd ${ORACLE_HOME}/dbs
    oracle (phys-paris-1)$ ls -l orapwsales1
    lrwxrwxrwx   1 oracle   oinstall      25 November  2 02:06 orapwsales1
    	-> /oradata/SALES/orapwsales

    Oracle Data Guard needs a consistent Oracle password file on all participating nodes in the primary and standby clusters.

    If a password file does not exist, create one as follows:

    oracle (phys-paris-1)$ orapwd file=${ORACLE_HOME}/dbs/orapwsales1 \

    You can then move this file to a location on shared storage and create a symbolic link to that file from each node. Change the file name to reflect the local SID on each node. Later, you will copy this file to the standby cluster (cluster-newyork).

  4. Ensure that the database is in logging mode by using the sqlplus command.

    oracle (phys-paris-1)$ sqlplus '/ as sysdba'
    SQL> alter database force logging;
    Database altered.
  5. Configure the Oracle Data Guard Broker configuration file locations.

    Run the sqlplus command as follows, substituting the two file names with ones that suit your configuration. Ensure that these files are located on shared storage that is visible to all cluster-paris nodes.

    oracle (phys-paris-1)$ sqlplus '/ as sysdba'
    SQL> alter system set dg_broker_config_file1='/oradata/SALES/dr1sales.dat'
       2 scope=both sid='*';
    System altered.
    SQL> alter system set dg_broker_config_file2='/oradata/SALES/dr2sales.dat'
       2 scope=both sid='*';
    System altered.
  6. Shut down all database instances.

  7. On the primary database, mount a single database instance and enable the Oracle database flashback capability.

    oracle (phys-paris-1)$ sqlplus '/ as sysdba'
    SQL> startup mount;
    ORACLE instance started.
    Total System Global Area  532676608 bytes
    Fixed Size                  2031416 bytes
    Variable Size             276824264 bytes
    Database Buffers          247463936 bytes
    Redo Buffers                6356992 bytes
    Database mounted.
    System altered.
    SQL> alter database archivelog;
    Database altered.
    SQL> alter database flashback on;
    Database altered.
    SQL> alter database open;
    Database altered.
  8. Restart the other database instances.

  9. Create database standby redo logs.

    Depending on your configuration, you might need to add a number of standby redo logs. The name, number, and size of these logs depend on a number of factors, including whether you use the Optimal Flexible Architecture (OFA), how many online redo log files you have, and the size of those log files. The following example shows how to configure a single 50-Mbyte standby redo log file, where the OFA naming scheme is being used. A default, two-node Oracle RAC database normally requires that you add six log files.

    oracle (phys-paris-1)$ sqlplus '/ as sysdba'
    SQL> alter database add standby logfile size 50m;
    Database altered.
  10. Configure the Oracle log archiving destinations.

    Depending on your configuration, you might need to alter or add one or more of the Oracle log archive destination parameters. These parameters have a number of tunable properties. Consult the Oracle documentation for details. The following example shows two log archive destinations being set, one for the local cluster and one for the standby cluster, where OFA naming is used.

    oracle (phys-paris-1)$ sqlplus '/ as sysdba'
    SQL> alter system set log_archive_dest_1='location=use_db_recovery_file_dest
       2 arch mandatory valid_for=(all_logfiles,all_roles)
       3 db_unique_name=sales' scope=both sid='*';
    System altered.
    SQL> alter system set log_archive_dest_2='service=salesdr-svc
      2 lgwr sync affirm valid_for=(online_logfiles,primary_role)
      3 db_unique_name=salesdr' scope=both sid='*';
    System altered.
    SQL> alter system set log_archive_dest_10='location=use_db_recovery_file_dest'
      2 scope=both sid='*';
    System altered.
    SQL> alter system set standby_file_management='AUTO' scope=both sid='*';
    System altered.
  11. Configure the Fetch Archive Log (FAL) parameters.

    For the database to know where to get missing archive redo logs on the server and where to send them on the client, you need to set the FAL system properties. These properties use the net service names of the source and destination databases. You run the following sqlplus command to set the parameters to the correct values for your configuration.

    oracle (phys-paris-1)$ sqlplus '/ as sysdba'
    SQL> alter system set fal_server='salesdr-svc' scope=both sid='*';
    System altered.
    SQL> alter system set fal_client='sales-svc' scope=both sid='*';
    System altered.