This Article explains how to create a Standby database using another standby database. We will be using CLI commands to do this setup. We will be going through step by step process. Below is the description of our SOURCE and DESTINATION details.
For the below test case we have used the source server as second standby database ,usually and it must be a third server.
Primary ASM db PROD on dbvlin503
Standby ASM db PROD on dbvlin504
Standby FS db PRODTEST on dbvlin503
DDC=PROD
SOURCE=dbvlin503
DESTINATION=dbvlin504
ORACLE_SID=PROD
ORACLE_SID_DR=PROD
DB_UNIQUE_NAME=PROD
DB_UNIQUE_NAME_DR=PROD
DDC=PRODTEST
SOURCE=dbvlin504
DESTINATION=dbvlin503
ORACLE_SID=PROD
ORACLE_SID_DR=PRODTEST
DB_UNIQUE_NAME=PROD
DB_UNIQUE_NAME_DR=PRODTEST
We are assuming that the current PROD and DR are in sync (PROD@dbvlin503 --->PROD@dbvlin504)
Steps Performed
1. First step is to create a DDC file for the new configuration from dbvlin504 as source and dbvlin503 as target. This step involves changing the ORACLE_SID_DR and DB_UNIQUE_NAME_DR along with relevant ORACLE_HOMES.
Main point to remember is the ARCHSOURCE and ARCHDEST locations for both the DDC files.
PROD@dbvlin503 => PROD@dbvlin504 DDC=PROD, logs shipped to ARCHDEST specified in PROD
PROD@dbvlin504 => PRODTEST@dbvlin503 DDC=PRODTEST (CASCADE=Y), logs shipped from ARCHSOURCE specified in PRODTEST to ARCHDEST specified in PRODTEST.
ARCHSOURCE in PRODTEST must be the same location as ARCHDEST in PROD
1) If COMPRESS=N in PROD, COMPRESS should also be N in PRODTEST
Dbvisit ships primary logs uncompressed from dbvlin503@PROD to PROD.ARCHDEST, then from PRODTEST.ARCHSOURCE=PROD.ARCHDEST to PRODTEST.ARCHDEST.
2) If compression set in PROD@dbvlin503, compression should be set to the same value in PRODTEST. LEAVE_COMPRESS_DR should be set to Y in PROD.
Dbvisit ships primary logs compressed from S1 to PROD.ARCHDEST, then from PRODTEST.ARCHSOURCE=PROD.ARCHDEST to PRODTEST.ARCHDEST.
oracle@dbvlin504[/usr/dbvisit/svn/projects/project970/standby]: ./dbvctl -o setup --noprompt ========================================================= Dbvisit Standby Database Technology (8.0.01.15575) http://www.dbvisit.com ========================================================= =>dbvctl.pl only needs to be run on the primary server. Is this the primary server? <Yes/No> [Yes]: The following Dbvisit Database configuration (DDC) file(s) found on this server: DDC === 1) Create New DDC 2) PROD 3) PRODTEST 4) Cancel Please enter choice [] : 1 ========================================================= Dbvisit Standby setup begins. ========================================================= The following Oracle instance(s) have been found on this server: SID ORACLE_HOME === =========== 1) PROD /u01/app/oracle/product/11.2.0/db_1 2) prod /u01/app/oracle/product/11.2.0/db_1 3) Enter own ORACLE_SID and ORACLE_HOME Please enter choice [] : 1 =>ORACLE_SID will be: PROD =>ORACLE_HOME will be: /u01/app/oracle/product/11.2.0/db_1 Source database is a standby database. CASCADE flag will be turned on. Yes to continue or No to cancel setup? <Yes/No> [Yes]: ------------------------------------------------------------------------------ Enter the primary server name. Note: The hostname is case sensitive on UNIX based systems. =>SOURCE is [dbvlin504]: Choice is dbvlin504 ------------------------------------------------------------------------------ Please enter a filesystem directory that Dbvisit Standby use to store (archive) log files. This directory is not the same as the database recovery area or archive destinations and should not be located in these areas. The ARCHSOURCE directory is located on the primary server and will become the ARCHDEST location when the primary database is converted to a standby database during a Graceful Switchover operation. This directory will ONLY contain (archive) log files related to this database. It should not contain any other (non archive log) files. Please ensure that this directory exists on =>ARCHSOURCE is [/oracle/dbvisit_arch/PROD]: /u01/app/oracle/dbvisit/PROD Choice is /u01/app/oracle/dbvisit/PROD ------------------------------------------------------------------------------ Do you want to use SSH to connect to the standby server? Note that if you are using SSH, passwordless SSH authentication between the hosts must already be configured. By default Dbvnet will be used. =>USE_SSH is [N]: Y Choice is Y ------------------------------------------------------------------------------ Enter the standby database hostname. If the standby database will be Oracle RAC enabled: Enter the the Virtual Hostname (linked to a Virtual IP) for standby database. This virtual hostname is attached to a VIP that will be able to move between the RAC nodes. Dbvisit Standby will only run on the server where this virtual hostname (VIP) resource is running. The Virtual Hostname (and VIP) should be configured as a resouce in clusterware and must be enabled and started on one of the nodes before yo continue with the setup. If you are not using a Virtual Hostname (Highly Recommended), Dbvisit Standby can only be configured to run on one dedicated node in the RAC configuration - specify the hosts name here if you do not have a Virtual Hostname (attached to VIP) for the cluster configured. For non-RAC configurations specify the standby database server name here. =>DESTINATION is []: dbvlin503 Choice is dbvlin503 ------------------------------------------------------------------------------ Specify the DBVNET or SSH port number on the standby server. The default value supplied is the dbvnet port 7890. If you specified the use of SSH, please specify the SSH port here. =>NETPORT is [7890]: 22 Choice is 22 ------------------------------------------------------------------------------ Enter Dbvisit Standby installation directory on the standby server =>DBVISIT_BASE_DR is [/usr/dbvisit/svn/projects/project970]: Choice is /usr/dbvisit/svn/projects/project970 ------------------------------------------------------------------------------ Enter ORACLE_HOME directory on the standby server =>ORACLE_HOME_DR is [/u01/app/oracle/product/11.2.0/db_1]: Choice is /u01/app/oracle/product/11.2.0/db_1 ------------------------------------------------------------------------------ Enter DB_UNIQUE_NAME on the standby server =>DB_UNIQUE_NAME_DR is [PROD]: PRODTEST Choice is PRODTEST ------------------------------------------------------------------------------ Please enter the directory where Dbvisit Standby will transfer the (archive) log files to on standby server. This directory is not the same as the database recovery area or archive destinations and should not be located in these areas. This directory should ONLY contain (archive) log files related to this database. It should not contain any other (non archive log) files. Please ensure that this directory exists on the standby server =>ARCHDEST is [/u01/app/oracle/dbvisit/PROD]: Choice is /u01/app/oracle/dbvisit/PROD ------------------------------------------------------------------------------ Enter ORACLE_SID on the standby server =>ORACLE_SID_DR is [PROD]: PRODTEST Choice is PRODTEST ------------------------------------------------------------------------------ Enter ASM instance name on the standby server, if your standby is using ASM. If you are not using ASM on the standby leave the value blank. =>ORACLE_SID_ASM_DR is []: Choice is null ------------------------------------------------------------------------------ Please specify the name of the Dbvisit Database configuration (DDC) file. The DDC file is a plain text file that contains all the Dbvisit Standby settings. =>ENV_FILE is [PROD]: PRODTEST Choice is PRODTEST ------------------------------------------------------------------------------ Below are the list of configuration variables provided during the setup process: Configuration Variable Value Provided ====================== ============== ORACLE_SID PROD ORACLE_HOME /u01/app/oracle/product/11.2.0/db_1 SOURCE dbvlin504 ARCHSOURCE /u01/app/oracle/dbvisit/PROD RAC_DR N USE_SSH Y DESTINATION dbvlin503 NETPORT 22 DBVISIT_BASE_DR /usr/dbvisit/svn/projects/project970 ORACLE_HOME_DR /u01/app/oracle/product/11.2.0/db_1 DB_UNIQUE_NAME_DR PRODTEST ARCHDEST /u01/app/oracle/dbvisit/PROD ORACLE_SID_DR PRODTEST ENV_FILE PRODTEST Are these variables correct? <Yes/No> [Yes]: Dbvisit Database configuration (DDC) file /usr/dbvisit/svn/projects/project970/standby/conf/dbv_PRODTEST.env created. Dbvisit Database repository (DDR) already installed. Repository Version 8.0 Software Version 8.0 Repository Status VALID Dbvisit Configurations stored in the Repository: Source DBVLIN504 Destination DBVLIN503 Db_unique_name PROD Db_unique_name_dr PROD PID:18115 TRACE:/usr/dbvisit/svn/projects/project970/standby/tmp/dbvisit_install.log
2. The next step is to Create the Standby Database(CSD) from the existing standby database. Database parameters have to be changed while running the CSD , The main parameters are db_create_file_dest ,db_recovery_file_dest and log_file_name_convert.
DONOT USE DIRECT FILE COPY METHOD WHILE CREATING THE SECOND STANDBY.
oracle@dbvlin504[/usr/dbvisit/svn/projects/project970/standby]: ./dbvctl -d PRODTEST --csd --noprompt >>> Running pre-checks please wait... Dbvisit Standby configurational differences found between dbvlin504 and dbvlin503... dbv_PRODTEST.env Checks completed OK. What would you like to do: 1 - Create standby database (and optionally save settings in template) 2 - Create standby database using existing template (previously saved) 3 - Help 4 - Terminate processing Please enter your choice [1]: ------------------------------------------------------------------------------- =>Do you want to use TRANSPORTABLE MEDIA to transfer the database backup to the standby server? Transportable media is an external device such as a USB drive that is first plugged into the primary server and then manually transferred to the standby site and plugged into the standby server to continue the process. It can be used for large databases or slow networks. Specifying No means the network will be used to transfer the database backup. [N]: ------------------------------------------------------------------------------- A temporary location must be specified on dbvlin504 where the database will be backed up to first. This location must be big enough to hold RMAN backup of the whole database (1.30GB). =>Specify the location on this server: [/usr/tmp]: ------------------------------------------------------------------------------- A temporary location must be specified on dbvlin503 where the database backup will be copied to before moving to specified locations. =>Specify location on remote server: [/usr/tmp]: You choose to create a non ASM standby database. Please change all Oracle database parameters values pointing to ASM locations to point to valid filesystem locations on the standby server. The following oracle database parameters will be set in the standby database pfile or spfile: ------------------------------------------------------------------------------- SID NAME VALUE * audit_file_dest /u01/app/oracle/admin/PROD/adump * compatible 11.2.0.0.0 * db_block_size 8192 * db_create_file_dest +DR * db_domain * db_file_name_convert * db_name PROD * db_recovery_file_dest +FRA * db_recovery_file_dest_size 9537847296 * db_unique_name PRODTEST * diagnostic_dest /u01/app/oracle * dispatchers (PROTOCOL=TCP) (SERVICE=PRODXDB) * log_archive_format %t_%s_%r.dbf * log_file_name_convert +DATA,+DR * open_cursors 300 * pga_aggregate_target 157286400 * processes 150 * remote_login_passwordfile EXCLUSIVE * sga_target 891289600 * spfile OS default * undo_tablespace UNDOTBS1 ------------------------------------------------------------------------------- What would you like to do: 1 - Proceed with creating the standby database 2 - Edit oracle database parameters for the standby database pfile/spfile 3 - Terminate processing Please enter your choice [1]: 2 WARNING: Do NOT use single or double quotes to enclose parameter values! Separate multiple values with a comma. If a comma is part of a value, escape it with a backslash. If a comma is part of a value, escape it with a backslash. =>Enter full parameter name: []: db_unique_name Parameter db_unique_name cannot be changed as it is set by DB_UNIQUE_NAME_DR in the DDC file What would you like to do: 1 - Proceed with creating the standby database 2 - Edit oracle database parameters for the standby database pfile/spfile 3 - Terminate processing Please enter your choice [1]: 2 WARNING: Do NOT use single or double quotes to enclose parameter values! Separate multiple values with a comma. If a comma is part of a value, escape it with a backslash. If a comma is part of a value, escape it with a backslash. =>Enter full parameter name: []: db_create_file_dest 1 - Remove from the standby parameter file (parameter will be set to default value) 2 - New value in the standby parameter file =>Please enter your choice: []: 2 =>Enter new value (leave blank to set to null) []: /u01/oradata Validating ... please wait The following oracle database parameters will be set in the standby database pfile or spfile: ------------------------------------------------------------------------------- SID NAME VALUE * audit_file_dest /u01/app/oracle/admin/PROD/adump * compatible 11.2.0.0.0 * db_block_size 8192 * db_create_file_dest /u01/oradata * db_domain * db_file_name_convert * db_name PROD * db_recovery_file_dest +FRA * db_recovery_file_dest_size 9537847296 * db_unique_name PRODTEST * diagnostic_dest /u01/app/oracle * dispatchers (PROTOCOL=TCP) (SERVICE=PRODXDB) * log_archive_format %t_%s_%r.dbf * log_file_name_convert +DATA,+DR * open_cursors 300 * pga_aggregate_target 157286400 * processes 150 * remote_login_passwordfile EXCLUSIVE * sga_target 891289600 * spfile OS default * undo_tablespace UNDOTBS1 ------------------------------------------------------------------------------- What would you like to do: 1 - Proceed with creating the standby database 2 - Edit oracle database parameters for the standby database pfile/spfile 3 - Terminate processing Please enter your choice [1]: 2 WARNING: Do NOT use single or double quotes to enclose parameter values! Separate multiple values with a comma. If a comma is part of a value, escape it with a backslash. If a comma is part of a value, escape it with a backslash. =>Enter full parameter name: []: db_recovery_file_dest 1 - Remove from the standby parameter file (parameter will be set to default value) 2 - New value in the standby parameter file =>Please enter your choice: []: 2 =>Enter new value (leave blank to set to null) []: /u01/recovery_file_dest Validating ... please wait The following oracle database parameters will be set in the standby database pfile or spfile: ------------------------------------------------------------------------------- SID NAME VALUE * audit_file_dest /u01/app/oracle/admin/PROD/adump * compatible 11.2.0.0.0 * db_block_size 8192 * db_create_file_dest /u01/oradata * db_domain * db_file_name_convert * db_name PROD * db_recovery_file_dest /u01/recovery_file_dest * db_recovery_file_dest_size 9537847296 * db_unique_name PRODTEST * diagnostic_dest /u01/app/oracle * dispatchers (PROTOCOL=TCP) (SERVICE=PRODXDB) * log_archive_format %t_%s_%r.dbf * log_file_name_convert +DATA,+DR * open_cursors 300 * pga_aggregate_target 157286400 * processes 150 * remote_login_passwordfile EXCLUSIVE * sga_target 891289600 * spfile OS default * undo_tablespace UNDOTBS1 ------------------------------------------------------------------------------- What would you like to do: 1 - Proceed with creating the standby database 2 - Edit oracle database parameters for the standby database pfile/spfile 3 - Terminate processing Please enter your choice [1]: 2 WARNING: Do NOT use single or double quotes to enclose parameter values! Separate multiple values with a comma. If a comma is part of a value, escape it with a backslash. If a comma is part of a value, escape it with a backslash. =>Enter full parameter name: []: log_file_name_convert 1 - Remove from the standby parameter file (parameter will be set to default value) 2 - New value in the standby parameter file =>Please enter your choice: []: 2 =>Enter new value (leave blank to set to null) []: +DR,/u01/oradata Validating ... please wait The following oracle database parameters will be set in the standby database pfile or spfile: ------------------------------------------------------------------------------- SID NAME VALUE * audit_file_dest /u01/app/oracle/admin/PROD/adump * compatible 11.2.0.0.0 * db_block_size 8192 * db_create_file_dest /u01/oradata * db_domain * db_file_name_convert * db_name PROD * db_recovery_file_dest /u01/recovery_file_dest * db_recovery_file_dest_size 9537847296 * db_unique_name PRODTEST * diagnostic_dest /u01/app/oracle * dispatchers (PROTOCOL=TCP) (SERVICE=PRODXDB) * log_archive_format %t_%s_%r.dbf * log_file_name_convert +DR,/u01/oradata * open_cursors 300 * pga_aggregate_target 157286400 * processes 150 * remote_login_passwordfile EXCLUSIVE * sga_target 891289600 * spfile OS default * undo_tablespace UNDOTBS1 ------------------------------------------------------------------------------- What would you like to do: 1 - Proceed with creating the standby database 2 - Edit oracle database parameters for the standby database pfile/spfile 3 - Terminate processing Please enter your choice [1]: Validating oracle database parameters... please wait =>SUCCEEDED ------------------------------------------------------------------------------- =>Create standby database template for PRODTEST using provided answers? [Y]: ------------------------------------------------------------------------------- =>Continue with creating a standby database? (If No processing will terminate, the saved template will be available for future use) [Y]: >>> dbvctl will now run a pre-flight check for standby database creation. An attempt will be made to create a standby (s)pfile using oracle standby database parameters, followed by trying to start the standby instance. If this step fails, then please double-check the following items before re-running dbvctl again: 1) Review the standby database parameters you have supplied and provide valid values unless a template is used. 2) Recreate the template to provide valid values for standby database parameters if a template is used. Running pre-flight check for standby creation, please wait... - done. >>> Total database size for PROD is 1.30GB >>> Backing up primary database... Backing up datafile 1... - done. Backing up datafile 2... - done. Backing up datafile 3... - done. Backing up datafile 4... - done. >>> Creating standby control file... - done. Backup of primary database completed. >>> Transferring backup from dbvlin504 to dbvlin503... Transferring /usr/tmp/dbv_PRODTEST_csd_dbf_1_1br5vgnu_1_1.rman... - done. Transferring /usr/tmp/dbv_PRODTEST_csd_dbf_1_1cr5vgp1_1_1.rman... - done. Transferring /usr/tmp/dbv_PRODTEST_csd_dbf_2_1dr5vgp4_1_1.rman... - done. Transferring /usr/tmp/dbv_PRODTEST_csd_dbf_3_1er5vgpu_1_1.rman... - done. Transferring /usr/tmp/dbv_PRODTEST_csd_dbf_4_1fr5vgq3_1_1.rman... - done. >>> Restoring standby control files... - done. >>> Starting standby database PRODTEST on dbvlin503 mount... - done. >>> Restoring datafiles on dbvlin503... Restoring datafile 1 - done. Restoring datafile 2 - done. Restoring datafile 3 - done. Restoring datafile 4 - done. >>> Renaming standby redo logs and tempfiles on dbvlin503... - done. >>> Finishing standby database creation... - done. Standby database created. To complete creating standby database please run dbvctl on the primary server first, then on the standby server, to ensure the standby database is in sync with the primary database. PID:18158 TRACE:/usr/dbvisit/svn/projects/project970/standby/trace/18158_dbvctl_csd_PRODTEST_201605190927.trc LOG GAP report following CSD oracle@dbvlin504[/usr/dbvisit/svn/projects/project970/standby]: ./dbvctl.pl -d PRODTEST -i ============================================================= Dbvisit Standby Database Technology (8.0.01.15575) (pid 18596) dbvctl.pl started on dbvlin504: Thu May 19 09:40:18 2016 ============================================================= Dbvisit Standby log gap report for PROD thread 1 at 201605190940: ------------------------------------------------------------- Destination database on dbvlin503 is at sequence: 13. Source database on dbvlin504 is at applied log sequence: 13. Dbvisit Standby last transfer log sequence: 5. Dbvisit Standby last transfer at: 2016-05-19 09:35:58. Archive log gap for PROD: 0. Transfer log gap for PROD: 8. Standby database time lag (HH:MI:SS): 00:00:00. ============================================================= dbvctl.pl ended on dbvlin504: Thu May 19 09:40:21 2016 =============================================================
3. After successfully creating the standby, we have to schedule the archive send and apply . This has to be scheduled in such a way that archive has to be sent to PROD@dbvlin503 to PROD@dbvlin504 , so that the archive that needs to be sent for PRODTEST is available in dbvlin504.
PROD@dbvlin503 --->PROD@dbvlin504
PRIMARY dbvlin503 ================= oracle@dbvlin503[/usr/dbvisit/svn/projects/project970/standby]: ./dbvctl.pl -d PROD ============================================================= Dbvisit Standby Database Technology (8.0.01.15575) (pid 24312) dbvctl.pl started on dbvlin503: Thu May 19 09:41:23 2016 ============================================================= >>> Obtaining information from standby database (RUN_INSPECT=Y)... - done. >>> Note FORCE_LOGGING is disabled in the primary database. >>> Transferring Log file(s) for thread 1: thread_1_seq_14.477.912245469.gz ============================================================= dbvctl.pl ended on dbvlin503: Thu May 19 09:41:41 2016 ============================================================= STANDBY dbvlin504 ================= oracle@dbvlin504[/usr/dbvisit/svn/projects/project970/standby]: ./dbvctl.pl -d PROD ============================================================= Dbvisit Standby Database Technology (8.0.01.15575) (pid 18742) dbvctl.pl started on dbvlin504: Thu May 19 09:41:46 2016 ============================================================= >>> Log file(s) for PROD from dbvlin503 will be applied to dbvlin504 201605190941 - Log seq 14 thread 1 applied to standby database PROD. ============================================================= dbvctl.pl ended on dbvlin504: Thu May 19 09:42:07 2016 =============================================================
PRODTEST@dbvlin504 --->PRODTEST@dbvlin504
oracle@dbvlin504[/usr/dbvisit/svn/projects/project970/standby]: ./dbvctl.pl -d PRODTEST -i ============================================================= Dbvisit Standby Database Technology (8.0.01.15575) (pid 18766) dbvctl.pl started on dbvlin504: Thu May 19 09:42:20 2016 ============================================================= Dbvisit Standby log gap report for PROD thread 1 at 201605190942: ------------------------------------------------------------- Destination database on dbvlin503 is at sequence: 13. Source database on dbvlin504 is at applied log sequence: 14. Dbvisit Standby last transfer log sequence: 5. Dbvisit Standby last transfer at: 2016-05-19 09:35:58. Archive log gap for PROD: 1. Transfer log gap for PROD: 9. Standby database time lag (HH:MI:SS): 00:00:00. ============================================================= dbvctl.pl ended on dbvlin504: Thu May 19 09:42:23 2016 ============================================================= oracle@dbvlin504[/usr/dbvisit/svn/projects/project970/standby]: ./dbvctl.pl -d PRODTEST -R ============================================================= Dbvisit Standby Database Technology (8.0.01.15575) (pid 18780) dbvctl.pl started on dbvlin504: Thu May 19 09:42:55 2016 ============================================================= >>> Note FORCE_LOGGING is disabled in the primary database. Resynch option given. Dbvisit Standby configuration will be copied to dbvlin503... dbv_PRODTEST.env >>> Transferring Log file(s) for thread 1: 1_14_908458148.arc.gz ============================================================= dbvctl.pl ended on dbvlin504: Thu May 19 09:43:00 2016 ============================================================= STANDBY dbvlin503 ================= oracle@dbvlin503[/usr/dbvisit/svn/projects/project970/standby]: ./dbvctl.pl -d PRODTEST ============================================================= Dbvisit Standby Database Technology (8.0.01.15575) (pid 24547) dbvctl.pl started on dbvlin503: Thu May 19 09:43:18 2016 ============================================================= >>> Sending heartbeat message... skipped >>> Log file(s) for PRODTEST from dbvlin504 will be applied to dbvlin503 201605190943 - Log seq 14 thread 1 applied to standby database PRODTEST. ============================================================= dbvctl.pl ended on dbvlin503: Thu May 19 09:43:36 2016 ============================================================= STANDBY dbvlin504 ================= oracle@dbvlin504[/usr/dbvisit/svn/projects/project970/standby]: ./dbvctl.pl -d PRODTEST -i ============================================================= Dbvisit Standby Database Technology (8.0.01.15575) (pid 18804) dbvctl.pl started on dbvlin504: Thu May 19 09:43:44 2016 ============================================================= Dbvisit Standby log gap report for PROD thread 1 at 201605190943: ------------------------------------------------------------- Destination database on dbvlin503 is at sequence: 14. Source database on dbvlin504 is at applied log sequence: 14. Dbvisit Standby last transfer log sequence: 14. Dbvisit Standby last transfer at: 2016-05-19 09:43:00. Archive log gap for PROD: 0. Transfer log gap for PROD: 0. Standby database time lag (DAYS HH:MI:SS): 20 21:21:18. ============================================================= dbvctl.pl ended on dbvlin504: Thu May 19 09:43:47 2016 =============================================================
Comments