New Feature of oracle12c-Pluggable Database (PDB) and oracle12cpluggable

Source: Internet
Author: User

New Feature of oracle12c-Pluggable Database (PDB) and oracle12cpluggable

1. Advantages of new features of 12c PDB

1) Multiple PDBs can be integrated into one platform.

2) A new PDB or an existing PDB clone can be provided quickly.

3) through the plugging technology, you can quickly redeploy existing databases to a new platform.

4) patch or upgrade multiple PDB databases once.

5) by plugging a single PDB into different CDB versions in a higher version, you can patch or upgrade a PDB.

6) The content of a PDB is separated from many PDBs in the same CDB.

7) Remove the responsibilities of these PDB application administrators.

2. New Features of 12c PDB

1) In a CDB, You can have many PDB instances.

2) PDB is backward compatible with common databases of versions earlier than 12.1.

3) PDB is transparent to applications-you do not need to change client code or database objects.

4) In RAC, each instance opens CDB as a whole (So CDB and its PDB database versions are the same ).

5) The session only displays the PDB connected to it.

6) you can pull a PDB from a CDB and insert another CDB.

7) you can clone PDB between the same CDB or different CDBs.

8) the resource manager can be expanded with the PDB function.

9) use SQL statements to perform operations on the object PDB (create, unplug, insert, clone, clear, and set the open mode ).

10) when connected to the so-called "root", the administrator of the CDB will perform these operations.

11) All PDBs can be backed up once, but can be recovered separately.

3. 12c PDB details

1) Each PDB has its own private data dictionary for the database objects created by users. CDB, as a whole, also contains the data dictionary provided by Oracle, each data dictionary defines its own namespace. In other words, Global Data Dictionary (CDB level) and local data dictionary (PDB level) are available ).

2) there is a new separate data dictionary architecture that allows a PDB to be quickly pulled out from a CDB and inserted into a different CDB.

3) Each PDB can only see the read-only definition provided by Oracle.

4) Global Database parameters and local database parameters are available. The PDB parameter only belongs to a specific PDB. After the PDB is extracted, the PDB parameter remains unchanged.

5) database users can be global (CDB) or local (PDB ). SYS and SYSTEM users exist in two levels of DB at the beginning. If you create a new user in CDB, you can also see this user in PDB. Users created in PDB can only use this PDB.

6) The temporary tablespace can be global or local.

7) Redo logs and Undo tablespaces are global (CDB level ).

8) Data Guard plays a role as a whole at the CDB level; RMAN scheduled backup is also completed at the CDB level as a whole; at any time, you can back up only one PDB.

9) The application does not need to modify the code when connecting to PDB. the system administrator can connect to CDB. The service name in the connection string determines the target PDB.

10) PDB allows clearer declarations to define an application. a pdb knows nothing about other PDBs in the same CDB, and each PDB is a closed container. This ensures the independence and security of the new DB.

4. connect to a PDB

When a PDB is created, a service is also created in the PDB, and the service is used as the initialization container. You can use the following statement to display the current container:

SelectSys_Context ('userenv', 'Con _ name') "current container" from dual;

At the 12.1 SQL * Plus prompt, you can use SHOW con_name to explicitly display the current container.

The Service is also started when you create a PDB instance. Although the metadata of the service is recorded in PDB, the name is the same as that of PDB. The session will be created by a user who cannot change the current container.

Client application code is usually designed to determine the connection description information outside the code. For example, the Code may use the TNS alias to allow changing the connection string without changing the code.

Of course, there can be multiple services in a PDB. Each container will indicate that it is defined as the initial current container of PDB. You can use conventional methods to create, maintain, and clear other services in PDB, but do not clear the default services in PDB. The only way to establish an initial container is a PDB session is to determine a service.

The following example shows how to use an easy syntax to connect to a CDB called "cdb1" in Orale12c and connect to one of the PDB:

SqlplusSys/Sys @ localhost: 1521/cdb1 AS SYSDBA

CONNECTScott/tiger @ localhost: 1521/My_PDB

5. Create and open a new Oracle12c pluggable database (PDB)

Now, we will create and open a new pluggable database named my_pdb ). Each CDB hasPDB $ SeedStandard PDB template. We actually create a new PDB by cloning this template. Take the following example:

Sqlplussys/pass @ localhost: 1521/cdb1 as sysdba

Create pluggable database My_PDB

Admin user App_Admin identified by pass

File_name_convert = ('/pdbseed/', '/my_pdb /');

The "file_name_convert" clause determines how the new file name is derived from the template library, which is similar to the rman we know. During the creation of PDB, Oracle only copies two data files in the system and sysaux tablespaces. Other database files such as undo and redo are global files of CDB, and they belong to a specific container named CDB $ Root.

The "admin user" clause is required. In the extended format, new users are granted permissions and roles. This user can create new sessions only within my_pdb.

After the pluggable database is created, the new PDB is in MOUNTED mode. You must open a new session before creating a new session in the new PDB. Therefore, we can use the following command to open it:

Alter pluggabledatabase My_PDB open;

6. Check the container database (CDB) and pluggable database (PDB) files

Select con_id, tablespace_name, file_name

Fromcb_data_files

Where file_Namelike '%/cdb1/pdbseed/%'

Or file_Namelike '%/cdb1/my_pdb/%'

Order by 1, 2;

CON_IDTablespace_Name File_Name

-------------------------------------------------------------------

2 SYSAUX/home/oracle/oradata/cdb1/pdbseed/sysaux01.dbf

2 SYSTEM/home/oracle/oradata/cdb1/pdbseed/system01.dbf

3 SYSAUX/home/oracle/oradata/cdb1/My_PDB/sysaux01.dbf

3 SYSTEM/home/oracle/oradata/cdb1/My_PDB/system01.dbf

7. Open all Oracle 12c Pluggable Databases (PDB)

Each CDB in each RAC instance has its own open mode (Open_Mode) And restriction status (RestrictedStatus ). The possible values of the open mode are MOUNTED, read only, and read write. When PDB is enabled, the possible values of the restricted status are YES and NO; otherwise, the value is null;

Starting an instance (this time the CDB is enabled) does not open PDB. The "alterpluggable database" statement is used to set the open mode of PDB. In this SQL statement, you can give a specific PDB name or use the keyword "all", for example:

Alter pluggabledatabase all open;

8. Disable all Oracle12c pluggable databases in CDB.

Use the following statement to disable all PDB in CDB:

Alter pluggabledatabase all close;

9. Clone an existing Oracle12cPDB in the same CDB.

Next, we will clone the existing PDB in the same CDB. To do this, you must disable the PDB before starting cloning, and then enable it in read only mode:

Alterpluggable database My_PDB close;

Alterpluggable database My_PDB open read only;

Createpluggable database My_Clone

FromMy_PDB

File_name_convert = ('/my_pdb', '/my_clone ');

Alterpluggable database My_PDB close;

Alterpluggable database My_PDB open;

Alterpluggable database My_Clone open;

10. Pull the pluggable database (PDB) from the container database (CDB)

The following shows how to pull my_pdb from cdb1. The "into" keyword must be followed by the full path described by PDB. This operation is generated in XML format:

Alterpluggable database My_PDB

Unpluginto '/home/oracle/oradata/cdb1/my_pdb/my_pdb.xml ';

"My_pdb.xml"The file determines the name and path of the data file. This information is used in the insert operation. Note: PDB is part of the CDB that is pulled out from it, but the status changes to pulling out (UNPLUGGED.

The pulling operation actually changes the data file to record that the PDB is successfully pulled out correctly. Because it is part of CDB, you can make an RMAN backup for it. This provides a convenient way to archive and unplug logs.

Once you back up it, you can remove it from the dictionary-but, of course, you must keep the data files for future insert operations.

Droppluggable database My_PDB keep datafiles;

11. Oracle 12c pluggable database-plugging and cloning

11.1. Insert My_PDB into cdb2

1) connect to the target container database. Here is cdb2 under/home/oracle/oradata/cdb2.

Sqlplus sys/pass @ localhost: 1521/cdb2 as sysdba

2) then confirm that the pdb to be inserted is compatible with the new master container database.

Exec DBMS_PDB.Check_Plug_Compatibility (PDB_Descr_File => '/home/oracle/oradata/cdb1/my_pdb/my_pdb.xml ');

If it is not compatible, an error is reported during this process.

3) Insert PDB. The using keyword must follow the absolute path described by PDB, that is, the. XML file generated during the previous pulling operation.

create pluggable database My_PDB

using '/home/oracle/oradata/cdb1/my_pdb/my_pdb.xml'

move

file_name_convert = ('/cdb1/', '/cdb2/');

alter pluggable database My_PDB open;

11.2. Create a PDB clone from the extracted PDB

In this example, we recommend that you keep a pulled-out PDB backup, which has many application scenarios, such:

1) In a Development Department, developers and testers can quickly and repeatedly provide a start;

2) support self-study;

3) provide a method for delivering new applications;

For demonstration, assume that you have pulled out MY_PDB1, put it in a suitable directory, and set it to read-only.

create pluggable database MY_PDB1 as clone

using

'/home/oracle/oradata/bk_pdbs/my_pdb1/my_pdb1.xml'

copy

file_name_convert =

('/bk_pdbs/my_pdb1/', '/cdb1/my_pdb1/');

alter pluggable database my_pdb1 open;

"As clone"The SQL clause ensures that the new PDB has a correct and globally unique identifier. Then you can see your GUIDs:

SelectPDB_Name, GUID

FromDBA_PDBs

Orderby Creation_scn;

Note: After PBD is pulled out from the CBD and inserted into another CBDBA_PDBs.GUID will always be with it. The server code forces the uniqueness of PDB in the CBD, but does not force the uniqueness between the CBD. 

11.3. Insert a non-CBD database as PDB into an existing CBD Database

Here, I will show you how to transform the database before 12.1 into a PDB. You have several ways to do this:

1) The table space/data pump can be transferred;

2) copy;

3) Upgrade the original non-CBD database to 12c and insert it into 12c CDB;

Because the first two methods were once standard methods, we will only describe the last one here.

Note: not one upgrade step can complete all tasks. It is a two-phase operation: first, upgrade your existing database to 12.1 non-CDB database. Then, insert your non-CDB database into the existing CDB database-insert PDB only and then complete the insert step.

Step 1: first upgrade the database before version 12.1 to version 12c;

Step 2: connect to a non-CDB database to generate a representation file, as shown in pulling out a PDB section:

Shutdownimmediate

Startupmount

Alterdatabase open read only;

Begin

DBMS_PDB.Describe (PDB_Descr_File => '/home/oracle/oradata/noncdb. xml ');

End;

/

Shutdownimmediate

The next step is to connect to the receiving CDB database-cdb2 and insert the data files of the non-cdb database into the file.

Createpluggable database noncdb_pdb

Asclone

Using '/home/oracle/oradata/noncdb. xml'

Source_file_name_convert = none

Copy

File_name_convert = ('/noncdb/', '/cdb2/noncdb_pdb /')

Storageunlimited;

Ø open the database now, complete the insertion, close, and then open the database, and set the restriction status to YES:

Alterpluggable database noncdb_pdb open;

Alterpluggable database noncdb_pdb close;

Alterpluggable database noncdb_pdb open restricted;

 

Finally, run an SQL * Plus script provided by Oracle to migrate the data in the current local dictionary, because in the new version, the metadata defining the Oracle system is only stored once in the entire CDB.

Altersession set container = ExNonCDB;

@? /Rdbms/admin/noncdb_to_pdb. SQL

The last step is to open the new received non-CDB database.

Alterpluggable database noncdb_pdb open;

Copyright Disclaimer: This article is an original article by the blogger and cannot be reproduced without the permission of the blogger.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.