Create a PDB from PDB$SEED or XML
/database/pdbs/
Request
There are no request parameters for this operation.
- application/json
object
-
adminName: string
The administrator username for the new PDB. This property is required when the method property is CREATE.
-
adminPwd: string
The administrator password for the new PDB. This property is required when the method property is CREATE.
-
asClone: boolean
Indicate if 'AS CLONE' option should be used in the command to plug in a PDB. This property is applicable when the method property is PLUG but not required.
-
copyAction: string
Allowed Values:
[ "COPY", "NOCOPY", "MOVE" ]
Indicate which copy option should be used in the command to plug in a PDB. This property is required when the method property is PLUG. -
fileNameConversions(required): string
Relevant for create and plug operations. As defined in the Oracle Multitenant Database documentation. Values can be a filename convert pattern or NONE.
-
getScript: boolean
If defined, the response will contain a JSON object with the information of the script that was generated for execution. A database is not created when this property is set to true.
-
method(required): string
Allowed Values:
[ "CREATE", "PLUG" ]
This property defines the type of operation. Depending on the method specified, other properties will be required in the payload. -
pdb_name(required): string
The name of the new PDB. Relevant to both CREATE and PLUG method.
-
reuseTempFile: boolean
Relevant for create and plug operations. True for temporary file reusage.
-
serviceNameConvert: string
Relevant for create and plug operations. As defined in the Oracle Multitenant Database documentation. Values can be an even number of strings or NONE.
-
sourceFileNameConversions: string
This property is required when the method property is PLUG. As defined in the Oracle Multitenant Database documentation. Values can be a source filename convert pattern or NONE.
-
tdeImport: boolean
TDE import for plug operations.
-
tdeKeystorePath: string
TDE keystore path is required if the tdeImport flag is set to true. Can be used in plug operations.
-
tdePassword: string
TDE password when applicable (optional). Can be used in create and plug operations.
-
tdeSecret: string
TDE secret is required if the tdeImport flag is set to true. Can be used in plug operations.
-
tempSize: string
Relevant for create and clone operations. Total size for temporary tablespace as defined in the Oracle Multitenant Database documentation. See size_clause description in Database SQL Language Reference documentation.
-
totalSize: string
Relevant for create and plug operations. Total size as defined in the Oracle Multitenant Database documentation. See size_clause description in Database SQL Language Reference documentation.
-
unlimitedStorage: boolean
Relevant for create and plug operations. True for unlimited storage. Even when set to true, totalSize and tempSize MUST be specified in the request if method is CREATE.
-
xmlFileName: string
The path of the XML metadata file to use when plugging-in a PDB.
Response
- application/json
200 Response
Examples
The following example shows how to create a new Pluggable Database by submitting a POST request on the REST resource using cURL.
curl -i -X POST -u username:password
-d @request_body.json
-H "Content-Type:application/json" https://rest_server_url/ords/_/db-api/stable/database/pdbs/
Example of Request Body
Note:
https://rest_server_url/resource-path
, used in the preceding command has the following components:
rest_server_url
is the REST server where Oracle Rest Data Server is running- The remainder of the URL includes the ORDS context root, the version of ORDS Database API to use, and the path for this operation. The PDB Lifecycle Management service requires
db.cdb.adminUser
credentials to be set in the pool configuration and in this example, the default pool is configured for the container database.
The following is an example request body to create a pluggable database called pdb_sample
in this example, from PDB$SEED
with unlimited storage. In this example, fileNameConversions
parameter is also provided that results in a FILE_NAME_CONVERT
clause included in the CREATE PLUGGABLE DATABASE
statement executed in the container database:
{
"method": "CREATE",
"pdb_name": "pdb_sample",
"adminName": "pdbadmin",
"adminPwd": "W3lc0m31",
"fileNameConversions": "('/disk1/oracle/dbs/pdbseed/','/disk1/oracle/dbs/pdb_sample/')",
"unlimitedStorage": true,
"reuseTempFile": true,
"totalSize": "UNLIMITED",
"tempSize": "UNLIMITED"
}
The following is an example request body to get the generated script for creating a pluggable database from PDB$SEED
with custom storage settings. Note that the script is not executed in the database. In this example, fileNameConversions
parameter has a NONE
value that results in a FILE_NAME_CONVERT=NONE
clause included in the CREATE PLUGGABLE DATABASE
statement generated.
{
"method": "CREATE",
"pdb_name": "pdb_sample",
"adminName": "pdbadmin",
"adminPwd": "W3lc0m31",
"fileNameConversions": "NONE",
"reuseTempFile": true,
"totalSize": "2G",
"tempSize": "800M",
"getScript": true
}
The following is an example request body to plugin a pluggable database called sales_pdb
into the container database. In this example request body the pluggable database definition is specified in the sales_pdb.xml
file:
{
"method": "PLUG",
"pdb_name": "sales_pdb",
"xmlFileName": "/disk1/oracle/dbs/sales_pdb.xml",
"sourceFileNameConversions": "NONE",
"copyAction": "NOCOPY",
"fileNameConversions": "NONE",
"unlimitedStorage": true,
"reuseTempFile": true,
"totalSize": "UNLIMITED",
"tempSize": "UNLIMITED"
}
Example of Response Header
The following example shows the response header:
HTTP/1.1 200 OK
Date: Fri, 06 Sep 2019 15:51:31 GMT
Content-Type: application/json
X-Frame-Options: SAMEORIGIN
Transfer-Encoding: chunked
Example of Response Body
The following example shows the response body with 200 returned in JSON format:
{
"statementText": "BEGIN\n\tEXECUTE IMMEDIATE 'CREATE PLUGGABLE DATABASE \"pdb_sample\"\n\t\tUSING ''/disk1/oracle/dbs/sales_db.xml''\n\t\tSOURCE_FILE_NAME_CONVERT=NONE\n\t\tNOCOPY\n\t\tSTORAGE UNLIMITED\tTEMPFILE REUSE\n\t';\nEND;\n/\nALTER PLUGGABLE DATABASE \"pdb_sample\" OPEN READ WRITE INSTANCES=ALL\n/\n",
"binds": []
}