You can use this clause to separate the data for multiple schemas into different PDBs. For example, when you move a non-CDB to a PDB, and the non-CDB had several schemas that each supported a different application, you can use this clause to separate the data belonging to each schema into a separate PDB. This technique assumes that each schema used a separate tablespace in the non-CDB.
You can use this clause to specify one of the following options:
List one or more tablespaces to include.
Specify ALL, the default, to include all tablespaces.
Specify ALL EXCEPT to include all tablespaces, except for the tablespaces listed.
Specify NONE to exclude all tablespaces.
If the creation mode of the user tablespaces must be different from the creation mode for the Oracle-supplied tablespaces (such as SYSTEM and SYSAUX), then specify one of the following in the USER_TABLESPACES clause:
COPY: The files of the tablespaces are copied to a new location.
MOVE: The files of the tablespaces are moved to a new location.
NOCOPY: The files of the tablespaces are not copied or moved.
SNAPSHOT COPY: The tablespaces are cloned with storage snapshots.
NO DATA: The data model definition of the tablespaces is cloned but not the tablespaces’ data.
When the compatibility level of the CDB is 12.2.0 or higher, the tablespaces that are excluded by this clause are created offline in the new PDB, and they have no data files associated with them. When the compatibility level of the CDB is lower than 12.2.0, the tablespaces that are excluded by this clause are offline in the new PDB, and all data files that belong to these tablespaces are unnamed and offline.
This clause does not apply to the SYSTEM, SYSAUX, or TEMP tablespaces. Do not include these tablespaces in a tablespace list for this clause.
The following are examples that use the USER_TABLESPACES clause.
Example 5-4 USER_TABLESPACES Clause That Includes One Tablespace
Assume that the non-CDB or PDB from which a PDB is being created includes the following tablespaces: tbs1, tbs2, and tbs3. This USER_TABLESPACES clause includes the tbs2 tablespace, but excludes the tbs1 and tbs3 tablespaces.
USER_TABLESPACES=('tbs2')
Example 5-5 USER_TABLESPACES Clause That Includes a List of Tablespaces
Assume that the non-CDB or PDB from which a PDB is being created includes the following tablespaces: tbs1, tbs2, tbs3, tbs4, and tbs5. This USER_TABLESPACES clause includes the tbs1, tbs4, and tbs5 tablespaces, but excludes the tbs2 and tbs3 tablespaces.
USER_TABLESPACES=('tbs1','tbs4','tbs5')
Example 5-6 USER_TABLESPACES Clause That Includes All Tablespaces Except for Listed Ones
Assume that the non-CDB or PDB from which a PDB is being created includes the following tablespaces: tbs1, tbs2, tbs3, tbs4, and tbs5. This USER_TABLESPACES clause includes the tbs2 and tbs3 tablespaces, but excludes the tbs1, tbs4, and tbs5 tablespaces.
USER_TABLESPACES=ALL EXCEPT('tbs1','tbs4','tbs5')
Example 5-7 USER_TABLESPACES in a Different Creation Mode
This example shows a full CREATE PLUGGABLE DATABASE statement that plugs in a non-CDB and only includes the tbs3 user tablespace from the non-CDB. The example copies the files for Oracle-supplied tablespaces (such as SYSTEM and SYSAUX) to a new location, but moves the files of the tbs3 user tablespace.
CREATE PLUGGABLE DATABASE ncdb USING '/disk1/oracle/ncdb.xml'
COPY
FILE_NAME_CONVERT = ('/disk1/oracle/dbs/', '/disk2/oracle/ncdb/')
USER_TABLESPACES=('tbs3') MOVE;
|