This topic describes how to customize file path mappings when provisioning a virtual database (VDB).
In the VDB provisioning process, it may be necessary to create mappings between files and directories that exist on the source, and files or file directories that exist on the target. An example of this is creating a copy in the target environment of a wallet file for an encrypted database that exists in the source environment.
During VDB provisioning, the archive, datafile, external, script and temp directories are mounted from the Delphix Engine to the <Mount Base>/<Database Unique Name>
You can specify the Mount Base and the Database Unique Name on the Provision VDB card at provision time.
But the archive, datafile, external, script and temp mount points are fixed.
- The default Mount Base is set to /mnt/provision
- The default Database Unique Name starts with a capital V and includes the dSource name
Mount Base: /mnt/provision
Database Unique Name: Vdbhcp3_35F
File Mappings affect everything that follows the mount point directories above. For datafiles, the datafile location from the dSource is used. You can determine the directory structure by querying the Source database:
SQL> select name from v$datafile;
Users have control over the datafiles that were returned by the select name from v$datafile and also the controlfile location.
Archive log files go directly into /mnt/provision/Vdbhcp3_35F/archive
Tempfiles go directly into /mnt/provision/Vdbhcp3_35F/temp
By default VDB File Mapping would append the above directory structure to the /mnt/provision/Vdbhcp3_35F/datafile directory:
Pattern Matching Example
You can use pattern matching rules to create full path names for data files and control files.
Pattern matching rules have the form source-regex-expression-KEY : target-replacement-VALUE. You can use multiple rules, which are applied successively. Multiple rules with the same source key are allowed.
File Mapping Options
For this example, the ultimate goal is to create a VDB that has the following datafile File Mappings:
You can change the default behavior in a few different ways.
- Modify the Mount Base.
- Modify the Database Unique Name.
- Modify the Mount Base and the Database Unique Name.
- Modify the name of the individual subdirectories within the Mount Base/Database Unique Name/datafile directory.
Numbers 1-3 can be changed by simply modifying the Mount Base and/or Database Unique Name values when provisioning a VDB:
The datafile locations can be changed in the Advanced tab of the Provision VDB wizard and scroll down to File Mapping:
When you are changing File Mapping, remember that you only need to refer to the part of the path after /Mount Base/Unique Database Name/datafile.
Start by changing all the datafile locations from /u03/devvdb3/datafile/datafile/dbdhcp3/oradata/dbdhcp3
/u03/devvdb3/datafile/data by selecting the + sign and setting File Mapping Source File Match and the Replacement and then select Validate to see result.
The result will show the new directory structure for all the datafiles and control file relative to the " /Mount Base/Unique Database Name/datafile" directory, but will only show the directories after the datafile directory.
Selecting Validate will show the result of the above mapping, for all the datafiles.
The File Mappings build upon one another, so the first mapping moves almost all the datafiles and the controlfile to /u03//devvdb3/datafile/data.
/u03/app/ora11202/product/11.2.0/dbhome_1/dbs/dbv_R2V4.dbf was not remapped, as it did not contain the directory structure defined in in Source File Match (/datafile/dbdhcp3/oradata/dbdhcp3)
If you wanted the remaining datafiles and controlfile to remain in /data, it would only require the two File Mappings.
The remaining datafiles and controlfile can be relocated by adding to the mapping (select "+" between each Source File Match/Replacement pair).
Select Validate between each new entry in order to verify that datafiles are being mapped as expected.
Once all the files are located the way you want them, select Next to continue the provision process.
The Summary page will show the modifications to Mount Base and Unique Database Name and will show that Customized File Mapping was defined.
After provisioning completes, you can login to the Target server and verify that the datafiles were mapped correctly:
SQL> select name from v$datafile;
In this example, several rules are applied to the source file path /app/oracle/oradata/system01.dbf.
- Applying the rule ora:foo results in: /app/foocle/foodata/system01.dbf
- Applying the rule foo:bar results in: /app/barcle/bardata/system01.dbf
- Applying the rule ora:no results in an error, because ora is no longer found in the pathname.
- Applying the rule bar:oranew results in: /app/oranewcle/oranewdata/system01.dbf
- Applying the rule ora:yes results in /app/yesnewcle/yesnewdata/system01.dbf
During the pattern matching process, two errors can be generated.
- No match for specified mapping rules
This is the result when no rules match a source file
- Invalid regex pattern specified for path mapping
This is the result of an invalid regex rule mapping
This topic on the java.regex.util class, hosted on docs.oracle.com, shows the regular expression syntax and constructs recognized by the Delphix Engine pattern-matching operations.
Applying VDB File Mappings During the Provisioning Process
- In the Target Configuration tab of the Provision VDB wizard, click Advanced.
- Select Configure File Mapping.
- Click Next.
- Click the Plus icon to add a mapping rule.
- Enter the mapping rule.
- Click Validate to see the results of applying the rule.
If not matches are found, you will see an error message.
- Click Next to continue with the provisioning process.