A pluggable database (PDB) groups an application's schemas and data within a container database (CDB). Creating one from PDB$SEED gives a new application a starting container with Oracle's dictionary content and system structures. Plan the target identity, file placement, and local administrator before creation, then verify the created container and its files.
Oracle DBA Lesson 48A — Create a PDB from the Seed
What the seed supplies
PDB$SEED is Oracle's system-supplied template. Oracle copies its files to a new location, associates those copies with the new PDB, and assigns the target a new identity. The target includes a data dictionary and internal links to Oracle-supplied objects in the root. The course application's ORDERS, EMPLOYEES, and other tables are installed separately. Seed creation does not copy those rows from the existing course PDB. This lesson creates an ordinary PDB in CDB$ROOT, rather than an application PDB within an application container. See Oracle's multitenant architecture.
Decide how creation places the files
| Setting | Creation priority | Naming behavior |
|---|---|---|
Explicit FILE_NAME_CONVERT clause | First | Replace source file-name patterns with target patterns |
CREATE_FILE_DEST clause | Second | Use an OMF destination chosen for the new PDB |
Root DB_CREATE_FILE_DEST | Third | Use the root's OMF destination |
PDB_FILE_NAME_CONVERT parameter | Fourth | Use pattern replacement when the other routes are absent |
The managed routes in this table assume CREATE_FILE_DEST is either omitted or specifies a valid destination. CREATE_FILE_DEST=NONE disables inherited OMF for the new PDB. Resolve the intended mapping route before creation.
OMF means Oracle Managed Files. A configured destination receives files with Oracle-generated unique names. The worked creation below omits both file-placement clauses and uses the verified root DB_CREATE_FILE_DEST.
For unmanaged source files, an explicit mapping can instead use:
FILE_NAME_CONVERT = ('<SEED_PREFIX>', '<TARGET_PREFIX>')
These are placeholders for instructor-validated patterns, including the required directory separators. This fragment is an alternative strategy, not an extra clause to add to the worked OMF example. File-name patterns cannot match OMF-managed files or directories. If FILE_NAME_CONVERT and CREATE_FILE_DEST are both specified, the explicit conversion governs the files placed during creation. CREATE_FILE_DEST establishes the new PDB's managed-file default for subsequent creation. If all applicable placement routes are absent, creation fails. Oracle's PDB file-location guidance explains the precedence.
Prepare the disposable lab
Use an instructor-owned Oracle Database 19c, single-instance CDB on Linux, with SQL*Plus. Record the actual edition, Release Update, database identity, and instance. Complete the course's backup and restore rehearsal before the destructive cleanup exercise. Use the designated lab. These examples authorize no production changes.
Before executing, prepare a change record containing:
- The intended CDB and source
PDB$SEED. The CDB must be openREAD WRITEand the creation session must be inCDB$ROOT. - An authorized common administrator with
CREATE PLUGGABLE DATABASEgranted commonly, plus delegated access and container visibility for the views used below. The instructor supplies these permissions. See CREATE PLUGGABLE DATABASE prerequisites. - An unused target name
LABPDB_NEW, also checked for name and service conflicts among CDBs reached through the listener. - An entitled user-created PDB slot. Oracle's 19c licensing information permits up to three user-created PDBs per CDB without the Oracle Multitenant option. Check the exact offering and contractual entitlement. Existing counts, technical limits, and installed options alone do not establish eligibility. See Oracle's consolidation licensing table.
- A verified root
DB_CREATE_FILE_DESTand the observedPDB_FILE_NAME_CONVERTsetting. For a filesystem destination, the base directory must already exist and Oracle processes must be able to create files there. For ASM, validate the selected disk group. Account for the copied datafiles, temporary files, expected growth, and other users of the storage. See DB_CREATE_FILE_DEST. - The local administrator name, intended later grants, and protected password-provisioning procedure.
- A tested recovery or reset point, exact ownership of the created assets, postchecks, retention through Part B, and an approved targeted removal or reset plan. DDL commits. SQL
ROLLBACKwill not reverse creation.
Confirm the session and inspect the starting condition:
SHOW USER
SHOW CON_NAME
SELECT name, open_mode FROM v$database;
SELECT con_id, name, open_mode FROM v$pdbs ORDER BY con_id;
SHOW PARAMETER db_create_file_dest
SHOW PARAMETER pdb_file_name_convert
SHOW is a SQL*Plus client command. The queries read database metadata. Stop if the identity, root scope, open mode, available slot, unused name, or intended storage cannot be confirmed. Resolve a missing destination rather than supplying an arbitrary path. Record actual root settings. A nonempty conversion parameter is still a mapping strategy, and OMF takes precedence when its destination applies.
Create the named target and local administrator
The instructor first validates the protected-input procedure. Use a strong generated password that meets the lab's policy and is compatible with SQL*Plus substitution. This example requires input without a double quote, ampersand, or newline. Use the approved provisioning method if the password policy requires incompatible characters. Keep screen recording, terminal capture, and spooling off during secret handling. ACCEPT ... HIDE suppresses typed input, while SET VERIFY OFF suppresses substitution echo. It does not remove the secret from client memory or the SQL buffer. See SQL*Plus ACCEPT.
In the already verified root session:
SET DEFINE ON
SET VERIFY OFF
SET ECHO OFF
SPOOL OFF
ACCEPT pdb_admin_secret CHAR PROMPT 'New lab admin password: ' HIDE
CREATE PLUGGABLE DATABASE labpdb_new
ADMIN USER course_pdb_admin IDENTIFIED BY "&pdb_admin_secret";
UNDEFINE pdb_admin_secret
CLEAR BUFFER
Do not enter a password on a shell command line, list the substituted SQL buffer, or save the secret in an evidence file. Keep any client command-history capture disabled according to the lab's approved procedure. On failure, also undefine the variable and clear the buffer before recording non-secret diagnostics. Restore the instructor's usual client settings afterward.
The statement chooses LABPDB_NEW. The absence of a source FROM clause selects seed creation. ADMIN USER creates COURSE_PDB_ADMIN locally in the target and grants PDB_DBA locally. With no additional ROLES clause, this example grants no broad predefined administrative role. Check and grant specific working privileges during commissioning, including CREATE SESSION for login. The role name alone is not a grant of every task. Oracle's seed-creation procedure describes creation and the local administrator.
Verify creation while the target remains mounted
Successful creation initially gives MOUNTED open mode and NEW status. Keep those separate: open mode describes access state, while the dictionary status describes integration status.
SELECT con_id, name, open_mode
FROM v$pdbs
WHERE name = 'LABPDB_NEW';
SELECT pdb_name, status
FROM cdb_pdbs
WHERE pdb_name = 'LABPDB_NEW';
Expect exactly one target row under the agreed successful-creation assumptions. Capture the actual CON_ID. Do not guess it from a previous lab. See V$PDBS.
Use the target's container identifier to inspect its recorded file paths from root:
SELECT con_id, file#, name
FROM v$datafile
WHERE con_id =
(SELECT con_id FROM v$pdbs WHERE name = 'LABPDB_NEW')
ORDER BY file#;
SELECT con_id, file#, name
FROM v$tempfile
WHERE con_id =
(SELECT con_id FROM v$pdbs WHERE name = 'LABPDB_NEW')
ORDER BY file#;
V$DATAFILE exposes datafile information recorded in the control file. NAME is the recorded path. V$TEMPFILE reports temporary-file information. Compare each target path with the agreed managed destination and keep the target CON_ID with the evidence. Record actual paths privately in the lab change record. See V$DATAFILE and V$TEMPFILE.
A root CDB_DATA_FILES query is a later commissioning check: cross-container dictionary rows depend on container visibility and open, unrestricted PDBs. An empty result while the new target is mounted is insufficient evidence that no files were created. See CDB view visibility. The control-file placement record is useful immediate evidence. Filesystem existence, storage permissions, and eventual operational health require their appropriate checks.
If creation reports an error, preserve the exact non-secret error, inspect CDB_PDBS.STATUS, and the relevant alert-log interval. A failed creation may leave an UNUSABLE PDB. Oracle documents that it must be dropped before reusing that name. Have the instructor establish ownership and inspect partially created assets before a retry or targeted reset.
Independent practice and cleanup
Prepare the creation record from the actual lab, then explain which placement route will apply and why. When the instructor authorizes the creation, execute only the agreed target. Pass when the root inventory has exactly the new LABPDB_NEW, its initial mode and status match the successful-creation conditions, and every recorded datafile and tempfile path belongs to the intended placement. Keep actual results with release and RU, identity, commands, interpretation, and any errors.
Retain this target for Part B's commissioning. Opening, restricted and plug-in health, local privileges, service login, saved state, and the new backup baseline are that part's work. A successful create alone leaves those acceptance items pending. Do not delete the Part A target before the handoff.
After the combined exercise, cleanup is a separate destructive action on the instructor-owned LABPDB_NEW only:
- Reconfirm the intended CDB and root and the target's name,
CON_ID, DBID and GUID, and recorded files against the creation record. Stop for a mismatch or any unowned asset. - Obtain the agreed removal window, stop lab use, and confirm that the tested recovery or reset plan covers what must be retained. If the target has acquired data worth keeping, complete and verify its required backup or export and recovery evidence before removal. Keep recovery records and keys outside the files to be deleted.
- Use the designated administrative session authenticated
AS SYSDBAorAS SYSOPER, with the scope required for this PDB. A creation privilege alone is insufficient forDROP PLUGGABLE DATABASE. - If the target is open, close only this PDB in the approved window:
This disconnects target sessions and can roll back active transactions. If it is already mounted, omit the close. Verify mounted mode before the destructive statement.
ALTER PLUGGABLE DATABASE labpdb_new CLOSE IMMEDIATE; - Once identity, ownership, recovery, and mounted state have been checked:
This removes the PDB and deletes its associated datafiles and tempfile.
DROP PLUGGABLE DATABASE labpdb_new INCLUDING DATAFILES;KEEP DATAFILESrequires an unplugged PDB and retains datafiles. It is a different retention workflow. Use the instructor's recovery or reset process when the agreed reset requires one. See DROP PLUGGABLE DATABASE. - Verify that the exact target is absent from the root inventory, review the alert log, and have the instructor reconcile the recorded target files and remaining storage. Clean up only separately inventoried external assets, if any. Record completion and restore any changed lab and client settings. Do not delete Oracle-managed files manually.
These commands and expected states were researched and statically reviewed against Oracle 19c documentation. They were not executed against a connected database when preparing this material. Actual results depend on the designated lab, release update, privileges, seed contents, and configuration.
Quiz
1. What does creation from PDB$SEED provide for the new target?
2. What does PDB_FILE_NAME_CONVERT do?
3. Both placement clauses are omitted and the root has a valid DB_CREATE_FILE_DEST. Which route governs this creation?
4. What is the initial successful-creation state before commissioning?
5. Which immediate check connects the mounted target to its recorded datafile paths?
These commands and expected states were researched and statically reviewed against Oracle 19c documentation. They were not executed against a connected database when preparing this material. Run the practice in the designated Oracle Database 19c lab, confirm the release update, privileges, seed contents, and configuration, and record what you actually observe.
No comments:
Post a Comment