This topic 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. A full restore of the original source ASM database from a Delphix dSource can be achieved using this procedure. No intermediate storage is needed; the database files are moved directly from Delphix into the source database ASM diskgroups.

This procedure applies to stand-alone and RAC databases residing on ASM disk groups, including databases residing in an Oracle Exadata machine.

Prerequisites

  • Provision a VDB on the target machine that is running Oracle ASM or Exadata
  • Create an ASM disk group that will contain all the database files. Optionally create a separate disk group for redo log files.
  • Where multiple disk groups are used for datafiles, the reference move-to-asm.sh script will need to be modified. Oracle best practices recommend a single datafile disk group.
This procedure applies to all Oracle RDBMS Versions supported by Delphix.

Procedure

  1. Download the reference shell script move-to-asm.sh on the target machine where the VDB instance and ASM instance are running.
  2. 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.
  3. 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 move-to-asm.shmust be the Oracle installation owner. This is due to an Oracle restriction that only the installation owner can invoke srvctl to add or remove database configurations.

move-to-asm.sh [-noask] [-parallel #] [-dbunique db_unique_name] <data_diskgroup> [<redo_diskgroup>]

Parameters

Description

-noask [optional]

Do not prompt for confirmation before moving the VDB. Default is to prompt.

-parallel [optional]

Number of RMAN channels used to move the VDB to ASM. Default is 8.

-dbunique [optional]

Database unique name for the resulting physical database. Default is VDB unique name.

<data_diskgroup> [required]

Target ASM disk group for data, server parameter and control files.

<redo_diskgroup> [optional]

Target ASM disk group for redo log files. Default is data_diskgroup.

$ /home/ora1120/scripts/delphix/move-to-asm.sh Usage: move-to-asm.sh [-noask] [-parallel #] [-dbunique db_unique_name] <data_diskgroup> [<redo_diskgroup>] $ /home/ora1120/scripts/delphix/move-to-asm.sh -noask -dbunique davis +DATA +LOG ============================================================ Virtual-to-ASM script (move-to-asm.sh v1.5) for Delphix 3.x Copyright (c) 2013 by Delphix. ============================================================ Moving database db52temp to ASM: started at Mon Jun 10 11:48:31 EDT 2013 db_unique_name => db52 ORACLE_SID => db52 ORACLE_HOME => /opt/app/oracle/product/11.2.0/dbhome_1 Datafile diskgroup => +VIIL RMAN Channels => 8 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 Make read-only tablespaces read-write Remove offline tablespaces Updating server parameter file with ASM locations Move spfile to ASM Move datafiles to ASM: started at Mon Jun 10 11:49:25 EDT 2013 Move datafiles to ASM: completed at Mon Jun 10 11:56:09 EDT 2013 Startup database with updated parameters Move tempfiles into ASM Move Online logs Restore any read-only tablespaces Remove old tempfiles Database db52 moved to ASM: completed at Mon Jun 10 11:57:19 EDT 2013 Final Steps to complete the move to ASM: 1) Delete VDB on Delphix. 2) Copy new init.ora: cp /home/ora1120/scripts/delphix/initdb52_run8396_moveasm.ora /opt/app/oracle/product/11.2.0/dbhome_1/dbs/initdb52.ora 3) Startup database instance. 4) Modify initialization parameters to match source and restart. Source parameters are restored at /home/ora1120/scripts/delphix/source_initdb52.ora

4. Alternatively, enter  move-to-asm.sh  as a  Post Script  when provisioning the VDB. This will provision and move the VDB into ASM diskgroups in a single flow.

You must specify the  -noask  option to execute in non-interactive mode. For example:

/delphix/scripts/move-to-asm.sh -noask -parallel 10 +DATA +REDO

For more information see, Customizing Oracle Management with Hook Operations.

For releases prior to 3.1.4, move-to-asm.sh must be modified to add the CRS_HOME environment variable for RAC VDB target environments.

Source Database: db_unique_name = proddb, db_name = proddb 
4 RAC Instance ORACLE_SID = prod1, prod2, prod3, prod4. 
All datafiles are contained in ASM diskgroup +DATA 
Redo log files are in diskgroup +LOG.
Shut down all RAC instances for proddb. The entire database must be shut down before a full restore.
Issue srvctl stop database -d proddb
Remove all files in the +DATA and +LOG diskgroups using asmcmd.
Provision a VDB from the proddb dSource timeflow to RAC node 1 (SID prod1) with a Post Script to move into ASM:
In the Provision VDB wizard, set Database Unique Name to proddbtemp, set SID to prod1, set Database Name to proddb.
Set Post Script to /delphix/scripts/move-to-asm.sh -noask -dbunique proddb +DATA +LOG
This method preserves the Database Unique Name, Database Name and SID of the original source database when restoring from a dSource
The move-to-asm.sh script generates several output files. These files are all written to the working directory of the script:
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)

Post-Requisites

Final steps to be manually executed are displayed when the script completes and are written to the execution output log.

  1. Delete the Delphix VDB that was moved.
  2. For Single Instance only: copy generated init.ora parameter file to the default $ORACLE_HOME/dbs/init<$ORACLE_SID>.ora
  3. For Single Instance only: startup the physical database that will now run on ASM.
    A RAC database is automatically started up by the move-to-asm.sh script using srvctl.
  4. 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

Related Links