CLI cookbook: provisioning a virtual PDB in a target CDB
This topic describes how to provision a virtual pluggable database (vPDB) 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
Provisioning of virtual PDB's 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 container database of the same Oracle release as the source database must exist in the target host. If this container database is a physical database, then it must be linked to Delphix. If it’s a virtual container database, then it must be of Oracle version 12.1.0.2 or later.
In the example CLI provision detailed below the following databases are in place:
The source container database is called "cdb12"
The destination container database is called "cdbstage"
The pluggable database found in "cdb12" that has been linked as a dSource is called "pdborcl"
The destination virtual pluggable database will be called "pdbs2" and run from container database "cdbstage"
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
Set the type of provision to perform, for Oracle virtual database (VDB) - VDB/vPDBs, the type will be OracleVirtualSource.
CODEset source.type=OracleVirtualPdbSource
Set the destination target environment/host through setting the sourceConfig environment user to perform the provision. A destination container database must already be running on this target host.
CODEdelphix database provision *> set sourceConfig.environmentUser=OEL6SIN1/delphix
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"
Set the login details for the provision and Delphix OS user who is to perform the provision.
CODEdelphix database provision *> set username=delphix delphix database provision *> set credential.type=PasswordCredential delphix database provision *> set credential.password=delphix
Give the dataset a name.
CODEdelphix database provision *> set container.name=PDBS2
Place the new dataset in a Group that appears in the Delphix GUI, in this case, the target group.
CODEdelphix database provision *> set container.group=Targets
If automatically restarting the VDB is not required after a reboot of the VDB target host, set this to option to false. False is possibly a better option given the container database would need to be running prior to any attempt to pull up a vPDB.
CODEdelphix database provision *> set source.allowAutoVDBRestartOnHostReboot=false
Supply the destination container database name. This will be where the vPDB will ultimately be placed and run from on the target host.
CODEdelphix database provision *> set sourceConfig.cdbConfig=cdbstage
Name the vPDB. This is what it will appear as in the destination container database.
CODEdelphix database provision *> set sourceConfig.databaseName=pdbs2
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=PDBORCL
Check that all the settings you require are in place using the "ls" command.
CODEdelphix database provision *> ls Properties type: OracleProvisionParameters container: type: OracleDatabaseContainer name: PDBS2 (*) description: (unset) diagnoseNoLoggingFaults: true group: Targets (*) performanceMode: DISABLED preProvisioningEnabled: false sourcingPolicy: (unset) credential: type: PasswordCredential (*) password: ******** (*) maskingJob: (unset) newDBID: true (*) openResetlogs: true physicalStandby: false source: type: OracleVirtualSource (*) name: (unset) allowAutoVDBRestartOnHostReboot: false (*) archivelogMode: true config: (unset) configParams: (unset) configTemplate: (unset) customEnvVars: (unset) fileMappingRules: (unset) manualProvisioning: false mountBase: /mnt/provision (*) nodeListenerList: (unset) operations: (unset) redoLogGroups: 3 redoLogSizeInMB: 0 sourceConfig: type: OraclePDBConfig cdbConfig: cdbstage (*) databaseName: pdbs2 (*) environmentUser: (unset) linkingEnabled: true repository: (unset) services: (unset) timeflowPointParameters: type: TimeflowPointSemantic container: PDBORCL (*) location: LATEST_POINT username: delphix (*) Operationsdefaults
Initiate the provision by committing the operation in the CLI.
CODEdelphix database provision *> commit PDBS2 Dispatched job JOB-333 DB_PROVISION job started for "Targets/PDBS2". Starting provision of the virtual database "pdbs2". Preparing multitenant container database "cdbstage". 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". Recovering Oracle pluggable database. Mounting filesystems for the virtual database instance "1". Unmounting filesystems after recovering pluggable database on instance "1". Cleaning up objects created by pluggable database provisioning. Opening Oracle pluggable database. DB_PROVISION job for "Targets/PDBS2" completed successfully.