New features of oracle12c-pluggable database (pluggable database,pdb)

Source: Internet
Author: User

1. Advantages of the new 12c PDB Features

1) multiple PDB can be integrated into a single platform.

2) You can quickly provide a new PDB or a clone of an existing PDB.

3) with the plug-in technology, the existing database can be quickly redeployed to a new platform.

4) multiple PDB database patches or upgrades completed at once.

5) You can patch or upgrade a PDB by unplugging a single PDB to a higher version of different CDB.

6) separate the contents of a PDB from a large number of PDB in the same CDB .

7) Detach the responsibilities of these PDB application administrators.

2. features of the new 12c PDB feature

1) in a CDB , you can have a lot of PDB.

2) the PDB and 12.1 versions of the normal database are backwards compatible.

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

4) Each instance of the RAC opens CDB as a whole(so the CDB and the PDB database versions are the same).

5) The session only sees the PDB that it connects to itself.

6) You can pull a pdb out of a CDB and then insert another CDB.

7) You can clone the PDB between the same CDB or a different cdb.

8) The resource Manager expands as the PDB functions.

9) implementation of entity PDB operation via SQL statement (create, unplug, insert, clone, clear, set open mode).

When connected to the so-called "root" (root), the CDB administrator performs these operations.

All PDB can be backed up one at a time, but can be recovered separately.

3. 12c PDB explanation

1) each PDB has its own private data dictionary for user-created database objects; CDB, on the other hand, also contains a data dictionary of Oracle-provided systems, where each data dictionary defines its own namespace. In other words, there is a global data dictionary (CDB level) and a local data dictionary (PDB level).

2) There is a new separate data dictionary schema that allows a PDB to be quickly pulled out of a CDB and inserted into a different CDB.

3) each PDB can see only the read-only definition of the system provided by Oracle.

4) There are global database parameters, as well as local database parameters. the PDB parameter is only specific to the PDB, and when unplugged, the PDB parameter remains unchanged.

5) The database user can be global (CDB) or local (PDB). SYS and system users are present in level two db at the outset. If you create a new user in the CDB, you can see the user in the PDB as well. Users created in the PDB can only be used in that PDB.

6) The temporal tablespace can be global or local.

7) the Redo log and undo table spaces are global (CDB level).

8) Data Guard functions as a whole at the CDB level; Rman scheduled backups are also completed as a whole at the CDB level; You can back up only one PDB at any time.

9) when applying the connection PDB , no code modification is required; The system administrator can connect to CDB; The service name in the connection string determines the target PDB.

the pdb allows for clearer declarations to define an application; a PDB is ignorant of the other PDB in the same CDB; each PDB is a closed container. This guarantees a new level of DB independence and security.

4. Connect to a PDB

When a PDB is created , a service is also created within the PDB, and the service is initialized as a container. You can display the current container by using the following statement:

Selectsys_context (' Userenv ', ' con_name ') "Current container" from dual;

at the 12.1 sql*plus prompt, you can use show con_name to explicitly present the container.

When the PDB is created , the service is also started. Although the metadata for the service is recorded in the PDB, the name and the PDB name are the same. The session will be created by a user who cannot change the current container.

client application code is typically designed to determine connection description information outside of the code. For example, the code might use the TNS alias, which allows the connection string to be changed without changing the code.

of course, there can be more than one service in a PDB. Each will indicate that it is defined as the PDB initial current container. You can create, maintain, and purge additional services in the PDB in the usual way, but do not clear the default services in the PDB. The only way to establish an initial container is a PDB session is to determine a service.

in the following example, see How to connect to a cdb called "CDB1" in orale12c with an easy syntax, and connect to one of the PDB:

Sqlplussys/[email PROTECTED]:1521/CDB1 as SYSDBA

Connectscott/[email protected]:1521/my_pdb

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

now we are going to create and open a new pluggable database (PDB) called my_pdb. Each CDB has a standard PDB template called pdb$seed . We actually created a new PDB by cloning the template. Look at the following example:

Sqlplussys/[email PROTECTED]: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 what we know about Rman. During PDB creation, Oracle copies only two data files for the system and Sysaux tablespace, and the remaining database files such as Undo,redo are CDB global files, and they belong to a specific container called cdb$root.

The "admin user" clause is required, in the extended format, to give the new user permissions and roles that the user can create only within my_pdb.

after the pluggable database is created, the new PDB is in mounted mode. You must open a new session before you create one in it. Therefore, we can open it with the following command:

Alter Pluggabledatabase MY_PDB Open;

6. Check Container database (CDB) and pluggable database (PDB) files

Select Con_id,tablespace_name, file_name

Fromcdb_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)

RAC The PDB in each cdb in each instance has its own open mode (Open_mode ) and throttling status (Restricted status). The possible values for open mode are mounted,read only, and READ WRITE, and when the PDB is open, the possible values for the throttling state are yes and no, otherwise null;

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

Alter Pluggabledatabase all open;

8. Close all oracle12c pluggable databases in CDB

The following statement closes all the PDB in the CDB:

Alter Pluggabledatabase all close;

9. Cloning an existing oracle12cpdb in the same CDB

below, we will clone the existing PDB in the same CDB. To do this, you must close the PDB before you begin cloning, and then open 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;

Unplug a pluggable database (PDB) from the container database (CDB)

below, show how to pull the my_pdb from the CDB1. The "into" keyword must be followed by the full path described by the PDB, which is generated in XML format:

Alterpluggable Database my_pdb

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

the "my_pdb.xml" file determines the data file name and full path information. This information is used when inserting an operation. Note: The PDB is still part of the CDB from which it was pulled, but now the state becomes unplugged (UNPLUGGED).

The pull-out operation actually makes some changes to the data file so that the record PDB is properly pulled out successfully. Because it's still part of the CDB, you can make an rman backup of it. This provides a convenient way to archive the log out.

Once you have backed it up, you can remove it from the dictionary library-but, of course, you must keep the data files for future insertions.

droppluggable database my_pdb keep datafiles;

One . Oracle 12c pluggable database--Plug and clone operations

11.1. inserting the my_pdb into the cdb2

1) Connect to the target container database, here is the CDB2 under directory/HOME/ORACLE/ORADATA/CDB2

Sqlplus Sys/[email PROTECTED]:1521/CDB2 as Sysdba

2) then confirm that the PDB that will be inserted is compatible with the new primary container database

EXEC dbms_pdb. Check_plug_compatibility (pdb_descr_file=> '/home/oracle/oradata/cdb1/my_pdb/my_pdb.xml ');

If it is incompatible, the process will error.

3) Now, insert the PDB. The Using keyword must follow the absolute path described by the PDB, which is the result of the previous pull-out operation. XML file.

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. creating a PDB from the extracted PDB clones

This example suggests keeping a backup of the extracted PDB, which will have many scenarios, such as:

1) in a development department, allowing developers and testers to quickly and repeatedly provide a start;

2) Support self-study;

3) provide a way to deliver new applications;

to demonstrate, suppose you have pulled out the my_pdb1and placed it in the appropriate 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;

"asclone" The SQL clause ensures that the new PDB is given a correct, globally unique identity. Then, you can see your GUIDs:

Selectpdb_name, GUID

Fromdba_pdbs

CREATION_SCN;

Note: PBD is removed from the CBD and later inserted into another cbd,dBa_pdbs.guid will always accompany it. Server code enforces the uniqueness of the PDB within the CBD, but does not enforce uniqueness between CBD.

11.3. Insert A non-CBD library as a PDB into an existing CBD library

here, I will show you how to turn the database before 12.1 into a PDB. There are several ways you can do this:

1) can transmit the table space/ data pump;

2) copy;

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

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

Note: It is not an upgrade step to complete all tasks, it is a two-phase operation: First, upgrade your existing database to the 12.1 non-CDB library, then, insert your non-CDB library into the existing CDB-just insert the PDB and then complete a post-insertion step.

? the first step, the 12.1 before the library upgrade to 12c version;

? The second step is to connect to the non-CDB library in order to produce a presentation file, as shown in the removal of a PDB section:

Shutdownimmediate

Startupmount

Alterdatabase Open Read only;

Begin

Dbms_pdb. Describe (pdb_descr_file=> '/home/oracle/oradata/noncdb/noncdb.xml ');

End

/

Shutdownimmediate

? The next step is to connect to the receiving CDB library--CDB2 and insert the data file of the non-CDB library with the presentation file.

Createpluggable Database noncdb_pdb

Asclone

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

source_file_name_convert= None

Copy

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

storageunlimited;

? now open the library, finish inserting, close, then open, and set the limit state to Yes:

alterpluggable database noncdb_pdb Open;

alterpluggable database noncdb_pdb close;

Alterpluggable database noncdb_pdb open restricted;

? Finally, run an Oracle -provided Sql*plus script to remove the data from the current local dictionary because, in the new version, the metadata that defines the Oracle system is stored only once in the entire CDB.

Altersession Set container = exnoncdb;

@?/rdbms/admin/noncdb_to_pdb.sql

? as a final step, open the newly received non-CDB library.

alterpluggable database noncdb_pdb Open;

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

New features of oracle12c-pluggable database (pluggable database,pdb)

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.