Introduction
This article describes how to move a virtual database (VDB) into a physical database stored on Oracle Automatic Storage Management (ASM) disk groups. This is a scripted procedure that is assisted (but not fully automated) by Delphix. No intermediate storage is needed; the database files are moved directly from Delphix into the ASM diskgroup(s).
This procedure can be used to export a VDB to ASM disk group(s), including disk group(s) residing in an Oracle Exadata machine. The move-to-asm.sh
script follows Oracle's recommended best practice of using a single disk group for data files. A separate disk group can be specified for redo log files. Professional Services can be engaged if customization is needed.
Procedure
- Create an ASM disk group that will contain all the database files. Optionally, create a separate disk group for redo log files.
Provision a VDB on the target machine that is running Oracle ASM or Exadata in order to do the export; this VDB will be deleted after the export is complete. This temporary VDB can be provisioned from an existing VDB. You can also provision it from a dSource, which allows you to achieve a full restore of the original source ASM database.
- Login to the target machine (or a node of the target RAC cluster) where the VDB instance and ASM instance are running. The directory will be in the form:
<toolkit_path>/Delphix_<engine_id><user><host|cluster>/databases/oracle/<db_unique_name>/<database_sid>/
For a RAC database, be sure to use the directory path containing the SID of the instance running on the node where you have logged in.
- Ensure that Oracle environment variables ORACLE_HOME,ORACLE_SID, and CRS_HOME (RAC only) are correctly set for the VDB that needs to be moved.
- Execute the script
move-to-asm.sh
as the Environment User who provisioned the single instance VDB. For a RAC VDB, the Environment User selected to execute themove-to-asm.sh
must be the Oracle installation owner. This is due to an Oracle restriction that only the installation owner can invokesrvctl
to add or remove database configurations.
Alternatively, entermove-to-asm.sh
as a Post-Provision Hook Script when provisioning the VDB. This will provision and move the VDB into ASM disk groups in a single flow. You must specify the-noask
option to execute in non-interactive mode. For more information about hook scripts, visit the Hook Scripts for Automation and Customization article.
Command syntax: move-to-asm.sh [-noask] [-parallel #] [-dbunique db_unique_name] <data_diskgroup> [<redo_diskgroup>]
Arguments | Description |
| Do not prompt for confirmation before moving the VDB. The default is to prompt. |
| The number of RMAN channels used to move the VDB to ASM. The default is 8. |
| Unique database name for the resulting physical database. The default is the unique name of the VDB. The |
| Target ASM disk group for data, server parameter and control files. |
| Target ASM disk group for redo log files. Default is |
move-to-asm script
The move-to-asm.sh script generates several output files. These files are all written to the working directory of the script:
init<oracle_sid>_run<process-id>_moveasm.ora
The log file for the operation:
move-to-asm.sh_<oracle_sid>_run<process-id>.log
The init.ora parameter file created for the ASM DB instance:
source_init<oracle_sid>.ora
The init.ora for the source database (from which the VDB was created).
Finishing Steps
The final steps to manually execute are shown when the script completes and included in the script output.
- For Single Instance only: copy generated
init<$ORACLESID>.ora
parameter file to the default$ORACLE_HOME/dbs/init<$ORACLE_SID>.ora
Modify initialization parameters to match the original source database parameters, if necessary.
As a convenience to assist with this step, the source database parameters are restored as
source_init<$ORACLE_SID>.ora
in the execution directory. Be sure to copy this file to a save place before deleting the temporary VDB.
The move-to-asm.sh script generates several output files. These files are all written to the working directory of the script and should also be copied to a safe place if needed:move-to-asm.sh_<oracle_sid>_run<process-id>.log
The log file for the operation:
init<oracle_sid>_run<process-id>_moveasm.ora
The init.ora parameter file created for the ASM DB instance:
source_init<oracle_sid>.ora
The init.ora for the source database (from which the VDB was created).
- Delete the Delphix VDB that was moved.
Start up the physical database that will now run on ASM.
(A RAC database is automatically started up by themove-to-asm.sh
script usingsrvctl
but may have been stopped when the VDB was deleted, if it has the same name.)
Sample Execution
$ cd toolkit/Delphix_564dc816_d457_6224_1327_4d43fd1b3d97_oracle_cluster/databases/oracle/RAC2ASM/RAC2ASM1 $ export ORACLE_HOME=/u01/app/oracle/product/12.2.0.1/dbhome_1 $ export ORACLE_SID=RAC2ASM1 $ sh move-to-asm.sh -noask +DATA +REDO END_OF_SETUP ============================================================ Virtual-to-ASM script (move-to-asm.sh v5.2) for Delphix Copyright (c) 2013, 2018 by Delphix. All rights reserved. ============================================================ Moving database RAC2ASM to ASM: started at Wed Feb 19 16:08:43 EST 2020 db_unique_name => RAC2ASM ORACLE_SID => RAC2ASM1 ORACLE_HOME => /u01/app/oracle/product/12.2.0.1/dbhome_1 Datafile diskgroup => +DATA Online redo diskgroup => +REDO RMAN Channels => 8 Create cluster database RAC2ASM Generate script to move tempfiles to ASM Generate script to drop old tempfiles Generate script to drop offline tablespaces Generate script to make read-only tablespaces read-write Generate script to make tablespaces read-only again Make read-only tablespaces read-write Remove offline tablespaces Updating server parameter file with ASM locations Creating temporary initialization parameter file Move spfile to ASM Move datafiles to ASM: started at Wed Feb 19 16:09:41 EST 2020 Move datafiles to ASM: completed at Wed Feb 19 16:10:31 EST 2020 Stop cluster database RAC2ASM Restart cluster database RAC2ASM Remove old tempfiles Move tempfiles into ASM Move Online logs Restore any read-only tablespaces Shutdown database Starting up RAC database RAC2ASM... Database RAC2ASM moved to ASM: completed at Wed Feb 19 16:12:45 EST 2020 Final Steps to complete the move to ASM: Source parameters are restored at /home/oracle/toolkit/Delphix_564dc816_d457_6224_1327_4d43fd1b3d97_oracle_cluster/databases/oracle/RAC2ASM/RAC2ASM1/source_initRAC2ASM1.ora *.audit_file_dest='/u01/app/oracle/admin/DBOMSRD914EA/adump' *.audit_trail='DB' *.cluster_database=TRUE *.compatible='12.2.0' *.control_files='+DATA/DBOMSRD914EA/CONTROLFILE/current.297.1027776391','+REDO/DBOMSRD914EA/CONTROLFILE/current.264.1027776391' *.db_block_size=8192 *.db_create_file_dest='+DATA' *.db_create_online_log_dest_1='+DATA' *.db_create_online_log_dest_2='+REDO' *.db_name='DBOMSRD9' *.db_recovery_file_dest='+REDO' *.db_recovery_file_dest_size=6989807616 *.db_unique_name='DBOMSRD914EA' *.diagnostic_dest='/u01/app/oracle' *.dispatchers='(PROTOCOL=TCP) (SERVICE=DBOMSRD914EAXDB)' *.dlpx_recovery_log_archive_format='arch_%t_%s_%r.log' *.instance_number=1 *.listener_networks='' *.local_listener='(ADDRESS=(PROTOCOL=TCP)(HOST=10.43.5.243)(PORT=1521))' *.log_archive_format='%t_%s_%r.dbf' *.memory_max_target=1073741824 *.memory_target=1073741824 *.nls_language='AMERICAN' *.nls_territory='AMERICA' *.open_cursors=300 *.processes=300 *.remote_listener='node1.sample.delphix.com:1521' *.remote_login_passwordfile='EXCLUSIVE' *.thread=1 *.undo_tablespace='UNDOTBS1' Copy this file to a safe location before removing the VDB 1) Delete VDB on Delphix. 2) Modify initialization parameters to match source and restart.