Skip to main content
Delphix

How to Provision a virtual Primary and Standby pair from an Oracle dSource

Delphix currently does not support direct provisioning of an Oracle Virtual Primary and Standby database pair. However, there are straightforward steps you can do to achieve that easily. Below outlines an example of how you can take an already linked dSource and quickly provision a virtual Primary and Standby database pair.

Essentially, you can use the same idea to create more than one standby database to mimic your complete production database Data Guard configuration. Some customers find this useful for the purpose of testing various Data Guard features such as switchover or failover; others have existing applications that run on their Data Guard configuration and this capability will allow them to test their application against real production data in a virtualize Data Guard configuration environment. 

Prerequisites:

  1. Discover source environment

  2. Discover target environment 

  3. Link dSource from Source Environment

Procedure

  1. Provision a virtual database (VDB) into Target Environment (this will be known as the "primary VDB")

    1. dbuniquename=primary

    2. sid=primary

    3. databasename=hr

  2. Provision a VDB **from primary VDB**, to the Target Environment,

     **UNCHECK GUI Provision VDB page, ‘Open Database After Provision’ checkbox**, with:

    1. dbuniquename=standby

    2. sid=standby

    3. databasename=hr

  3. Login to Target

    1. Set ORACLE_SID=primary, sqlplus / as sysdba,

    2. check init parameter REMOTE_LOGIN_PASSWORDFILE is ‘EXCLUSIVE’

  4. Create password file on ‘primary’ 

    1. orapwd file=$ORACLE_HOME/dbs/orapwprimary entries=10 

    2. enter password for SYS when prompted.

  5. Copy primary password file to standby 

    1. cp $ORACLE_HOME/dbs/orapwprimary $ORACLE_HOME/dbs/orapwstandby

 

Continue steps below in the order as shown, alternating between ‘primary’ and ‘standby’ database as needed.

 

 

On ‘primary’ (export ORACLE_SID=’primary’)

On ‘standby’  (export ORACLE_SID=’standby’)

Notes

1

 

SQL> show parameter control_files;

Write down controlfile name: /mnt/provision/standby/datafile/datafile/dbdhcp3/oradata/dbdhcp3/control01.ctl

2

SQL> select group#,bytes from v$log;

 

Get online log file # of group (groupNumber), as well as size of online log (logfileSize)

3

 

SQL> shutdown abort;

 

4.

SQL> alter database create standby controlfile as '/mnt/provision/standby/datafile/datafile/dbdhcp3/oradata/dbdhcp3/control01.ctl’ reuse;

 

Create standby controlfile from primary VDB, overwrite standby VDB controlfile using ‘REUSE’

5

 

SQL> startup mount

 

6

 

SQL> alter system set db_file_name_convert='/mnt/provision/primary','/mnt/privision/standby' scope=spfile;

SQL>  alter system set log_file_name_convert='/mnt/provision/primary','/mnt/privision/standby' scope=spfile;

SQL> shutdown abort;

SQL> startup mount;

       

Rename db and log file

7

 

SQL> alter database add standby logfile size <logfileSize>;

Create standby redo logfile, using values from step 2 above, repeat <groupNumber+1> # of times to create <groupNumber+1> standby redo logfiles

8

SQL> alter system set log_archive_config='DG_CONFIG=(primary,standby)' scope=both;

SQL> alter system set log_archive_config='DG_CONFIG=(primary,standby)' scope=both;

Set log_archive_config parameter

9

SQL> alter system set log_archive_dest_2='service="(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=slee-bbdhcp-tgt.dcenter.delphix.com)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=standby)(SERVER=DEDICATED)))", LGWR ASYNC NOAFFIRM reopen=60 db_unique_name="standby" ' scope=both;

 

Set up Data Guard log transport from primary to standby

10

SQL> alter system set log_archive_dest_state_2='ENABLE’;

   

11

SQL> select dest_id, error,status, db_unique_name from v$archive_dest_status where dest_id=2;

 

Check for error in DG log transport. If it status=VALID, you are good to go. If not, check the error message.

12

SQL> alter system archive log current;

SQL>recover managed standby database disconnect using current logfile;

Make sure standby can recover logs from primary. Tail standby alert log to find out it is recovering. Switch log out of primary if standby is not recovering.

13

 

SQL> recover managed standby database cancel;

SQL> alter database open read only;

SQL> recover managed standby database disconnect using current logfile;

Optional (if want to run Active Data Guard)

 

NOTES:

  1. If ALTER DATABASE OPEN READ ONLY in step 13 results in alert log message on standby, saying “FAL[client]: Error fetching gap sequence, no FAL server specified”, you can kick out logs from primary by ‘ALTER SYSTEM ARCHIVE LOG CURRENT’. You can also set up init ora parameter FAL_SERVER on standby as - alter system set fal_server='(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=slee-bbdhcp-tgt.dcenter.delphix.com)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=primary)(SERVER=DEDICATED)))’;

  2. The standby VDB is not known to Delphix as a standby database, but rather a database that Delphix will not OPEN with a backup control file. What this means is, after your virtual Primary and virtual Standby are running properly, you can use the GUI to start/stop/enable/disable the Standby VDB. However, Delphix will only start the standby VDB to MOUNT state. You will need to follow up to either OPEN READ ONLY and start MANAGED RECOVERY yourself, or just start MANAGED RECOVERY, depending on what you want to run on your standby database.

  3. Right after you restart your standby VDB using Delphix, it may take a short while for the standby database to register with the listener. Before that happens, the log transport from primary shipping logs to the standby may see errors. These should clear up after a short time.