- Introduction
- Connect to a CDB and to a PDB.
- Create a PDB from the seed PDB.
- Manage CDBs and PDBs.
- Start a CDB, understand the different open modes of PDBs, and shut down a CDB.
- Open and close PDBs.
- Change the name of a PDB.
- Manage the storage in a CDB and its PDBs.
- Manage permanent tablespaces.
- Manage temporary tablespaces.
- Manage the security in PDBs.
- Create common and local users.
- Create common and local roles.
- Grant common and local privileges.
- Drop PDBs.
This tutorial shows you how to:
Note: For readability, formatting was applied to some columns shown in the output.
Prerequisites
Before starting this tutorial, you should:
- Install Oracle Database 12c
- Create one CDB and one PDB
- ORACLE_HOME: /u01/app/oracle/product/12.1.0
- TNS Listener port: 1521
- Container databases:
- SID: cdb1
- SID: cdb2
- Pluggable databases (in cdb1):
- pdb1
- pdb2
- Connecting to the CDB Root or to a PDB:
- Creating a CDB creates a service whose name is the CDB name. As a side effect of creating a PDB in the CDB, a service is created inside it with a property that identifies it as the initial current container. The service is also started as a side effect of creating the PDB. The service has the same name as the PDB. Although its metadata is recorded inside the PDB, the invariant is maintained so that a service name is unique within the entire CDB.
- Creating a PDB from the Seed PDB:
- In this section, you create a PDB from the seed PDB. Each CDB has a template PDB whose name is
PDB$Seed
.Creating the OS Directory for the New Data Files and Temp Files of the PDB
Before starting the PDB creation, create a destination directory for the data files.
mkdir /u01/app/oracle/oradata/cdb1/pdb3
Creating the PDB
- Managing Storage in a CDB and Its PDBs:
- Each container in a CDB stores data in its own data files and handles temporary data in its own temp files.
- Common users are created from the root and are automatically replicated in each PDB except the seed PDB. Common users can connect to any PDB. The name assigned to a common user must start with c##.
- Local users are created in a PDB they need to access. Local users can only connect to the PDB where they are created. They are not visible to the other PDBs of the same CDB.
- Common roles are created from the root and are automatically replicated in each PDB except the seed PDB. The name assigned to a common role must start with c##.
- Common roles can be granted commonly: The grant operation is replicated in each PDB except the seed PDB.
- Common roles can be granted locally: The grant operation is performed in the container where the operation takes place.
- Local roles are created in a PDB they need to access. Local roles can be granted locally only in the PDB where they are created. They are not visible to the other PDBs of the same CDB.
- Common privileges are automatically granted to the common grantee (user or role) in each PDB except the seed PDB.
- Local privileges are granted to a grantee (user or role) in a specific PDB.
Managing Common and Local Users
- Each container in a CDB holds common and local users. Any user, common or local, can only exercise the granted privileges inside the specific container to which it is connected.
Managing Common and Local Roles
- Each container in a CDB holds common and local roles.
Managing Common and Local Privileges
- You can grant common and local privileges to common and local users and roles. The privileges become common or local based on how they are granted. They are common when they are granted with the
CONTAINER=ALL
clause.- Dropping PDBs:
- When you drop a PDB, you can specify to keep or delete the data files. Keeping the data files is required when you unplug a PDB and want to plug it into another CDB (or the same CDB). The data files are reused when plugging in the PDB.
- Resetting Your Environment:
- Perform the following steps to reset your environment prior to repeating the activities covered in this OBE or starting another OBE.
- Summary:
- In this tutorial, you learned how to manage basic tasks on container and pluggable databases, including creating PDBs from seed PDBs; managing tablespaces and security; and creating common and local users, roles, and privileges.
- To learn more about pluggable databases, refer to additional OBEs in the Oracle Learning Library.
No comments:
Post a Comment