Standby on ASM when Primary using Filesystem
In some cases it might be required to create a standby database in ASM, when the primary database is making use of File system based storage.
This section will show you an example on how to create a single instance standby database using ASM.
In this example the setup is as follow:
- Dbvisit Standby version used: 7.0.12
- Operating System - Oracle Linux 5.8
- Oracle Database version 11.2.0.3
- Oracle Grid Infrastructure 11.2.0.3
- ASM Disk Groups: +DATA and +FRA
- Database Name: testdb
- Dbvisit Standby ARCHDEST: /u01/app/oracle/archive/testdb
- Primary Server Datafile Locations: /u01/app/oracle/oradata/testdb
- Primary Server Flash Recovery Area: /u01/app/oracle/flash_recovery_area
- Standby Server Datafile Locations: +DATA
- Standby Server Flash Recovery Area: +FRA
Â
Important
- Creating a standby database is performed on the primary server.
- You must have a DDC file already created before you proceed with CSD.
- Dbvisit Standby is making use of a directory referred to as the ARCHDEST. This location is specific to Dbvisit Standby and is not - and should not, be seen as the same as the Oracle Database Archive destinations.
Note: ASM 10.2. and above is supported, but Dbvisit Standby does not support Graceful Switchover when ASM versions less than 11.1 is used. ASM 11.2 with latest patches applied is recommended.
Â
The setup is created using the Dbvisit Standby CLI "dbvisit_setup".
Â
oracle@dbvlin504[/usr/dbvisit/standby]: ./dbvisit_setup ========================================================= Dbvisit Standby Database Technology (7.0.12.11991) http://www.dbvisit.com ========================================================= =>dbvisit_setup only needs to be run on the primary server. Is this the primary server? <Yes/No> [Yes]: ========================================================= Dbvisit Standby Database Technology (7.0.12.11991) http://www.dbvisit.com Dbvisit Database setup Default values will be shown in [] Options: 1) New Dbvisit Database setup (combines options 2,3,4) 1a) New Dbvisit RAC Instance setup (combines options 2,3,4) 2) New Dbvisit Database configuration (DDC) file setup 3) New Dbvisit Archive Management Module (AMM) setup 4) New Dbvisit Database repository (DDR) setup 5) Manage Dbvisit Database repository (DDR) 6) Update Dbvisit Database configuration (DDC) file 7) Create Standby Database (and template) 8) Synchronize Standby Database 9) Uninstall Dbvisit Database repository (DDR) E) Exit ========================================================= Please enter choice : 7 ------------------------------------------------------------------------------ =>Creating Standby Database. Primary database will NOT be shutdown. Choose database: The following Oracle database(s) have a Dbvisit Database configuration (DDC) file on this server: DDC === 1) prod 2) testdb 3) Return to menu Please enter choice : 2 Is this correct? <Yes/No> [Yes]: Yes Database testdb is up. >>> Checking Dbvisit Standby for configurational differences between dbvlin504 and dbvlin503... No configurational differences found between dbvlin504 and dbvlin503. >>> Checking Oracle installation on dbvlin503 in /u01/app/oracle/product/11.2.0/db_1/bin/oracle... >>> Checking primary datafiles on dbvlin504... >>> Validating Dbvisit configuration file on dbvlin503... >>> Checking if a database is up and running on dbvlin503... Checks completed OK. >>> Total database size for testdb is 1.21GB What would you like to do: 1 - Create standby database (and optionally save settings in template) 2 - Help 3 - Terminate processing Please enter your choice [1]: 1 ------------------------------------------------------------------------------- Do you want to create an ASM standby database (with all or some database files in ASM storage)? [No]: YES Standby database will be ASM: Y Is this correct? <Yes/No> [Yes]: Yes
Make Sure that you provide "Standby database will be ASM: Y"Â , since our standby database is using ASM.
------------------------------------------------------------------------------- Use network compression to compress the database files during transfer? [No]: Database files will be compressed during transfer: N Is this correct? <Yes/No> [Yes]: ------------------------------------------------------------------------------- Dbvisit Standby provides functionality to create missing filesystem directories on the standby server automatically. Do you want Dbvisit Standby to create missing filesystem directories on the standby server automatically? [Yes]: Yes Dbvisit Standby will create missing filesystem directories automatically: Y Is this correct? <Yes/No> [Yes]: Yes
When running a primary database using Filesystem and you are looking at creating a standby database on ASM storage, you need to make sure you review the following parameters:
- db_create_file_dest
- db_recovery_file_dest
- db_create_online_log_dest_n
Â
When using ASM these values can be set to specific ASM disk groups on the primary server. But when you are creating the standby database, you need to update these parameters to reflect the standby filesystem structure.
Example, this is the parameters on a primary database using ASM:
- db_create_file_dest=+DATA
- db_recovery_file_dest=+FRA
Â
Now when creating the standby database, you will lets say use d:\oracle\oradata as your primary datafile location (the database files will be created in d:\oracle\oradata\DB_NAME example d:\oracle\oradata\prod where prod is the database name). And with regards to the Flash/Fast recovery area you might be using d:\oracle\fast_recovery_area. The following adjustments to the db_create_file_dest and db_recovery_file_dest should be made:
- db_create_file_dest=d:\oracle\oradata
- db_recovery_file_dest=d:\oracle\fast_recovery_area
Â
If you have the db_create_online_log_dest_n values set you have to adjust them as well.
------------------------------------------------------------------------------- You choose to create an ASM standby database. You may wish to change certain Oracle database parameters values to point to valid ASM locations on the standby server. The following oracle database parameters will be set in the standby database pfile or spfile: ------------------------------------------------------------------------------- audit_file_dest /u01/app/oracle/admin/testdb/adump compatible 11.2.0.0.0 control_files /u01/app/oracle/oradata/testdb/control01.ctl, /u01/app/oracle/fast_recovery_area/testdb/control02.ctl db_block_size 8192 db_name testdb db_recovery_file_dest /u01/app/oracle/fast_recovery_area db_recovery_file_dest_size 4322230272 diagnostic_dest /u01/app/oracle dispatchers (PROTOCOL=TCP) (SERVICE=testdbXDB) log_archive_format %t_%s_%r.dbf open_cursors 300 pga_aggregate_target 255852544 processes 150 remote_login_passwordfile EXCLUSIVE sga_target 771751936 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 Enter full parameter name: []: db_create_file_dest 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. Enter new value (leave blank to set to null or default Oracle value): []: +DATA Validating ... please wait The following oracle database parameters will be set in the standby database pfile or spfile: ------------------------------------------------------------------------------- audit_file_dest /u01/app/oracle/admin/testdb/adump compatible 11.2.0.0.0 control_files /u01/app/oracle/oradata/testdb/control01.ctl, /u01/app/oracle/fast_recovery_area/testdb/control02.ctl db_block_size 8192 db_create_file_dest +DATA db_name testdb db_recovery_file_dest /u01/app/oracle/fast_recovery_area db_recovery_file_dest_size 4322230272 diagnostic_dest /u01/app/oracle dispatchers (PROTOCOL=TCP) (SERVICE=testdbXDB) log_archive_format %t_%s_%r.dbf open_cursors 300 pga_aggregate_target 255852544 processes 150 remote_login_passwordfile EXCLUSIVE sga_target 771751936 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 Enter full parameter name: []: db_recovery_file_dest 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. Enter new value (leave blank to set to null or default Oracle value): []: +FRA Validating ... please wait The following oracle database parameters will be set in the standby database pfile or spfile: ------------------------------------------------------------------------------- audit_file_dest /u01/app/oracle/admin/testdb/adump compatible 11.2.0.0.0 control_files /u01/app/oracle/oradata/testdb/control01.ctl, /u01/app/oracle/fast_recovery_area/testdb/control02.ctl db_block_size 8192 db_create_file_dest +DATA db_name testdb db_recovery_file_dest +FRA db_recovery_file_dest_size 4322230272 diagnostic_dest /u01/app/oracle dispatchers (PROTOCOL=TCP) (SERVICE=testdbXDB) log_archive_format %t_%s_%r.dbf open_cursors 300 pga_aggregate_target 255852544 processes 150 remote_login_passwordfile EXCLUSIVE sga_target 771751936 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 Enter full parameter name: []: control_files Leave blank to create Oracle Managed Control File(s) if creating of OMF files is enabled, otherwise to create control file(s) in OS specific location. 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. Enter new value (leave blank to set to null or default Oracle value): []: +DATA Validating ... please wait The following oracle database parameters will be set in the standby database pfile or spfile: ------------------------------------------------------------------------------- audit_file_dest /u01/app/oracle/admin/testdb/adump compatible 11.2.0.0.0 control_files +DATA db_block_size 8192 db_create_file_dest +DATA db_name testdb db_recovery_file_dest +FRA db_recovery_file_dest_size 4322230272 diagnostic_dest /u01/app/oracle dispatchers (PROTOCOL=TCP) (SERVICE=testdbXDB) log_archive_format %t_%s_%r.dbf open_cursors 300 pga_aggregate_target 255852544 processes 150 remote_login_passwordfile EXCLUSIVE sga_target 771751936 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]: 1 Validating oracle database parameters... please wait SUCCEEDED
Verify the values provided for "db_create_file_dest" , "db_recovery_file_dest" and "control_files" before you proceed with creating the standby database.
Â
In this example:
Standby Datafile Location is changed to "+DATA" from "/u01/app/oracle/oradata/testdb" in Primary Database.
And
Standby Recovery Location is changed to "+FRA" from "/u01/app/oracle/fast_recovery_area" in Primary Database.
And
Standby Controlfile Location is changed to "+DATA" from "/u01/app/oracle/oradata/testdb" in Primary Database.
------------------------------------------------------------------------------- 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. [No]: No Transportable media will be used: N Is this correct? <Yes/No> [Yes]: Yes ------------------------------------------------------------------------------- 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.21GB). Specify the location on this server: [/usr/tmp]: /usr/tmp Directory for temporary location will be: /usr/tmp Is this correct? <Yes/No> [Yes]: ------------------------------------------------------------------------------- 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]: /usr/tmp Directory for temporary will be: /usr/tmp Is this correct? <Yes/No> [Yes]: Yes ------------------------------------------------------------------------------- The creation of the standby database consists of 2 parts: 1) Backup database to temporary location. 2) Transfer backup from temporary location to standby server. The process can be stopped after step 1 and then continued with step 2 at a later date. Do you want to the process to stop between these 2 steps? [No]: No Process will stop between steps: N Is this correct? <Yes/No> [Yes]: Yes Dbvisit Standby will automatically create standby OMF ASM datafiles and tempfiles. The files will be created under <ASM Disk Group>/<db_unique_name>/datafile|tempfile. Review and confirm ASM disk groups for standby datafiles and tempfiles. ------------------------------------------------------------------------------- Primary ===> Standby ------------------------------------------------------------------------------- /u01/app/oracle/oradata/testdb ===> /u01/app/oracle/oradata/testdb ------------------------------------------------------------------------------- What would you like to do: 1 - Confirm standby location(s) are correct and continue 2 - Provide different standby location(s) Please enter your choice [1]: Location: /u01/app/oracle/oradata/testdb Problem: Standby database must use ASM storage Solution: Provide ASM location Please press <Enter> to continue... ------------------------------------------------------------------------------- Primary ===> Standby ------------------------------------------------------------------------------- /u01/app/oracle/oradata/testdb ===> /u01/app/oracle/oradata/testdb ------------------------------------------------------------------------------- What would you like to do: 1 - Confirm standby location(s) are correct and continue 2 - Provide different standby location(s) Please enter your choice [1]: 2 Primary location: /u01/app/oracle/oradata/testdb Avilable ASM Diskgroups on standby server: +DATA +FRA Provide ASM Diskgroup name: []: +DATA Is this correct? <Yes/No> [Yes]: Yes ------------------------------------------------------------------------------- Primary ===> Standby ------------------------------------------------------------------------------- /u01/app/oracle/oradata/testdb ===> +DATA ------------------------------------------------------------------------------- What would you like to do: 1 - Confirm standby location(s) are correct and continue 2 - Provide different standby location(s) Please enter your choice [1]: 1 Primary database contains non-OMF redo logs. Non-OMF ASM redo logs will be created under: <ASM Disk Group>/<db_unique_name>/onlinelog. Make sure these locations exist on the standby server or create them manually. Review and confirm ASM disk group names for non-OMF standby redo logs. ------------------------------------------------------------------------------- Primary ===> Standby ------------------------------------------------------------------------------- /u01/app/oracle/oradata/testdb ===> /u01/app/oracle/oradata/testdb ------------------------------------------------------------------------------- What would you like to do: 1 - Confirm standby location(s) are correct and continue 2 - Provide different standby location(s) Please enter your choice [1]: 2 Primary location: /u01/app/oracle/oradata/testdb Avilable ASM Diskgroups on standby server: +DATA +FRA Provide ASM Diskgroup name: []: +FRA Is this correct? <Yes/No> [Yes]: Yes ------------------------------------------------------------------------------- Primary ===> Standby ------------------------------------------------------------------------------- /u01/app/oracle/oradata/testdb ===> +FRA ------------------------------------------------------------------------------- What would you like to do: 1 - Confirm standby location(s) are correct and continue 2 - Provide different standby location(s) Please enter your choice [1]: 1 ------------------------------------------------------------------------------- =>Create standby database template for testdb using provided answers? <Yes/No> [Yes]: Yes What would you like to do: 1 - Continue with creating a standby database 2 - Terminate creating a standby database. The saved template will be available for future use Please enter your choice [1]: 1 >>> Dbvisit 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 Dbvisit 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. >>> 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 'dbv_testdb_csd_dbf_1_01p6i3m8_1_1.rman' to server dbvlin503:7890 Progress: 0%...20%...40%...60%...80%...100% [10561 KB/s] - done. > Transferring 'dbv_testdb_csd_dbf_1_02p6i3nl_1_1.rman' to server dbvlin503:7890 Progress: 0%...20%...40%...60%...80%...100% [11093 KB/s] - done. > Transferring 'dbv_testdb_csd_dbf_2_03p6i3nr_1_1.rman' to server dbvlin503:7890 Progress: 0%...20%...40%...60%...80%...100% [11568 KB/s] - done. > Transferring 'dbv_testdb_csd_dbf_3_04p6i3or_1_1.rman' to server dbvlin503:7890 Progress: 0%...20%...40%...60%...80%...100% [10149 KB/s] - done. > Transferring 'dbv_testdb_csd_dbf_4_05p6i3p5_1_1.rman' to server dbvlin503:7890 Progress: 0%...20%...40%...60%...80%...100% [11599 KB/s] - done. >>> Restoring standby control files... - done. >>> Starting standby database testdb 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. >>> Performing checkpoint and archiving logs... - done. >>> Finishing standby database creation... - done. Standby database created. To complete creating standby database please run Dbvisit on the primary server first, then on the standby server, to ensure the standby database is in sync with the primary database. Please press <Enter> to continue... ========================================================= Standby Database creation on dbvlin503 completed. Next steps: 1) Exit out of dbvisit_setup. 2) Run Dbvisit on this server with command: dbvisit database_name 3) Run Dbvisit on standby server with command: dbvisit database_name Once Dbvisit has been tested, schedule Dbvisit on primary and standby servers using cron or other scheduling tool. ========================================================= Please press <Enter> to continue... ========================================================= Dbvisit Standby Database Technology (7.0.12.11991) http://www.dbvisit.com Dbvisit Database setup Default values will be shown in [] Options: 1) New Dbvisit Database setup (combines options 2,3,4) 1a) New Dbvisit RAC Instance setup (combines options 2,3,4) 2) New Dbvisit Database configuration (DDC) file setup 3) New Dbvisit Archive Management Module (AMM) setup 4) New Dbvisit Database repository (DDR) setup 5) Manage Dbvisit Database repository (DDR) 6) Update Dbvisit Database configuration (DDC) file 7) Create Standby Database (and template) 8) Synchronize Standby Database 9) Uninstall Dbvisit Database repository (DDR) E) Exit ========================================================= Please enter choice : E
Â
Once the above was complete you can add the Dbvisit Standby License (Key below is just a demo key)
oracle@dbvlin504[/usr/dbvisit/standby]: ./dbvisit -lic testdb GZP8P-E04H9-9PHDF-SOA0R-ZB3UX-E8JVF-4SD8F ============================================================= Dbvisit Standby Database Technology (7.0.12.11992) (pid 5481) dbvisit started on dbvlin504: Thu Apr 24 17:48:54 2014 () ============================================================= Dbvisit Standby license information for: testdb customer_seq=1 customer_key_seq=0 license_type=DEMO (0) expiry_date=2014-05-24 =>Update with license key: GZP8P-E04H9-9PHDF-SOA0R-ZB3UX-E8JVF-4SD8F? <Yes/No> [Yes]: License updated. Status: Valid ============================================================= dbvisit ended on dbvlin504: Thu Apr 24 17:49:00 2014 =============================================================
Â
You can now send logs to the standby from the primary server:
oracle@dbvlin504[/usr/dbvisit/standby]: ./dbvisit testdb ============================================================= Dbvisit Standby Database Technology (7.0.12.11992) (pid 5509) dbvisit started on dbvlin504: Thu Apr 24 17:49:10 2014 () ============================================================= >>> Obtaining information from standby database (RUN_INSPECT=Y)... >>> Sending heartbeat message... - done. >>> Checking Dbvisit Standby for configurational differences between dbvlin504 and dbvlin503... No configurational differences found between dbvlin504 and dbvlin503. >>> Log file(s) for testdb will be transferred from dbvlin504 to dbvlin503... > Transferring 'o1_mf_1_2_9ok8bdph_.arc.gz' to server dbvlin503:7890 Progress: 0%...20%...40%...60%...80%...100% [11048 KB/s] - done. 1 archive log transfer to dbvlin503 for testdb completed. Last sequence was 2. No Mail sent as SEND_MAIL_FLAG = N >>> Dbvisit Archive Management Module (AMM) Config: number of archives to keep = 0 Config: number of days to keep archives = 7 Config: archive backup count = 0 Config: diskspace full threshold = 80% Current disk percent full (/u01/app/oracle/fast_recovery_area) = 41% Number of archive logs deleted = 0 ============================================================= dbvisit ended on dbvlin504: Thu Apr 24 17:49:28 2014 =============================================================
Â
Run Dbvisit now on the standby to apply the logs:
oracle@dbvlin503[/usr/dbvisit/standby]: ./dbvisit testdb ============================================================= Dbvisit Standby Database Technology (7.0.12.11992) (pid 4910) dbvisit started on dbvlin503: Fri Apr 25 06:28:15 2014 () ============================================================= >>> Log file(s) for testdb from dbvlin504 will be applied to dbvlin503 201404250628 - Log seq 2 thread 1 applied to standby database testdb. No Mail sent as SEND_MAIL_FLAG_DR = N >>> Dbvisit Archive Management Module (AMM) Config: number of archives to keep = 0 Config: number of days to keep archives = 7 Config: diskspace full threshold = 80% Processing /u01/app/oracle/archive/testdb... Archive log dir: /u01/app/oracle/archive/testdb Total number of archive files : 1 Number of archive logs deleted = 0 Current Disk percent full : 88% Disk space is sparse (88% full) and it is not allowed to remove oldest archives from -> /u01/app/oracle/archive/testdb This is due to DELETE_ARCHDEST = N being set in DDC file. No Mail sent as SEND_MAIL_FLAG_DR = N ============================================================= dbvisit ended on dbvlin503: Fri Apr 25 06:28:20 2014 =============================================================
Â
The question now is what is in ASM, the output of the Standby datafile information now shows that my standby database files are located in ASM using OMF:
Â
Datafile Stats =========================================== FILE# Status Ensabled Name File Size MB ---------- ---------- --------------- -------------------------------------------------- ------------ 1 SYSTEM READ WRITE +DATA/testdb/datafile/system.346.845791589 700.00 2 ONLINE READ WRITE +DATA/testdb/datafile/sysaux.345.845791639 500.00 3 ONLINE READ WRITE +DATA/testdb/datafile/undotbs1.341.845791669 30.00 4 ONLINE READ WRITE +DATA/testdb/datafile/users.340.845791679 5.00 SQL> show parameter control_files NAME TYPE VALUE ------------------------------------ ----------- ------------------------------ control_files string +DATA/testdb/controlfile/current.348.845791567 SQL> show parameter recovery NAME TYPE VALUE ------------------------------------ ----------- ------------------------------ db_recovery_file_dest string +FRA db_recovery_file_dest_size big integer 4122M recovery_parallelism integer 0 Â SQL> show parameter db_create_file_dest NAME TYPE VALUE ------------------------------------ ----------- ------------------------------ db_create_file_dest string +DATA SQL> Â
Â
Â
Â
Â
Â
Â
Â