Wednesday, February 12, 2014

Create a new PDB from PDB$SEED

Creating a PDB from the Seed
You can create a PDB from the seed using the CREATE PLUGGABLE DATABASE statement.
Before creating a PDB from the seed, complete the prerequisites below:

Preparing for PDBs

Ensure that the following prerequisites are met before creating a PDB:
·         The CDB must exist.
·         The CDB must be in read/write mode.
·         The current user must be a common user whose current container is the root.
·         The current user must have the CREATE PLUGGABLE DATABASE system privilege.
·         You must decide on a unique PDB name for each PDB. Each PDB name must be unique in a single CDB, and each PDB name must be unique within the scope of all the CDBs whose instances are reached through a specific listener.
·         The PDB name is used to distinguish a PDB from other PDBs in the CDB. PDB names follow the same rules as service names, which includes being case-insensitive.
·         If you are creating a PDB in an Oracle Data Guard configuration with a physical standby database, then additional tasks must be completed before creating a PDB.
To create a PDB from the seed: 
  1. In SQL*Plus, ensure that the current container is the root.
  2. Run the CREATE PLUGGABLE DATABASE statement, and specify a local administrator for the PDB. Specify other clauses when they are required.
  3. After you create the PDB, it is in mounted mode, and its status is NEW. You can view the open mode of a PDB by querying the OPEN_MODE column in theV$PDBS view. You can view the status of a PDB by querying the STATUS column of the CDB_PDBS or DBA_PDBS view.
  4. A new default service is created for the PDB. The service has the same name as the PDB and can be used to access the PDB. Oracle Net Services must be configured properly for clients to access this service. Open the new PDB in read/write mode.
  5. You must open the new PDB in read/write mode for Oracle Database to complete the integration of the new PDB into the CDB. An error is returned if you attempt to open the PDB in read-only mode. After the PDB is opened in read/write mode, its status is NORMAL.
  6. Back up the PDB.
  7. A PDB cannot be recovered unless it is backed up.
  8. A local user with the name of the specified local administrator is created and granted the PDB_DBA common role locally in the PDB. If this user was not granted administrator privileges during PDB creation, then use the SYS and SYSTEM common users to administer to the PDB.
create pluggable database pdb1
admin user pdb1_admin identified by oracle
roles = (DBA)
FILE_NAME_CONVERT=
('/u01/app/oracle/oradata/cdb/pdbseed','/bkp/oradata/cdb/pdb1');


Note:

If an error is returned during PDB creation, then the PDB being created might be in an UNUSABLE state. You can check a PDB's state by querying the CDB_PDBS or DBA_PDBS view, and you can learn more about PDB creation errors by checking the alert log. An unusable PDB can only be dropped, and it must be dropped before a PDB with the same name as the unusable PDB can be created.

Clauses for Creating a PDB From the Seed
Clause
Question
Yes
No
STORAGE
Do you want to limit the amount of storage that the PDB can use?
Specify a STORAGE clause with the appropriate limits.
Omit the STORAGE clause, or specify unlimited storage using the STORAGEclause.
DEFAULT TABLESPACE
Do you want to specify a default permanent tablespace for the PDB?
Specify a DEFAULT TABLESPACE clause with the appropriate limits.
Oracle Database creates a smallfile tablespace and subsequently will assign to this tablespace any non-SYSTEMusers for whom you do not specify a different permanent tablespace.
Omit the DEFAULT TABLESPACE clause.
If you do not specify this clause, then theSYSTEM tablespace is the default permanent tablespace for non-SYSTEMusers. Using the SYSTEM tablespace for non-SYSTEM users is not recommended.
PATH_PREFIX
Do you want to use a PATH_PREFIXclause to ensure that all relative directory object paths and relative paths contained in certain initialization parameters associated with the PDB are treated as relative to the specified directory or its subdirectories?
The PATH_PREFIX clause is ignored when absolute paths are used for directory objects and initialization parameters.
The PATH_PREFIX clause does not affect files created by Oracle Managed Files.
Include a PATH_PREFIX clause that specifies an absolute path.
Set the PATH_PREFIX clause to NONE or omit it.
FILE_NAME_CONVERT
Do you want to use aFILE_NAME_CONVERT clause to specify the target locations of the files?
The source files are the files associated with the seed.
Include a FILE_NAME_CONVERT clause that specifies the target locations of the files based on the names of the source files.
Omit the FILE_NAME_CONVERT clause.
Use one of these techniques to specify the target locations of the files:
  • Enable Oracle Managed Files for it to determine the target locations.
  • Specify the target locations in thePDB_FILE_NAME_CONVERTinitialization parameter.
If you use both of these techniques, then Oracle Managed Files takes precedence.
TEMPFILE REUSE
Do you want to reuse the temp file if a temp file exists in the target location?
Include the TEMPFILE REUSE clause.
Omit the TEMPFILE REUSE clause.
Ensure that there is no file with the same name as the new temp file in the target location.
ROLES
Do you want to grant predefined Oracle roles to the PDB_DBA role locally in the PDB?
The new administrator for the PDB is granted the PDB_DBA common role locally in the PDB. By default, theCREATE PLUGGABLE DATABASE statement does not grant the administrator or the role any privileges.
Include the ROLES clause and specify the predefined Oracle roles to grant to the PDB_DBA role. The specified roles are granted to the PDB_DBA role locally in the PDB. The user who runs theCREATE PLUGGABLE DATABASE statement does not need to be granted the specified roles. See Oracle Database Security Guide for information about predefined Oracle roles.
Omit the ROLES clause.

No comments:

Post a Comment