Oracle Multitenant Environment (五) Create PDB

Creating and Removing PDBs with SQL*Plus

This chapter contains the following topics:

About Creating and Removing PDBs

You can create a pluggable database (PDB) in a multitenant container database (CDB) in the following ways:

  • Create the new PDB by using the seed. See "About a Multitenant Environment" for information about the seed.
  • Create the new PDB by cloning an existing PDB or non-CDB.
  • Plug an unplugged PDB into a CDB.
  • Create the new PDB by using a non-CDB.

You can remove a PDB from a CDB in the following ways:

  • Unplug the PDB from a CDB.
  • Drop the PDB.

This section contains the following topics:

Techniques for Creating a PDB

This section describes the techniques that you can use to create a PDB. Creating a PDB is the process of associating the PDB with a CDB. You create a PDB when you want to use the PDB as part of the CDB.

Table 38-1 describes the techniques that you can use to create a PDB.

Table 38-1 Techniques for Creating a PDB

Technique Description More Information

Create a PDB by using the seed


Create a PDB in a CDB using the files of the seed. This technique copies the files associated with the seed to a new location and associates the copied files with the new PDB.


"Creating a PDB Using the Seed"


Create a PDB by cloning an existing PDB or non-CDB


Create a PDB by cloning a source PDB or non-CDB and plugging the clone into the CDB. A source can be a PDB in the local CDB, a PDB in a remote CDB, or a non-CDB. This technique copies the files associated with the source to a new location and associates the copied files with the new PDB.


"Creating a PDB by Cloning an Existing PDB or Non-CDB"


Create a PDB by plugging an unplugged PDB into a CDB


Create a PDB by using the XML metadata file that describes the PDB and the files associated with the PDB to plug it into the CDB.


"Creating a PDB by Plugging an Unplugged PDB into a CDB"


Create a PDB by using a non-CDB


Create a PDB by moving a non-CDB into a PDB. You can use the DBMS_PDBpackage to create an unplugged PDB from an Oracle Database 12c non-CDB. You can then plug the unplugged PDB into the CDB.


"Creating a PDB Using a Non-CDB"

All of the techniques described in Table 38-1 use the CREATE PLUGGABLE DATABASE statement to create a PDB. These techniques fall into two main categories: copying and plugging in. Figure 38-1 depicts the options for creating a PDB:

You can unplug a PDB when you want to plug it into a different CDB. You can unplug or drop a PDB when you no longer need it. An unplugged PDB is not usable until it is plugged into a CDB.

The CREATE PLUGGABLE DATABASE Statement

You use the CREATE PLUGGABLE DATABASE statement to create a PDB. All of the techniques described in Table 38-1, "Techniques for Creating a PDB" use this statement.

The following sections describe the clauses for the CREATE PLUGGABLE DATABASE statement and when to use each clause:

Storage Limits

The optional STORAGE clause of the CREATE PLUGGABLE DATABASE statement specifies the following limits:

  • The amount of storage that can be used by all tablespaces that belong to the PDB

    Use MAXSIZE and a size clause to specify a limit, or set MAXSIZE to UNLIMITED to indicate no limit.

  • The amount of storage in the default temporary tablespace shared by all PDBs that can be used by sessions connected to the PDB

    Use MAX_SHARED_TEMP_SIZE and a size clause to specify a limit, or set MAX_SHARED_TEMP_SIZE to UNLIMITED to indicate no limit.

If STORAGE UNLIMITED is set, or if there is no STORAGE clause, then there are no storage limits for the PDB.

The following are examples that use the STORAGE clause:

Example 38-1 STORAGE Clause That Specifies Storage Limits

This STORAGE clause specifies that the storage used by all tablespaces that belong to the PDB must not exceed 2 gigabytes. It also specifies that the storage used by the PDB sessions in the shared temporary tablespace must not exceed 100 megabytes.

STORAGE (MAXSIZE 2G MAX_SHARED_TEMP_SIZE 100M)

Example 38-2 STORAGE Clause That Specifies Storage Limits for the Shared Temporary Tablespace Only

This STORAGE clause specifies unlimited storage for all tablespaces that belong to the PDB. It also specifies that the storage used by the PDB sessions in the shared temporary tablespace must not exceed 50 megabytes.

STORAGE (MAXSIZE UNLIMITED MAX_SHARED_TEMP_SIZE 50M)

Example 38-3 STORAGE Clause That Specifies Unlimited Storage

This STORAGE clause specifies that the PDB has unlimited storage for both its own tablespaces and the shared temporary tablespace.

STORAGE UNLIMITED

See Also:

Oracle Database SQL Language Reference for the syntax of the STORAGE clause

File Location of the New PDB

In this section, the term "file name" means both the name and the location of a file. The CREATE PLUGGABLE DATABASE statement has the following clauses that indicate the file names of the new PDB being created:

  • The FILE_NAME_CONVERT clause specifies the names of the PDB‘s files after the PDB is created.

    Use this clause when the files are not yet at their ultimate destination, and you want to copy or move them during PDB creation. You can use this clause in any CREATE PLUGGABLE DATABASE statement.

  • Starting with Oracle Database 12c Release 1 (12.1.0.2), the CREATE_FILE_DEST clause specifies the default Oracle Managed Files file system directory or Oracle ASM disk group for the PDB‘s files.

    Use this clause to enable Oracle Managed Files for the new PDB, independent of any Oracle Managed Files default location specified in the root for the CDB. You can use this clause in any CREATE PLUGGABLE DATABASE statement.

When necessary, you can use both of these clauses in the same CREATE PLUGGABLE DATABASE statement. In addition, the following initialization parameters can control the location of the new PDB‘s files:

  • The DB_CREATE_FILE_DEST initialization parameter set in the root

    This initialization parameter specifies the default location for Oracle Managed Files for the CDB. When this parameter is set in a PDB, it specifies the default location for Oracle Managed Files for the PDB.

  • The PDB_FILE_NAME_CONVERT initialization parameter

    This initialization parameter maps names of existing files to new file names when processing a CREATE PLUGGABLE DATABASE statement.

When both clauses are used in the same CREATE PLUGGABLE DATABASE statement, and both initialization parameters are set, the precedence order is:

  1. The FILE_NAME_CONVERT clause
  2. The CREATE_FILE_DEST clause
  3. The DB_CREATE_FILE_DEST initialization parameter set in the root
  4. The PDB_FILE_NAME_CONVERT initialization parameter

If FILE_NAME_CONVERT and CREATE_FILE_DEST are both specified, then the FILE_NAME_CONVERT setting is used for the files being placed during PDB creation, and the CREATE_FILE_DEST setting is used to set the DB_CREATE_FILE_DEST initialization parameter in the PDB. In this case, Oracle Managed Files controls the location of the files for the PDB after PDB creation.

The following sections describe the PDB file location clauses in more detail:

See Also:

Oracle Database Reference for more information about initialization parameters

FILE_NAME_CONVERT Clause

If the PDB will not use Oracle Managed Files, then the FILE_NAME_CONVERT clause of the CREATE PLUGGABLE DATABASE statement specifies how to generate the names of files (such as data files) using the names of existing files.

You can use this clause to specify one of the following options:

  • One or more file name patterns and replacement file name patterns, in the following form:

    ‘string1‘ , ‘string2‘ , ‘string3‘ , ‘string4‘ , ...
    

    The string2 file name pattern replaces the string1 file name pattern, and the string4 file name pattern replaces the string3 file name pattern. You can use as many pairs of file name pattern and replacement file name pattern strings as required.

    If you specify an odd number of strings (the last string has no corresponding replacement string), then an error is returned. Do not specify more than one pattern/replace string that matches a single file name or directory.

  • NONE when no files should be copied or moved during PDB creation. Omitting the FILE_NAME_CONVERT clause is the same as specifying NONE.

You can use the FILE_NAME_CONVERT clause in any CREATE PLUGGABLE DATABASE statement.

When the FILE_NAME_CONVERT clause is not specified in a CREATE PLUGGABLE DATABASE statement, either Oracle Managed Files or thePDB_FILE_NAME_CONVERT initialization parameter specifies how to generate the names of the files. If you use both Oracle Managed Files and thePDB_FILE_NAME_CONVERT initialization parameter, then Oracle Managed Files takes precedence. The FILE_NAME_CONVERT clause takes precedence when it is specified.

File name patterns specified in the FILE_NAME_CONVERT clause cannot match files or directories managed by Oracle Managed Files.

Example 38-4 FILE_NAME_CONVERT Clause

This FILE_NAME_CONVERT clause generates file names for the new PDB in the /oracle/pdb5 directory using file names in the /oracle/dbs directory.

FILE_NAME_CONVERT = (‘/oracle/dbs/‘, ‘/oracle/pdb5/‘)

Oracle Multitenant Environment (五) Create PDB

时间: 2024-10-14 03:51:14

Oracle Multitenant Environment (五) Create PDB的相关文章

Oracle Multitenant Environment (四) Create One or More CDBs

Using the CREATE DATABASE Statement to Create a CDB This section describes creating a CDB using the CREATE DATABASE SQL statement. Note: Oracle strongly recommends using the Database Configuration Assistant (DBCA) instead of the CREATE DATABASE SQL s

Oracle Multitenant Environment (三) Plan for a cdb

Below tables contains contant you need to consider while planning for a CDB. Action Considerations for a CDB Additional Information Plan the tables and indexes for the pluggable databases (PDBs) and estimate the amount of space they will require. In

Oracle Multitenant Environment

About oracle mulittenant environment The multitenant architecture enables an Oracle database to function as a multitenant container database (CDB) that includes zero, one, or many customer-created pluggable databases (PDBs). A PDB is a portable colle

Oracle Multitenant Environment (二) Purpose

Purpose of a Multitenant Environment A multitenant environment enables the central management of multiple PDBs in a single installation. By using a multitenant environment, you can accomplish the following goals: Cost reduction By consolidating hardw

Oracle Multitenant Option - 12c Frequently Asked Questions (文档 ID 1511619.1)译文

适用于: 企业版数据库--版本12.1.0.1(12.1) 本文档中的知识对所有平台均适用. 文档目的 文档描写了插接式数据库的许多方面和用法,以更好的理解该产品,同时,该文档也可做为一个快速参考手册. 问答 12c多租户架构中的CDB/PDB概念知识. 多租户架构中的可插接数据库(PDB)是什么意思? 可插接数据库(PDB)是Oracle数据库12c(12.1)中的新特性.可以在一个数据库内部拥有多个可插接数据库.可插接数据库是完全向后兼容的. 为什么要使用多租户选件? 是为了实现以下数据库整

Oracle学习(十五):分布式数据库

--分布式数据库的独立性:分布数据的独立性指用户不必关心数据如何分割和存储,只需关心他需要什么数据. --本地操作 SQL> sqlplus scott/tiger --远程操作 SQL> sqlplus scott/[email protected]:1521/orcl --分布式操作 SQL> --创建数据库链路l2(需要权限): SQL> --remoteorcl服务命名(在net manager里配置):配置跟远程服务器的数据库的连接协议.主机名(ip地址).端口号等 SQ

Oracle SQL(五)

7. 存储过程 7.1 简介 7.1.1 定义 所谓存储过程,就是一段存储在数据库中执行某块业务功能的程序模块. 它是由一段或者多段的PL/SQL代码块或者SQL语句组成的一系列代码块. 7.1.2 结构分析 create [or replace] procedure 过程名 ( p1 in|out datatype, p2 in|out datatype, ... pn in|out datatype ) is/as ....--声明部分 begin ....--过程体 end; PS:标紫色

Oracle conncect role vs create session

Oracle conncect role vs create session The CONNECT role was introduced with OracleDatabase version 7, which added new and robust support for database roles. TheCONNECT role is used in sample code, applications, documentation, and technicalpapers. The

Oracle创建表语句(Create table)语法详解及示例

Oracle创建表语句(Create table)语法详解及示例   创建表(Create table)语法详解1. ORACLE常用的字段类型ORACLE常用的字段类型有VARCHAR2 (size) 可变长度的字符串, 必须规定长度CHAR(size) 固定长度的字符串, 不规定长度默认值为1NUMBER(p,s) 数字型p是位数总长度, s是小数的长度, 可存负数最长38位. 不够位时会四舍五入.DATE 日期和时间类型LOB 超长字符, 最大可达4GCLOB 超长文本字符串BLOB 超长