CLI cookbook: provisioning a virtual PDB to a new virtual CDB
This topic describes how to provision a virtual pluggable database (vPDB) to a virtual container database (vCDB) using the command-line interface.
This process applies to Oracle container databases (CDBs) and the pluggable databases (PDBs) found within them that have been linked to Delphix as dSources. As container databases can only be found in Oracle 12.1.0.1 releases and above of Oracle, this topic is relevant to only these releases.
Prerequisites
The provisioning of virtual PDBs in Delphix is dependent on the following entities being in place prior to attempting the creation of this type of Delphix dataset.
A source container database must be linked to the engine.
The source container database must have pluggable databases within it linked as dSources to Delphix.
A destination host with an Oracle home of the same release as the source database must be available and already discovered as an Environment in Delphix.
In the example CLI provision detailed below the following databases are in place:
The source container database is called "CDOMLOSR1TB"
The pluggable database found in "CDOMLOSR1TB" that has been linked as a dSource is called "CDOMLOSR1TBPDB1"
The destination virtual container database will be called "cdbvirt"
Within the Delphix Engine CLI the name of the repository (target Oracle home) on the target system is '/u01/app/oracle/product/12.2.0.1/dbhome_1'
The destination virtual pluggable database will be called "PDBS3" and run from virtual container database "cdbvirt"
Delphix creates a temporary container database on the target host which will be used to establish the virtualized copy of the dSource PDB "pdborcl". This temporary CDB will be created and running during the provisioning process, it will be destroyed at the end of the provision of the virtual PDB.
Procedure
Log into the Delphix command-line interface using the admin user or a user with admin privileges.
CODE$ ssh admin@YOUR_ENGINE
Move to the database provisioning command line object.
CODEdelphix> database provision
Give the dataset a name.
CODEdelphix database provision *> set container.name=PDBS3
Place the new dataset in a Group that appears in the Delphix GUI, in this case, the Targets group.
CODEdelphix database provision *> set container.group=Targets
Set the type of provision to perform, for Oracle virtual database (VDB) - VDB/vPDBs, the type will be OracleVirtualPdbSource.
CODEdelphix database provision *> set source.type=OracleVirtualPdbSource
Set the destination mount point which Delphix NFS mounts are to be linked to under the virtual PDB. This folder must exist at a file system level on the target host. Do not use single quotes around the mount path.
CODEdelphix database provision *> set source.mountBase="/mnt/provision"
Name the vPDB. This is what it will appear as in the destination container database.
CODEdelphix database provision *> set sourceConfig.databaseName=PDBS3
Supply the dSource PDBs details. In this example, the provision will use the latest point in time available to the dSource PDB as the point in time from which to provision the vPDB. Setting a different timeflowPointParameters.type would allow you to use points in time other than the latest snapshot or latest point in time if this is what you desire. Using other types is not covered in this example
CODEdelphix database provision *> set timeflowPointParameters.container=CDOMLOSR1TBPDB1
Give the virtual CDB a name:
CODEdelphix database provision *> set virtualCdb.container.name=cdbvirt
Place the virtual CDB in a Group that appears in the Delphix GUI, in this case, the target group.
CODEdelphix database provision *> set virtualCdb.container.group=Targets
If automatically restarting the vPDB and vCDB is not required after a reboot of the target host, set this to option to false.
CODEdelphix database provision *> set virtualCdb.source. allowAutoVDBRestartOnHostReboot=false
Set the destination mount point which Delphix NFS mounts are to be linked to under the virtual CDB. This folder must exist at a file system level on the target host. Do not use single quotes around the mount path.
CODEdelphix database provision *> set virtualCdb.source.mountBase="/mnt/provision"
Set the vCDB configuration type to one of OracleRACConfig or OracleSIConfig. RAC configurations are not covered in this article:
CODEdelphix database provision *> set virtualCdb.sourceConfig.type=OracleSIConfig
Set the database name for the virtual CDB:
CODEdelphix database provision *> set virtualCdb.sourceConfig.databaseName=cdbvirt
Set the target system environment user that while be used to run the virtual CDB:
CODEdelphix database provision *> set virtualCdb.sourceConfig.environmentUser=oracle
Set the instance name and number for the virtual CDB
CODEdelphix database provision *> set virtualCdb.sourceConfig.instance.instanceName=cdbvirt delphix database provision *> set virtualCdb.sourceConfig.instance.instanceNumber=1
Set the repository (Oracle home) on the target system that will be used to run the virtual CDB. In this example the Oracle home is /u01/app/oracle/product/12.2.0.1/dbhome_1:
CODEdelphix database provision *> set virtualCdb.sourceConfig.repository='/u01/app/oracle/product/12.2.0.1/dbhome_1'
Set the database unique name for the virtual CDB:
CODEdelphix database provision *> set virtualCdb.sourceConfig.uniqueName=cdbvirt
Set the following two parameters to true or false, depending on whether the vCDB and vPDB should be restarted automatically following a target host reboot:
CODEdelphix database provision *> set source.allowAutoVDBRestartOnHostReboot=true delphix database provision *> set virtualCdb.source. allowAutoVDBRestartOnHostReboot=true
Check that all the settings you require are in place using the "ls" command
CODEdelphix database provision *> ls Properties type: OracleMultitenantProvisionParameters container: type: OracleDatabaseContainer name: PDBS3 (*) description: (unset) diagnoseNoLoggingFaults: true group: Untitled (*) performanceMode: DISABLED preProvisioningEnabled: false sourcingPolicy: (unset) credential: (unset) masked: (unset) maskingJob: (unset) source: type: OracleVirtualPdbSource name: (unset) allowAutoVDBRestartOnHostReboot: true (*) config: (unset) customEnvVars: (unset) fileMappingRules: (unset) logCollectionEnabled: false mountBase: /mnt/provision (*) operations: (unset) sourceConfig: type: OraclePDBConfig cdbConfig: (unset) databaseName: cdbvirt (*) environmentUser: (unset) linkingEnabled: true nonSysCredentials: (unset) nonSysUser: (unset) repository: (unset) services: (unset) timeflowPointParameters: type: TimeflowPointSemantic container: CDOMLOSR1TBPDB1 (*) location: LATEST_POINT username: (unset) virtualCdb: type: OracleVirtualCdbProvisionParameters (*) container: type: OracleDatabaseContainer (*) name: cdbvirt (*) description: (unset) diagnoseNoLoggingFaults: true (*) group: Untitled (*) performanceMode: DISABLED (*) preProvisioningEnabled: false (*) sourcingPolicy: (unset) source: type: OracleVirtualCdbSource (*) name: (unset) allowAutoVDBRestartOnHostReboot: true (*) config: (unset) configParams: (unset) configTemplate: vcdb (*) logCollectionEnabled: false (*) mountBase: /mnt/provision (*) sourceConfig: type: OracleSIConfig (*) databaseName: cdbvirt (*) environmentUser: (unset) instance: type: OracleInstance (*) instanceName: cdbvirt (*) instanceNumber: 1 (*) linkingEnabled: true (*) nonSysCredentials: (unset) nonSysUser: (unset) repository: '/u01/app/oracle/product/12.2.0.1/dbhome_1' (*) services: (unset) tdeKeystorePassword: (unset) uniqueName: cdbvirt (*) Operations defaults
Initiate the provision by committing the operation in the CLI.
CODEdelphix database provision *> commit PDBS3 Dispatched job JOB-24 DB_PROVISION job started for "Targets/PDBS3". Starting provision of the virtual database "PDBS3". Preparing multitenant container database "cdbvirt". Creating new TimeFlow. Generating recovery scripts. Exporting storage. Mounting filesystems to recover pluggable database on instance "1". Mounting read-only archive log filesystem for the virtual database instance "1". Backing up Oracle spfile. Mounting virtual database instance. Disabling flashback on Oracle database. Renaming Oracle datafiles. Mounting virtual database instance. Recovering Oracle pluggable database. Creating control file. Creating Oracle online logs. Processing startup init file. Configuring initialization and server parameter files. Mounting virtual database instance. Performing Oracle resetlogs. Creating tempfiles. Renaming readonly datafiles. Finalizing Oracle pluggable database. Registering listeners. Unmounting read-only archive log filesystem for the virtual database instance "1". Unmounting filesystems after recovering pluggable database on instance "1". Plugging in Oracle pluggable database. Opening Oracle pluggable database. Setting OMF destination for Oracle pluggable database. Creating tempfiles. Online readonly tablespaces. Enabling Oracle instances. Checking Oracle pluggable database plugin violations. DB_PROVISION job for "Targets/PDBS3" completed successfully.