Creating a New Pluggable Database
To create a new PDB using EM CLI, follow these steps:
- Meet the prerequisites.For information on the prerequisites for creating a new PDB, view Prerequisites for Creating a New Pluggable Database. For information on the prerequisites for creating a PDB by plugging in an unplugged PDB, view Prerequisites for Plugging In an Unplugged Pluggable Database. For information on the prerequisites for creating a PDB by cloning an existing PDB, view Prerequisites for Cloning a Pluggable Database.
- Log in to EM CLI by running the following command on the OMS host:
$<OMS_HOME>/bin/emcli login -username=<name_of_user> -password=<password>
- View the help file of the
create_pluggable_database
verb by running the following command:$<OMS_HOME>/bin/emcli help create_pluggable_database
- RUn the
create_pluggable_database
verb:$<OMS_HOME>/bin/emcli create_pluggable_database -cdbTargetName=<Specify the CDB target name for creating new PDB> -cdbTargetType=<Specify the CDB target type - oracle_database, rac_database> -cdbHostCreds=<Specify the host credentials on which the CDB target is located> [-cdbTargetCreds=<Specify the credentials of container database on which the new PDB will be created.>] -pdbName=<Specify a name for the new PDB> [-numOfPdbs=<Specify the number of PDBs to be created>] -sourceType=<Type of pdb to be created - DEFAULT, UNPLUGGED_PDB, CLONE, PROFILE> [-sourceFromSWLIB=<If -sourceType is 'UNPLUGGED_PDB', specify if the dump location is SWLIB or not.>] [-pdbTemplateInSWLIB=<If -sourceFromSWLIB, specify the URN of pdb template component in SWLIB.>] [-sourcePDBTempStagingLocation=<If from SWLIB, specify fully qualified location for staging the source pdb dump temporarily>] [-unpluggedPDBType=<If -sourceType is 'UNPLUGGED_PDB', specify pdb dump type - ARCHIVE, RMAN, XML.>] [-sourcePDBArchiveLocation=<If -unpluggedPDBType=ARCHIVE, this is fully qualified archive location>] [-sourcePDBMetadataFile=<If -unpluggedPDBType=RMAN or XML, this is fully qualified path of the source PDB metadata file>] [-sourcePDBDatabackup=<If -unpluggedPDBType=RMAN, this is fully qualified path of the source PDB datafile>] [-sourcePDBName=<If -sourceType is 'CLONE', specify the name of an existing PDB which is a valid em target>] [-sourceCDBCreds=<If -sourceType is 'CLONE', specify the credentials of container database on which the -sourcePDBName is present>] [-pdbAdminCreds=<Name of pdb credentials with admin role>] [-useOMF=<Specifies that the datafiles can be stored in OMF location>] [-sameAsSource=<Specifies that the datafiles of new PDB can be stored in the same location as that of source CDB>] [-newPDBFileLocation=<Specify the storage location for datafiles of the created PDB.>] [-createAsClone=<If -sourceType is 'UNPLUGGED_PDB' and if 'createAsClone' is specified, the PDB will be created as clone.>] [-lockAllUsers=<If -sourceType is 'UNPLUGGED_PDB' and if 'lockAllUsers' is specified, all PDB users of the new PDB will be locked.>] [-noUserTablespace=<Specifies that the new DEFAULT PDB will not be created with USERS tablespace.>] [-useSnapClone=<If -sourceType is 'CLONE', specifies that Snap Clone must be used for cloning the PDB.>] [-sourceCDBHostCreds=<If -sourceType is 'CLONE' and -useSnapClone is specified, this specifies the host credentials for the source CDB.>] [-mountPointPrefix=<If -sourceType is 'CLONE' and -useSnapClone is specified, this specifies the mount point prefix for the cloned volumes.>] [-writableSpace=<If -sourceType is 'CLONE' and -useSnapClone is specified, this specifies the writable space, in GB, for the cloned volumes.>] [-privHostCreds=<If -sourceType is 'CLONE' and -useSnapClone is specified, this specifies the privileged host credentials required to mount the cloned volumes at the specified locations.>]
For example, you can run the following commands to create new PDBs:
$<OMS_HOME>/bin/emcli create_pluggable_database -cdbTargetName=database -cdbTargetType=oracle_database -pdbName=pdb -sourceType=UNPLUGGED_PDB -unpluggedPDBType=ARCHIVE -sourcePDBArchiveLocation=/u01/app/oracle/product/12.1.0/dbhome_2/assistants/dbca/templates/a.tar.gz emcli create_pluggable_database -cdbTargetName=database -cdbTargetType=oracle_database -cdbHostCreds=HOST_CREDS -cdbTargetCreds=CDB_SYS_CREDS -pdbName=pdb -sourceType=CLONE -sourcePDBName=source_pdb -sourceCDBCreds=CDB_SYS_CREDS -useSnapClone -srcCDBHostCreds=HOST_CREDS -mountPointPrefix=/oracle -writableSpace=1 -sourcePDBTempStagingLocation=/tmp -privHostCreds=ROOT_CREDS