17 Introduction to the Multitenant Architecture

17 Introduction to the Multitenant Architecture

This chapter contains information specific to the Oracle Multitenant option, and contains the following topics:

About the Multitenant Architecture

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 collection of schemas, schema objects, and nonschema objects that appears to an Oracle Net client as a non-CDB. All Oracle databases before Oracle Database 12c were non-CDBs.

About Containers in a CDB

container is either a PDB or the root container (also called the root). The root is a collection of schemas, schema objects, and nonschema objects to which all PDBs belong (see "Overview of Containers in a CDB").

Every CDB has the following containers:

  • Exactly one root

    The root stores Oracle-supplied metadata and common users. An example of metadata is the source code for Oracle-supplied PL/SQL packages (see"Data Dictionary Architecture in a CDB"). A common user is a database user known in every container (see "Common Users in a CDB"). The root container is named CDB$ROOT.

  • Exactly one seed PDB

    The seed PDB is a system-supplied template that the CDB can use to create new PDBs. The seed PDB is named PDB$SEED. You cannot add or modify objects in PDB$SEED.

  • Zero or more user-created PDBs

    A PDB is a user-created entity that contains the data and code required for a specific set of features. For example, a PDB can support a specific application, such as a human resources or sales application. No PDBs exist at creation of the CDB. You add PDBs based on your business requirements.

The following graphic shows a CDB with four containers: the root, seed, and two PDBs. Each PDB has its own dedicated application, and is managed by its own PDB administrator. A common user exists across a CDB with a single identity. In this example, common user SYS can manage the root and every PDB. At the physical level, this CDB has a database instance and database files, just as a non-CDB does.

Description of cncpt345.png follows
Description of the illustration cncpt345.png

See Also:

Oracle Database Administrator's Guide for an introduction to the multitenant architecture

About User Interfaces for the Multitenant Architecture

You can use the same tools for both CDBs and non-CDBs. For example, you can use:

Benefits of the Multitenant Architecture

Large enterprises may use hundreds or thousands of databases. Often these databases run on different platforms on multiple physical servers. Because of improvements in hardware technology, especially the increase in the number of CPUs, servers are able to handle heavier workloads than before. A database may use only a fraction of the server hardware capacity. This approach wastes both hardware and human resources.

For example, 100 servers may have one database each, with each database using 10% of hardware resources and 10% of an administrator's time. A team of DBAs must manage the SGA, database files, accounts, security, and so on of each database separately, while system administrators must maintain 100 different computers.

To show the problem in reduced scale, Figure 17-1 depicts 11 databases, each with its own application and server. A head DBA oversees a team of four DBAs, each of whom is responsible for two or three databases.

Figure 17-1 Database Environment Before Database Consolidation

Description of Figure 17-1 follows
Description of "Figure 17-1 Database Environment Before Database Consolidation"

A typical response to the management problem is to place multiple databases on each server. The problem is that the multiple database instances do not share background processes, system and process memory, or Oracle metadata. Another response is to logically separate the data into schemas or virtual private databases. The problem is that these virtual entities are difficult to manage, secure, and transport.

Benefits of the Multitenant Architecture for Database Consolidation

The process of consolidating data from multiple databases into one database on one computer is known as database consolidation. Starting in Oracle Database 12c, the Oracle Multitenant option enables you to consolidate data and code without altering existing schemas or applications.

The PDB/non-CDB compatibility guarantee means that a PDB behaves the same as a non-CDB as seen from a client connecting with Oracle Net. The installation scheme for an application back end that runs against a non-CDB runs the same against a PDB and produces the same result. Also, the run-time behavior of client code that connects to the PDB containing the application back end is identical to the behavior of client code that connected to the non-CDB containing this back end.

Operations that act on an entire non-CDB act in the same way on an entire CDB, for example, when using Oracle Data Guard and database backup and recovery. Thus, the users, administrators, and developers of a non-CDB have substantially the same experience after the database has been consolidated.

Figure 17-2 depicts the databases in Figure 17-1 after consolidation onto one computer. The DBA team is reduced from five to three, with one CDB administrator managing the CDB while two PDB administrators split management of the PDBs.

Using the multitenant architecture for database consolidation has the following benefits:

  • Cost reduction

    By consolidating hardware and sharing database memory and files, you reduce costs for hardware, storage, availability, and labor. For example, 100 PDBs on a single server share one database instance and one set of database files, thereby requiring less hardware and fewer personnel.

  • Easier and more rapid movement of data and code

    By design, you can quickly plug a PDB into a CDB, unplug the PDB from the CDB, and then plug this PDB into a different CDB. The implementation technique for plugging and unplugging is similar to the transportable tablespace technique.

  • Easier management and monitoring of the physical database

    The CDB administrator can attend to one physical database (one set of files and one set of database instances) rather than split attention among dozens or hundreds of non-CDBs. Backup strategies and disaster recovery are simplified.

  • Separation of data and code

    Although consolidated into a single physical database, PDBs mimic the behavior of non-CDBs. For example, if user error loses critical data, a PDB administrator can use Oracle Flashback or point-in-time recovery to retrieve the lost data without affecting other PDBs.

  • Secure separation of administrative duties

    A user account is common, which means that it can connect to any container on which it has privileges, or local, which means that it is restricted to a specific PDB. A CDB administrator can use a common user account to manage the CDB. A PDB administrator uses a local account to manage an individual PDB. Because a privilege is contained within the container in which it is granted, a local user on one PDB does not have privileges on other PDBs within the same CDB.

  • Ease of performance tuning

    It is easier to collect performance metrics for a single database than for multiple databases. It is easier to size one SGA than 100 SGAs.

  • Support for Oracle Database Resource Manager

    In a multitenant environment, one concern is contention for system resources among the PDBs running on the same computer. Another concern is limiting resource usage for more consistent, predictable performance. To address such resource contention, usage, and monitoring issues, you can use Oracle Database Resource Manager (see "Database Resource Manager").

  • Fewer database patches and upgrades

    It is easier to apply a patch to one database than to 100 databases, and to upgrade one database than to upgrade 100 databases.

Benefits of the Multitenant Architecture for Manageability

The multitenant architecture has benefits beyond database consolidation. These benefits derive from storing the data and data dictionary metadata specific to a PDB in the PDB itself rather than storing all dictionary metadata in one place. By storing its own dictionary metadata, a PDB becomes easier to manage as a distinct unit, even when only one PDB resides in a CDB.

Benefits of data dictionary separation include the following:

  • Easier migration of data and code

    For example, instead of upgrading a CDB from one database release to another, you can unplug a PDB from the existing CDB, and then plug it into a newly created CDB from a higher release.

  • Easier testing of applications

    You can develop an application on a test PDB and, when it is ready for deployment, plug this PDB into the production CDB.

Path to Database Consolidation

For the duration of its existence, a database is either a CDB or a non-CDB. You cannot transform a non-CDB into a CDB or vice versa. You must define a database as a CDB at creation, and then create PDBs within this CDB.

The basic path to database consolidation is:

  1. Creation of a CDB

  2. Creation of a PDB

Creation of a CDB

The CREATE DATABASE ... ENABLE PLUGGABLE DATABASE SQL statement creates a new CDB. If you do not specify the ENABLE PLUGGABLE DATABASE clause, then the newly created database is a non-CDB and can never contain PDBs.

Along with the root (CDB$ROOT), Oracle Database automatically creates a seed PDB (PDB$SEED). The following graphic shows a newly created CDB:

Description of admin095.png follows
Description of the illustration admin095.png

Example 17-1 shows a simple query for determining whether the database to which an administrative user is currently connected is a non-CDB, or a container in a CDB.

Example 17-1 Determining Whether a Database Is a CDB

SQL> SELECT NAME, CDB, CON_ID FROM V$DATABASE;
 
NAME      CDB     CON_ID
--------- --- ----------
CDB1      YES          0

See Also:

Creation of a PDB

The CREATE PLUGGABLE DATABASE SQL statement creates a PDB. This PDB automatically includes a full data dictionary including metadata and internal links to system-supplied objects in the root. You can only create a PDB in a CDB and not within another PDB.

The following graphic depicts the options for creating a PDB:

Description of cncpt358.png follows
Description of the illustration cncpt358.png

The following graphic shows a CDB that contains six PDBs. hrpdb is a newly created PDB. salespdb was a pre-existing PDB that was unplugged from a different CDB and plugged into this CDB. The remaining four PDBs, each of whose names contains the prefix test, were copied from salespdb.

Description of cncpt350.png follows
Description of the illustration cncpt350.png

The following sections describe the different techniques for creating PDBs.

Creation of a PDB from Seed

You can use the CREATE PLUGGABLE DATABASE statement to create a PDB by copying the files from PDB$SEED, which is a template for creating PDBs. The following graphic illustrates creation from the seed:

Description of admin089.png follows
Description of the illustration admin089.png

The following SQL statement creates a PDB named hrpdb from the seed using Oracle Managed Files:

CREATE PLUGGABLE DATABASE hrpdb
 ADMIN USER dba1 IDENTIFIED BY password

See Also:

Oracle Database Administrator's Guide to learn this technique
Creation of a PDB by Cloning a PDB

This technique copies the files associated with the source PDB to a new location and associates the copied files with the new PDB. You can clone a PDB that resides in the same CDB or in a different CDB. If in a different CDB, then you must use a database link to specify the remote CDB that contains the PDB to be cloned. The following graphic illustrates cloning a PDB from an existing PDB in the same CDB:

Description of admin091.png follows
Description of the illustration admin091.png

If the underlying file system of a PDB supports storage snapshots, then you may specify the SNAPSHOT COPY clause to clone a PDB using storage snapshots. In this case, Oracle Database does not make a complete copy of source data files, but creates a storage-level snapshot of the underlying file system, and uses it to create PDB clones. Snapshot copies make cloning almost instantaneous.

The following SQL statement clones a PDB named salespdb from the plugged-in PDB named hrpdb:

CREATE PLUGGABLE DATABASE salespdb FROM hrpdb

See Also:

Oracle Database Administrator's Guide to learn how to perform this technique
Creation of a PDB by Plugging in an Unplugged PDB

In its unplugged state, a PDB is a self-contained set of data files and an XML metadata file. This technique uses the XML metadata file that describes the PDB and the files associated with the PDB to associate it with the CDB. The following graphic illustrates plugging in an unplugged PDB:

Description of admin090.png follows
Description of the illustration admin090.png

The following SQL statement plugs in a PDB named financepdb based on the metadata stored in the named XML file, and specifies NOCOPY because the files of the unplugged PDB do not need to be renamed:

CREATE PLUGGABLE DATABASE salespdb USING '/disk1/usr/financepdb.xml' NOCOPY

See Also:

Oracle Database Administrator's Guide to learn how to perform this technique
Creation of a PDB from a Non-CDB

You can use any of the following techniques to create a PDB from an existing non-CDB:

  • Execute DBMS_PDB.DESCRIBE on a non-CDB in Oracle Database 12c

    You place a non-CDB in a transactionally consistent state, and then run the DBMS_PDB.DESCRIBE function to generate XML metadata about this database. While connected to the root in the CDB, you execute the CREATE PLUGGABLE DATABASE statement to create a PDB from the existing non-CDB.

    See Oracle Database Administrator's Guide to learn how to perform this technique.

  • Use Oracle Data Pump with or without transportable tablespaces

    You can use Oracle Data Pump to define a data set on a non-CDB. This non-CDB can be in the current or a previous Oracle Database release, for example, Oracle Database 10g. You create an empty PDB in an existing CDB, and then use Oracle Data Pump to import the data set into the PDB.

    A Full Transportable Export using Oracle Data Pump exports all objects and data necessary to create a complete copy of the database. Oracle Data Pump exports all objects that can be exported using the transportable option, and then exports the remaining objects using direct-path INSERT and external tables. The Full Transportable dump file contains all objects in the database, not only table-related objects. Full Transportable Export is available starting in Oracle Database 11g Release 2 (11.2.0.3) for import into Oracle Database 12c.

    See Oracle Database Administrator's Guide to learn how to perform this technique.

  • Use Oracle GoldenGate replication

    You replicate the data from the non-CDB to a PDB. When the PDB catches up with the non-CDB, you fail over to the PDB.

    See Oracle Database Administrator's Guide to learn how to perform this technique.

The following graphic illustrates the technique of running the DBMS_PDB.DESCRIBE function on a non-CDB, and then creating a PDB using the non-CDB files:

Description of admin098.png follows
Description of the illustration admin098.png

See Also:

Multitenant Environment Documentation Roadmap

Table 17-1 lists the most important topics for understanding and using CDBs, and includes cross-references to the appropriate documentation.

Table 17-1 Roadmap for the Multitenant Architecture Documentation

CategoryTopicDocumentation

Concepts

Overview of CDBs and PDBs

Chapters in Part VI, "Multitenant Architecture", and Oracle Database Administrator's Guide

Administration

Creating and configuring a CDB

Oracle Database Administrator's Guide

Administration

Managing a CDB

Oracle Database Administrator's Guide

Administration

Creating and configuring a PDB

Oracle Database Administrator's Guide

Administration

Managing a PDB

Oracle Database Administrator's Guide

Performance

Troubleshooting PDBs

Oracle Database Performance Tuning Guide

Backup and Recovery

Performing backup and recovery in a CDB

Oracle Database Backup and Recovery User's Guide

Security

Managing common users, roles, and privileges in a CDB

Oracle Database Security Guide

Miscellaneous

All other tasks relating to managing a CDB or PDB, including Oracle RAC, resource management, data transfer, and so on

Oracle Database Administrator's Guide is the primary task-oriented intermediate and advanced documentation for managing CDBs. This guide also contains See Also links to books that cover different CDB topics. For example, Oracle Database Utilities explains concepts and tasks specific to PDBs when using Oracle Data Pump.


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值