SlideShare a Scribd company logo
1 of 67
Download to read offline
Oracle Multitenant 19c - All About Pluggable Databases
Mahir M. Quluzade
Central Bank of Azerbaijan
#UKOUG
#TECHFEST2019
#PASSTHEKHOWLEDGE
Baku, Azerbaijan
2 Mahir M. Quluzade http://www.mahir-quluzade.com
Mahir M. Quluzade
 Oracle ACE
 Board Member of Azerbaijan Oracle User Group (@AzerbaijanOUG)
 Board Member of International Data Guard Oracle User Group (@idgoug)
 Oracle Database Architect at Central Bank of Azerbaijan
 Blogger since 2011 : http://www.mahir-quluzade.com
@marzade
3 Mahir M. Quluzade http://www.mahir-quluzade.com
Azerbaijan Oracle User Group
@AzerbaijanOUG
 Azerbaijan Oracle Users Group
 Founded June 2012
 Organized many international
conferences, also local events
@AzerbaijanOUG
4 Mahir M. Quluzade http://www.mahir-quluzade.com
Traditional
Oracle Database Architecture
5 Mahir M. Quluzade http://www.mahir-quluzade.com
Oracle Database Architecture
Pre-12c Oracle Database
 Oracle Instance
– SGA & PGA
– Background Processes
 Oracle Database
– Control Files
– Data Files
– Redo Logs (Online and Archived)
– Parameter and Password file
6 Mahir M. Quluzade http://www.mahir-quluzade.com
Container Databases
SQL> CREATE DATABASE ... ENABLE PLUGGABLE DATABASE
7 Mahir M. Quluzade http://www.mahir-quluzade.com
Create as Container Database
CREATE DATABASE cdb1
DATAFILE '/u01/app/oracle/oradata/cdb1/system01.dbf' SIZE
700M REUSE AUTOEXTEND ON NEXT 10240K MAXSIZE UNLIMITED
EXTENT MANAGEMENT LOCAL
SYSAUX DATAFILE
'/u01/app/oracle/oradata/cdb1/sysaux01.dbf' SIZE 550M
REUSE AUTOEXTEND ON NEXT 10240K MAXSIZE UNLIMITED
SMALLFILE DEFAULT TEMPORARY TABLESPACE TEMP TEMPFILE
'/u01/app/oracle/oradata/cdb1/temp01.dbf' SIZE 20M REUSE
AUTOEXTEND ON NEXT 640K MAXSIZE UNLIMITED
SMALLFILE UNDO TABLESPACE "UNDOTBS1" DATAFILE
'/u01/app/oracle/oradata/cdb1/undotbs01.dbf' SIZE 200M
REUSE AUTOEXTEND ON NEXT 5120K MAXSIZE UNLIMITED
CHARACTER SET AL32UTF8
NATIONAL CHARACTER SET AL16UTF16
LOGFILE GROUP 1
('/u01/app/oracle/oradata/cdb1/redo01.log') SIZE 50M,
GROUP 2 ('/u01/app/oracle/oradata/cdb1/redo02.log') SIZE
50M,
GROUP 3 ('/u01/app/oracle/oradata/cdb1/redo03.log') SIZE
50M
USER SYS IDENTIFIED BY "&&sysPassword" USER SYSTEM
IDENTIFIED BY "&&systemPassword"
ENABLE PLUGGABLE DATABASE …;
8 Mahir M. Quluzade http://www.mahir-quluzade.com
Oracle Database Architecture
Multitenant Architecture – 19c
 Oracle Multitenant Option
– Root Container (CDB$ROOT)
– Seed PDB (PDB$SEED)
– Application Root
 Application Seed
 Application PDBS
– Pluggable Database (PDBs)
9 Mahir M. Quluzade http://www.mahir-quluzade.com
Oracle Database Architecture
Multitenant Architecture – 19c
 CDB with No Application Containers
– Each PDB has its own dedicated
application
– A different PDB administrator manages
each PDB
– At the physical level, this CDB has
a database instance and database
files, just as a non-CDB does
10 Mahir M. Quluzade http://www.mahir-quluzade.com
Oracle Database Architecture
Multitenant Architecture – 19c
 CDB with an Application Container
– A CDB administrator manages the CDB itself.
– An application container administrator
manages the application container, including
application installation and upgrades.
– A PDB administrator manages hrpdb.
11 Mahir M. Quluzade http://www.mahir-quluzade.com
Container Databases
 System metadata required to
manage PDBs
 Does not store user data
 Only for common users
 Automatically created tablespaces
– SYSTEM, SYSAUX, TEMP, UNDO
 Oracle recommends AL32UTF8 for the root character set
CDB Root - CDB$ROOT
12 Mahir M. Quluzade http://www.mahir-quluzade.com
Container Databases
 Template for the creation of PDBs
 Created in all CDB
 Automatically created
– SYSTEM
– SYSAUX
– TEMP
– UNDO
 PDBs with different character sets can reside
in the same CDB without requiring character set conversion
Seed PDB - PDB$SEED
13 Mahir M. Quluzade http://www.mahir-quluzade.com
Container Databases
 Is an optional user-created
CDB component
– Stores data and metadata for application
– A CDB includes zero or more application containers..
– The application root stores metadata and data that all application PDBs can
share.
– CREATE PLUGGABLE DATABASE statement with the AS APPLICATION
CONTAINER clause
Application Container
14 Mahir M. Quluzade http://www.mahir-quluzade.com
Container Databases
 PDB is a user-created
– set of schemas, objects
– related structures that appears
logically to a client application
as a separate database.
 PDB is
– owned by SYS
regardless of which user created the PDB
SYS is a common user in the CDB.
Standard PDB
15 Mahir M. Quluzade http://www.mahir-quluzade.com
Pluggable Databases
SQL> CREATE PLUGGABLE DATABASE ...
16 Mahir M. Quluzade http://www.mahir-quluzade.com
Creating a PDB
Creating from Scratch Cloning Relocation Plugging In Referencing as a Proxy PDB
Locally Remotely
From a PDB From a Non-CDB
Plugging in a
Unplugged PDB
Adopting a
Non-CDB as a PDB
17 Mahir M. Quluzade http://www.mahir-quluzade.com
Pluggable Databases
Creating a PDB from Scratch
18 Mahir M. Quluzade http://www.mahir-quluzade.com
Pluggable Databases
 CDB1
$ sqlplus sys@cdb1 sys as sysdba
SQL> ALTER SYSTEM SET db_create_file_dest = '/u01/app/oracle/oradata';
SQL> CREATE PLUGGABLE DATABASE pdb1 ADMIN USER pdb1adm IDENTIFIED BY *******;
OR
SQL> CREATE PLUGGABLE DATABASE pdb1 ADMIN USER pdb1adm IDENTIFIED BY *******
2 CREATE_FILE_DEST='/u01/app/oracle/oradata';
OR
SQL> CREATE PLUGGABLE DATABASE repotestpdb ADMIN USER pdbadm IDENTIFIED BY *******
FILE_NAME_CONVERT=('/u01/app/oracle/oradata/cdb1/pdbseed/','/u01/app/oracle/oradata/cdb1/pdb2/');
OR
SQL> ALTER SESSION SET PDB_FILE_NAME_CONVERT='/u01/app/oracle/oradata/cdb1/pdbseed/'
,'/u01/app/oracle/oradata/cdb1/pdb3/';
SQL> CREATE PLUGGABLE DATABASE pdb3 ADMIN USER pdb_adm IDENTIFIED BY Password1 ROLES=(DBA);
You must open the new PDB in read/write mode for Oracle Database to complete the integration of the new PDB into the CDB.
Creating a PDB from Scratch
19 Mahir M. Quluzade http://www.mahir-quluzade.com
Pluggable Databases
Locally Cloning a PDB
20 Mahir M. Quluzade http://www.mahir-quluzade.com
Pluggable Databases
 CDB1
$ sqlplus sys@cdb1 sys as sysdba
SQL> ALTER PLUGGABLE DATABASE PDB1 CLOSE;
SQL> ALTER PLUGGABLE DATABASE PDB1 OPEN READ ONLY;
SQL> CREATE PLUGGABLE DATABASE PDB2 FROM PDB1
2 STORAGE UNLIMITED TEMPFILE REUSE
3 FILE_NAME_CONVERT=('/u01/app/oracle/oradata/cdb1/pdb1/', '/u01/app/oracle/oradata/cdb1/pdb2');
 PDB is in LOCAL UNDO MODE - HOT CLONING
SQL> CREATE PLUGGABLE DATABASE PDB3 FROM PDB1
2 STORAGE UNLIMITED TEMPFILE REUSE
3 FILE_NAME_CONVERT=('/u01/app/oracle/oradata/cdb1/pdb1/', '/u01/app/oracle/oradata/cdb1/pdb3');
Locally Cloning a PDB
21 Mahir M. Quluzade http://www.mahir-quluzade.com
Pluggable Databases
Remotely Cloning a PDB
22 Mahir M. Quluzade http://www.mahir-quluzade.com
Pluggable Databases
 CDB1
$ sqlplus sys@cdb1 sys as sysdba
SQL> CREATE USER c##remote_clone_user IDENTIFIED BY remote_clone_user CONTAINER=ALL;
SQL> GRANT CREATE SESSION, CREATE PLUGGABLE DATABASE TO c##remote_clone_user CONTAINER=ALL;
SQL> SELECT property_name, property_value FROM database_properties WHERE property_name = 'LOCAL_UNDO_ENABLED';
PROPERTY_NAME PROPERTY_VALUE
------------------------------ ------------------------------
LOCAL_UNDO_ENABLED TRUE
 CDB2
$ sqlplus sys@cdb2 sys as sysdba
SQL> CREATE DATABASE LINK clone_link CONNECT TO c##remote_clone_user IDENTIFIED BY remote_clone_user USING 'CDB1';
SQL> CREATE PLUGGABLE DATABASE PDB1CLONE FROM PDB1@clone_link;
SQL> SELECT name, open_mode FROM v$pdbs WHERE name = 'PDB1CLONE';
NAME OPEN_MODE
------------------------------ ----------
PDB1CLONE MOUNTED
 In local undo mode and archivelog mode, we don't need to turn the remote database into read-only mode
Remotely Cloning a PDB
23 Mahir M. Quluzade http://www.mahir-quluzade.com
Pluggable Databases
Remotely Cloning a PDB - From a Non-CDB
24 Mahir M. Quluzade http://www.mahir-quluzade.com
Pluggable Databases
 DB19C NON-CDB
$ sqlplus sys@db19c sys as sysdba
SQL> CREATE USER c##remote_clone_user IDENTIFIED BY remote_clone_user;
SQL> GRANT CREATE SESSION, CREATE PLUGGABLE DATABASE TO c##remote_clone_user;
SQL> SELECT log_mode FROM v$database;
LOG_MODE
------------
ARCHIVELOG
 CDB1
$ sqlplus sys@cdb1 sys as sysdba
SQL> CREATE DATABASE LINK clone_link CONNECT TO c##remote_clone_user IDENTIFIED BY remote_clone_user USING 'DB19C';
SQL> CREATE PLUGGABLE DATABASE DB19CPDB FROM NON$CDB@clone_link;
SQL> SELECT name, open_mode FROM v$pdbs WHERE name = 'DB19CPDB';
NAME OPEN_MODE
------------------------------ ----------
DB19CPDB MOUNTED
Remotely Cloning a PDB - From a Non-CDB
25 Mahir M. Quluzade http://www.mahir-quluzade.com
Pluggable Databases
Relocating a PDB
26 Mahir M. Quluzade http://www.mahir-quluzade.com
Pluggable Databases
 CDB1
SQL> CREATE USER c##remote_clone_user IDENTIFIED BY remote_clone_user CONTAINER=ALL;
SQL> GRANT CREATE SESSION, CREATE PLUGGABLE DATABASE TO c##remote_clone_user CONTAINER=ALL;
SQL> SELECT property_name, property_value FROM database_properties
2 WHERE property_name = 'LOCAL_UNDO_ENABLED‘
PROPERTY_NAME PROPERTY_VALUE
------------------------------ ------------------------------
LOCAL_UNDO_ENABLED TRUE
 CDB2
SQL> CREATE DATABASE LINK clone_link CONNECT TO c##remote_clone_user IDENTIFIED BY remote_clone_user USING 'CDB1';
SQL> CREATE PLUGGABLE DATABASE PDB1CLONE FROM PDB1@clone_link RELOCATE;
SQL> SELECT name, open_mode FROM v$pdbs WHERE name = 'PDB1CLONE';
NAME OPEN_MODE
------------------------------ ----------
PDB1CLONE MOUNTED
 In local undo mode and archivelog mode, we don't need to turn the remote database into read-only mode
Remotely Cloning a PDB
27 Mahir M. Quluzade http://www.mahir-quluzade.com
Pluggable Databases
Plugging In an Unplugged PDB
28 Mahir M. Quluzade http://www.mahir-quluzade.com
Pluggable Databases
UNPLUG
SQL> CONNECT SYS@CDB1 AS SYSDBA
SQL> ALTER PLUGGABLE DATABASE pdb1 CLOSE;
SQL> ALTER PLUGGABLE DATABASE pdb1 UNPLUG INTO '/u01/app/oracle/oradata/cdb1/pdb1/pdb1.xml';
OR
SQL> ALTER PLUGGABLE DATABASE pdb1 UNPLUG INTO '/u01/app/oracle/oradata/cdb1/pdb1/pdb1.pdb';
PLUG-IN
SQL> CONNECT SYS@CDB2 as sysdba
SQL> CREATE PLUGGABLE DATABASE pdb2 USING '/u01/app/oracle/oradata/cdb2/pdb2/pdb1.xml'
2 FILE_NAME_CONVERT=('/u01/app/oracle/oradata/cdb1/pdb1/','/u01/app/oracle/oradata/cdb2/pdb2/');
OR
SQL> CREATE PLUGGABLE DATABASE pdb2 USING '/u01/app/oracle/oradata/cdb2/pdb2/pdb1.pdb'
2 FILE_NAME_CONVERT=('/u01/app/oracle/oradata/cdb1/pdb1/','/u01/app/oracle/oradata/cdb2/pdb2/');
SQL> ALTER PLUGGABLE DATABASE pdb2 OPEN READ WRITE;
Plugging In an Unplugged PDB
29 Mahir M. Quluzade http://www.mahir-quluzade.com
Pluggable Databases
Adopting a Non-CDB as a PDB
30 Mahir M. Quluzade http://www.mahir-quluzade.com
Pluggable Databases
 DB19C NON-CDB
sqlplus / as sysdba
– SQL> shutdown immediate
– SQL> startup mount exclusive
– SQL> alter database open read only;
– SQL> exec dbms_pdb.describe(pdb_descr_file=>'/u01/app/oracle/oradata/db19cnoncdb/noncdb.xml');
– SQL> shutdown immediate
 CDB1
sqlplus / as sysdba
– SQL> create pluggable database db19cpdb as clone using '/ u01/app/oracle/oradata/db19cnoncdb/noncdb.xml'
2 file_name_convert=('/u01/app/oracle/oradata/db19cnoncdb','/u01/app/oracle/oradata/db19cpdb') copy;
– SQL> alter pluggable database db19cpdb open;
sqlplus sys@db19cpdb as sysdba
– SQL> @$ORACLE_HOME/rdbms/admin/noncdb_to_pdb.sql
Adopting a Non-CDB as a PDB
31 Mahir M. Quluzade http://www.mahir-quluzade.com
Pluggable Databases
Creating a PDB as a Proxy PDB
32 Mahir M. Quluzade http://www.mahir-quluzade.com
Pluggable Databases
 CDB1
– SQL> CREATE USER c##remote_clone_user IDENTIFIED BY remote_clone_user CONTAINER=ALL;
– SQL> GRANT CREATE SESSION, CREATE PLUGGABLE DATABASE TO c##remote_clone_user CONTAINER=ALL;
 CDB2
– SQL> CREATE DATABASE LINK clone_link CONNECT TO c##remote_clone_user IDENTIFIED BY remote_clone_user USING 'CDB1';
– SQL> CREATE PLUGGABLE DATABASE PDB1PROXY AS PROXY FROM pdb1@clone_link;
– SQL> ALTER PLUGGABLE DATABASE PDB1PROXY OPEN;
– SQL> SELECT name, open_mode FROM v$pdbs WHERE name = 'PDB1PROXY';
NAME OPEN_MODE
------------------------------ ----------
PDB1PROXY READ WRITE
Creating a PDB as a Proxy PDB
33 Mahir M. Quluzade http://www.mahir-quluzade.com
Pluggable Databases
Refreshable PDB
34 Mahir M. Quluzade http://www.mahir-quluzade.com
Pluggable Databases
 CDB1
– SQL> CREATE USER c##remote_clone_user IDENTIFIED BY remote_clone_user CONTAINER=ALL;
– SQL> GRANT CREATE SESSION, CREATE PLUGGABLE DATABASE TO c##remote_clone_user CONTAINER=ALL;
– SQL> SELECT property_name, property_value FROM database_properties
2 WHERE property_name = 'LOCAL_UNDO_ENABLED';
PROPERTY_NAME PROPERTY_VALUE
------------------------------ ------------------------------
LOCAL_UNDO_ENABLED TRUE
 CDB2
– SQL> CREATE DATABASE LINK clone_link CONNECT TO c##remote_clone_user IDENTIFIED BY remote_clone_user USING 'CDB1';
– SQL> CREATE PLUGGABLE DATABASE PDB1RO FROM pdb1@clone_link REFRESH MODE MANUAL;;
– SQL> SELECT name, open_mode FROM v$pdbs WHERE name = 'PDB1RO';
NAME OPEN_MODE
------------------------------ ----------
PDB1RO READ ONLY
– SQL> ALTER PLUGGABLE DATABASE PDB1RO REFRESH MODE EVERY 60 MINUTES;
– SQL> ALTER PLUGGABLE DATABASE PDB1RO REFRESH MODE EVERY 120 MINUTES;
Refreshable PDB
35 Mahir M. Quluzade http://www.mahir-quluzade.com
Pluggable Databases
Refreshable PDB Switchover
36 Mahir M. Quluzade http://www.mahir-quluzade.com
Pluggable Databases
 CDB1
– SQL> CREATE DATABASE LINK clone_link CONNECT TO c##remote_clone_user IDENTIFIED BY remote_clone_user USING 'CDB2';
– SQL> ALTER SESSION SET CONTAINER = PDB1;
– SQL> ALTER PLUGGABLE DATABASE REFRESH MODE MANUAL
2 FROM PDB1RO@clone_link
3 SWITCHOVER;
 CDB2
– SQL> CREATE DATABASE LINK clone_link CONNECT TO c##remote_clone_user IDENTIFIED BY remote_clone_user USING 'CDB1';
– SQL> ALTER SESSION SET CONTAINER = PDB1RO;
– SQL> ALTER PLUGGABLE DATABASE REFRESH MODE MANUAL
2 FROM PDB1@clone_link
3 SWITCHOVER;
Refreshable PDB Switchover
37 Mahir M. Quluzade http://www.mahir-quluzade.com
Pluggable Databases
Creating Application Containers
38 Mahir M. Quluzade http://www.mahir-quluzade.com
Pluggable Databases
Creating Application Containers
 CDB1
$ sqlplus sys@cdb1 sys as sysdba
SQL> ALTER SYSTEM SET db_create_file_dest = '/u01/app/oracle/oradata';
SQL> CREATE PLUGGABLE DATABASE appcon1 AS APPLICATION CONTAINER ADMIN USER adm IDENTIFIED BY *****;
SQL> ALTER PLUGGABLE DATABASE appcon1 OPEN;
SQL> ALTER SESSION SET CONTAINER = appcon1;
SQL> CREATE PLUGGABLE DATABASE apppdb1 ADMIN USER adm IDENTIFIED BY *****
SQL> ALTER PLUGGABLE DATABASE apppdb1 OPEN;
39 Mahir M. Quluzade http://www.mahir-quluzade.com
Pluggable Databases
Creating Application Containers
 CDB1
$ sqlplus sys@cdb1 sys as sysdba
SQL> ALTER SYSTEM SET db_create_file_dest = '/u01/app/oracle/oradata';
SQL> CREATE PLUGGABLE DATABASE appcon1 AS APPLICATION CONTAINER ADMIN USER adm IDENTIFIED BY *****;
SQL> ALTER PLUGGABLE DATABASE appcon1 OPEN;
SQL> ALTER SESSION SET CONTAINER = appcon1;
SQL> CREATE PLUGGABLE DATABASE apppdb1 ADMIN USER adm IDENTIFIED BY *****
SQL> ALTER PLUGGABLE DATABASE apppdb1 OPEN;
40 Mahir M. Quluzade http://www.mahir-quluzade.com
Pluggable Databases
Installing Applications
 CDB1
$ sqlplus sys@cdb1 sys as sysdba
SQL> ALTER SESSION SET CONTAINER = appcon1;
SQL> ALTER PLUGGABLE DATABASE APPLICATION app1 BEGIN INSTALL '1.0';
SQL> CREATE TABLESPACE …
SQL> CREATE USER …
SQL> GRANT CREATE SESSION, CREATE TABLE TO …
SQL> CREATE TABLE …
SQL> INSERT INTO …
…
SQL> ALTER PLUGGABLE DATABASE APPLICATION app1 END INSTALL;
SQL> ALTER SESSION SET CONTAINER = apppdb1;
SQL> ALTER PLUGGABLE DATABASE APPLICATION app1 SYNC;
41 Mahir M. Quluzade http://www.mahir-quluzade.com
Pluggable Databases
Snapshot Carousel PDB
42 Mahir M. Quluzade http://www.mahir-quluzade.com
Pluggable Databases
 Library of PDB snapshots
– PDB snapshot is a point-in-time copy of a PDB
– Maximum number of snapshots MAX_PDB_SNAPSHOTS = 8 (default)
 NONE : The PDB does not support snapshots.
 MANUAL : The PDB supports snapshots, but they are only created manually requested.
 EVERY n HOURS : A snapshot is automatically created every "n" hours. Where "n" is between 1 and 1999.
 EVERY n MINUTES : A snapshot is automatically created every "n" minutes. Where "n" is between 1 and 2999.
SQL> CONNECT / AS SYSDBA
SQL> CREATE PLUGGABLE DATABASE PDB2 ADMIN USER PDBADMIN IDENTIFIED BY ***********
FILE_NAME_CONVERT=('pdbseed','pdb2')
SNAPSHOT MODE EVERY 24 HOURS;
SQL> ALTER PLUGGABLE DATABASE PDB2 OPEN;
SQL> ALTER PLUGGABLE DATABASE PDB2 SAVE STATE;
Snapshot Carousel PDB
43 Mahir M. Quluzade http://www.mahir-quluzade.com
Pluggable Databases
SQL> SELECT con_id, con_name,snapshot_name,
snapshot_scn, full_snapshot_path
2 FROM cdb_pdb_snapshots
3 ORDER BY con_id, snapshot_scn;
CON_ID CON_NAME SNAPSHOT_NAME SNAPSHOT_SCN FULL_SNAPSHOT_PATH
---------- ---------- ------------------------------ ------------ -------------------------------------------
4 PDB2 SNAP_688979926_996491289 1764864 /u02/oradata/snap_688979926_1764864.pdb
 Recovering From a PDB Snapshot
SQL> CREATE PLUGGABLE DATABASE PDB2COPY FROM pdb2 USING SNAPSHOT SNAP_688979926_996491631;
OR
SQL> CREATE PLUGGABLE DATABASE PDB2COPY FROM pdb2 USING SNAPSHOT SNAP_688979926_996491631
SNAPSHOT MODE EVERY 24 HOURS;
SQL> ALTER PLUGGABLE DATABASE DROP SNAPSHOT SNAP_688979926_996491289;
Snapshot Carousel PDB
44 Mahir M. Quluzade http://www.mahir-quluzade.com
Pluggable Databases
Container Database (CDB) Fleet Management
45 Mahir M. Quluzade http://www.mahir-quluzade.com
Pluggable Databases
 CDB1 - LEAD
SQL> CONN sys/SysPassword1@cdb1 AS SYSDBA
SQL> ALTER DATABASE SET lead_cdb = TRUE;
SQL> SELECT property_name, property_value FROM database_properties
WHERE property_name = 'LEAD_CDB';
PROPERTY_NAME PROPERTY_VALUE
------------------------------ ------------------------------
LEAD_CDB TRUE
SQL> CREATE USER c##cdb_fleet_link_user IDENTIFIED BY cdb_fleet_link_user;
SQL> GRANT CREATE SESSION TO c##cdb_fleet_link_user;
Container Database (CDB) Fleet Management – Lead CDB
46 Mahir M. Quluzade http://www.mahir-quluzade.com
Pluggable Databases
Container Database (CDB) Fleet Management – Members CDB
 CDB2 - MEMBER
SQL> CONN sys/SysPassword1@cdb2 AS SYSDBA
SQL> CREATE PUBLIC DATABASE LINK lead_cdb_link
CONNECT TO c##cdb_fleet_link_user IDENTIFIED BY
cdb_fleet_link_user USING 'cdb1';
SQL> ALTER DATABASE SET lead_cdb_uri =
'dblink:LEAD_CDB_LINK';
SQL> SELECT property_value FROM database_properties
WHERE property_name = 'LEAD_CDB_URI';
PROPERTY_VALUE
--------------------------
dblink:LEAD_CDB_LINK
 CDB3 - MEMBER
SQL> CONN sys/SysPassword1@cdb2 AS SYSDBA
SQL> CREATE PUBLIC DATABASE LINK lead_cdb_link
CONNECT TO c##cdb_fleet_link_user IDENTIFIED BY
cdb_fleet_link_user USING 'cdb1';
SQL> ALTER DATABASE SET lead_cdb_uri =
'dblink:LEAD_CDB_LINK';
SQL> SELECT property_value FROM database_properties
WHERE property_name = 'LEAD_CDB_URI';
PROPERTY_VALUE
--------------------------
dblink:LEAD_CDB_LINK
47 Mahir M. Quluzade http://www.mahir-quluzade.com
Pluggable Databases
 LEAD CDB1
SQL> CONN sys/SysPassword1@cdb1 AS SYSDBA
SQL> SELECT con_id,
2 name,
3 open_mode,
4 proxy_pdb
5 FROM v$pdbs
6 ORDER BY name;
CON_ID NAME OPEN_MODE PROXY_PDB
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 PDB1 READ WRITE NO
5 PDB4 MOUNTED YES
7 PDB5 MOUNTED YES
Container Database (CDB) Fleet Management – LEAD CDB
48 Mahir M. Quluzade http://www.mahir-quluzade.com
Pluggable Databases
Removing a PDB
49 Mahir M. Quluzade http://www.mahir-quluzade.com
Pluggable Databases
 SQL> CONNECT sys@CDB1 AS SYSDBA
 SQL> ALTER PLUGGABLE DATABASE pdb1 CLOSE;
 SQL> DROP PLUGGABLE DATABASE PDB1 INCLUDING DATAFILES;
OR
 SQL> DROP PLUGGABLE DATABASE PDB1 KEEP DATAFILES;
 If a PDB was created with the SNAPSHOT COPY clause, then you must specify INCLUDING DATAFILES when you drop
the PDB
Removing a PDB
50 Mahir M. Quluzade http://www.mahir-quluzade.com
Administering a
Multitenant Environment
51 Mahir M. Quluzade http://www.mahir-quluzade.com
Administering a Multitenant Environment
 DBCA supporting manage container database
– Manage Pluggable Database
 Create a Pluggable Database
 Delete a Pluggable Database
 Unplug a Pluggable Database
 Configure a Pluggable Database
– It also enables you to create, relocate, clone, plug in, and unplug PDBs
 Silent mode
Using DBCA
52 Mahir M. Quluzade http://www.mahir-quluzade.com
Administering a Multitenant Environment
 Common User : The user is present in all containers (root and all PDBs).
SQL> CONNECT SYS@CDB1 AS SYSDBA
– Create the common user using the CONTAINER clause.
SQL> CREATE USER c##test_user1 IDENTIFIED BY password1 CONTAINER=ALL;
SQL> GRANT CREATE SESSION TO c##test_user1 CONTAINER=ALL;
– Create the common user using the default CONTAINER setting.
SQL> CREATE USER c##test_user2 IDENTIFIED BY password1;
SQL> GRANT CREATE SESSION TO c##test_user2;
Users in CDB
53 Mahir M. Quluzade http://www.mahir-quluzade.com
Administering a Multitenant Environment
 Local User : The user is only present in a specific PDB
– The same username can be present in multiple PDBs, but they are unrelated
SQL> CONNECT SYS@CDB1 AS SYSDBA
SQL> ALTER SESSION SET CONTAINER = pdb1;
– Create the local user using the CONTAINER clause.
SQL> CREATE USER test_user3 IDENTIFIED BY password1 CONTAINER=CURRENT;
SQL> GRANT CREATE SESSION TO test_user3 CONTAINER=CURRENT;
– Create the local user using the default CONTAINER setting
SQL> CONNECT system/password@pdb1
SQL> CREATE USER test_user4 IDENTIFIED BY password1;
SQL> GRANT CREATE SESSION TO test_user4;
Users in PDB
54 Mahir M. Quluzade http://www.mahir-quluzade.com
Administering a Multitenant Environment
 Common Role : The role is present in all containers (root and all PDBs)
SQL> CONN / AS SYSDBA
– Create the common role
SQL> CREATE ROLE c##test_role1;
SQL> GRANT CREATE SESSION TO c##test_role1;
– Grant it to a common user.
GRANT c##test_role1 TO c##test_user1 CONTAINER=ALL;
– Grant it to a local user.
SQL> ALTER SESSION SET CONTAINER = pdb1;
SQL> GRANT c##test_role1 TO test_user3;
Roles in CDB
55 Mahir M. Quluzade http://www.mahir-quluzade.com
Administering a Multitenant Environment
 Local Role : The role is only present in a specific PDB.
– The same role name can be used in multiple PDBs, but they are unrelated.
SQL> CONN / AS SYSDBA
– Switch container.
SQL> ALTER SESSION SET CONTAINER = pdb1;
– Alternatively, connect to a local or common user with the PDB service
SQL> CONN system/password@pdb1
– Create the common role
SQL> CREATE ROLE test_role1;
SQL> GRANT CREATE SESSION TO test_role1;
– Grant it to a common and local user
SQL> GRANT test_role1 TO c##test_user1;
SQL> GRANT test_role1 TO test_user3;
Roles in PDB
56 Mahir M. Quluzade http://www.mahir-quluzade.com
Administering a Multitenant Environment
Connecting to CDB
 Using SID  Using TNSNAMES and EZCONNECT
57 Mahir M. Quluzade http://www.mahir-quluzade.com
Administering a Multitenant Environment
Connecting to PDB
 Using TNSNAMES and EZCONNECT  Using ALTER SESSION SET CONTAINER
 Can’t use SID for connecting to PDB
58 Mahir M. Quluzade http://www.mahir-quluzade.com
Using Oracle Features in a
Multitenant Environment
59 Mahir M. Quluzade http://www.mahir-quluzade.com
Using Oracle Features in a Multitenant Environment
Recovery Manager - RMAN
 Backup CDB
RMAN> CONNECT TARGET SYS@CDB1
RMAN> BACKUP DATABASE PLUS ARCHIVELOG;
 Backup Pluggable Database
RMAN> CONNECT TARGET SYS@CDB1
RMAN> BACKUP PLUGGABLE DATABASE pdb1;
RMAN> BACKUP PLUGGABLE DATABASE pdb1, pdb2, pdb3;
 Point In Time Recovery
RMAN> ALTER PLUGGABLE DATABASE pdb5 CLOSE;
RMAN>run
{
SET UNTIL SCN 1066;
RESTORE PLUGGABLE DATABASE pdb5;
RECOVER PLUGGABLE DATABASE pdb5;
}
RMAN> ALTER PLUGGABLE DATABASE pdb5
OPEN RESETLOGS;
60 Mahir M. Quluzade http://www.mahir-quluzade.com
Using Oracle Features in a Multitenant Environment
Data Guard Configurations
 Data Guard Configuring on CDB
– Control Files
– Redo Logs
– Standby Redo Logs
– Archive Log Mode
– Flashback Logs
SQL> CREATE PLUGGABLE DATABASE …
STANDBYS= NONE | ALL [EXCEPT ('pdb_name', 'pdb_name', ...)]}
61 Mahir M. Quluzade http://www.mahir-quluzade.com
Using Oracle Features in a Multitenant Environment
Sharding
 Horizontal Partitioned Database
– Pluggable databases
 As Shards
 Shard catalogs
62 Mahir M. Quluzade http://www.mahir-quluzade.com
Oracle Multitenant 20c
63 Mahir M. Quluzade http://www.mahir-quluzade.com
Oracle Multitenant
 Non-CDB Architecture Deprecated/Desupported
– From Oracle database 12c version 12.1.0.2,
the non-CDB architecture is DEPRECATED
 In Oracle Database 20c the non-CDB architecture
will be DESUPPORTED
– “For all offerings, if you are not licensed for Oracle Multitenant, then you may
have up to 3 PDBs in a given container database at any time.”
Oracle Database 20c
64 Mahir M. Quluzade http://www.mahir-quluzade.com
Q&A
65 Mahir M. Quluzade http://www.mahir-quluzade.com
THANK YOU
#UKOUG
#TECHFEST2019
#PASSTHEKNOWLEDGE
66 Mahir M. Quluzade http://www.mahir-quluzade.com
Mahir M. Quluzade
@marzade
mahir.quluzade@gmail.com
http://www.mahir-quluzade.com
67 Mahir M. Quluzade http://www.mahir-quluzade.com
Baku, Azerbaijan

More Related Content

What's hot

Migration to Oracle Multitenant
Migration to Oracle MultitenantMigration to Oracle Multitenant
Migration to Oracle MultitenantJitendra Singh
 
Oracle RAC - New Generation
Oracle RAC - New GenerationOracle RAC - New Generation
Oracle RAC - New GenerationAnil Nair
 
The Top 5 Reasons to Deploy Your Applications on Oracle RAC
The Top 5 Reasons to Deploy Your Applications on Oracle RACThe Top 5 Reasons to Deploy Your Applications on Oracle RAC
The Top 5 Reasons to Deploy Your Applications on Oracle RACMarkus Michalewicz
 
Smart monitoring how does oracle rac manage resource, state ukoug19
Smart monitoring how does oracle rac manage resource, state ukoug19Smart monitoring how does oracle rac manage resource, state ukoug19
Smart monitoring how does oracle rac manage resource, state ukoug19Anil Nair
 
New availability features in oracle rac 12c release 2 anair ss
New availability features in oracle rac 12c release 2 anair   ssNew availability features in oracle rac 12c release 2 anair   ss
New availability features in oracle rac 12c release 2 anair ssAnil Nair
 
The Oracle RAC Family of Solutions - Presentation
The Oracle RAC Family of Solutions - PresentationThe Oracle RAC Family of Solutions - Presentation
The Oracle RAC Family of Solutions - PresentationMarkus Michalewicz
 
Oracle GoldenGate 21c New Features and Best Practices
Oracle GoldenGate 21c New Features and Best PracticesOracle GoldenGate 21c New Features and Best Practices
Oracle GoldenGate 21c New Features and Best PracticesBobby Curtis
 
Oracle 21c: New Features and Enhancements of Data Pump & TTS
Oracle 21c: New Features and Enhancements of Data Pump & TTSOracle 21c: New Features and Enhancements of Data Pump & TTS
Oracle 21c: New Features and Enhancements of Data Pump & TTSChristian Gohmann
 
What to Expect From Oracle database 19c
What to Expect From Oracle database 19cWhat to Expect From Oracle database 19c
What to Expect From Oracle database 19cMaria Colgan
 
Oracle Real Application Clusters 19c- Best Practices and Internals- EMEA Tour...
Oracle Real Application Clusters 19c- Best Practices and Internals- EMEA Tour...Oracle Real Application Clusters 19c- Best Practices and Internals- EMEA Tour...
Oracle Real Application Clusters 19c- Best Practices and Internals- EMEA Tour...Sandesh Rao
 
TFA Collector - what can one do with it
TFA Collector - what can one do with it TFA Collector - what can one do with it
TFA Collector - what can one do with it Sandesh Rao
 
Oracle Database performance tuning using oratop
Oracle Database performance tuning using oratopOracle Database performance tuning using oratop
Oracle Database performance tuning using oratopSandesh Rao
 
Introduction to Oracle Data Guard Broker
Introduction to Oracle Data Guard BrokerIntroduction to Oracle Data Guard Broker
Introduction to Oracle Data Guard BrokerZohar Elkayam
 
Oracle Real Application Clusters (RAC) 12c Rel. 2 - Operational Best Practices
Oracle Real Application Clusters (RAC) 12c Rel. 2 - Operational Best PracticesOracle Real Application Clusters (RAC) 12c Rel. 2 - Operational Best Practices
Oracle Real Application Clusters (RAC) 12c Rel. 2 - Operational Best PracticesMarkus Michalewicz
 
Oracle GoldenGate Performance Tuning
Oracle GoldenGate Performance TuningOracle GoldenGate Performance Tuning
Oracle GoldenGate Performance TuningBobby Curtis
 
Why oracle data guard new features in oracle 18c, 19c
Why oracle data guard new features in oracle 18c, 19cWhy oracle data guard new features in oracle 18c, 19c
Why oracle data guard new features in oracle 18c, 19cSatishbabu Gunukula
 
Exadata master series_asm_2020
Exadata master series_asm_2020Exadata master series_asm_2020
Exadata master series_asm_2020Anil Nair
 

What's hot (20)

Migration to Oracle Multitenant
Migration to Oracle MultitenantMigration to Oracle Multitenant
Migration to Oracle Multitenant
 
Oracle RAC - New Generation
Oracle RAC - New GenerationOracle RAC - New Generation
Oracle RAC - New Generation
 
Oracle ASM Training
Oracle ASM TrainingOracle ASM Training
Oracle ASM Training
 
Oracle Data Guard
Oracle Data GuardOracle Data Guard
Oracle Data Guard
 
The Top 5 Reasons to Deploy Your Applications on Oracle RAC
The Top 5 Reasons to Deploy Your Applications on Oracle RACThe Top 5 Reasons to Deploy Your Applications on Oracle RAC
The Top 5 Reasons to Deploy Your Applications on Oracle RAC
 
Smart monitoring how does oracle rac manage resource, state ukoug19
Smart monitoring how does oracle rac manage resource, state ukoug19Smart monitoring how does oracle rac manage resource, state ukoug19
Smart monitoring how does oracle rac manage resource, state ukoug19
 
New availability features in oracle rac 12c release 2 anair ss
New availability features in oracle rac 12c release 2 anair   ssNew availability features in oracle rac 12c release 2 anair   ss
New availability features in oracle rac 12c release 2 anair ss
 
The Oracle RAC Family of Solutions - Presentation
The Oracle RAC Family of Solutions - PresentationThe Oracle RAC Family of Solutions - Presentation
The Oracle RAC Family of Solutions - Presentation
 
Oracle GoldenGate 21c New Features and Best Practices
Oracle GoldenGate 21c New Features and Best PracticesOracle GoldenGate 21c New Features and Best Practices
Oracle GoldenGate 21c New Features and Best Practices
 
Oracle 21c: New Features and Enhancements of Data Pump & TTS
Oracle 21c: New Features and Enhancements of Data Pump & TTSOracle 21c: New Features and Enhancements of Data Pump & TTS
Oracle 21c: New Features and Enhancements of Data Pump & TTS
 
What to Expect From Oracle database 19c
What to Expect From Oracle database 19cWhat to Expect From Oracle database 19c
What to Expect From Oracle database 19c
 
Oracle Real Application Clusters 19c- Best Practices and Internals- EMEA Tour...
Oracle Real Application Clusters 19c- Best Practices and Internals- EMEA Tour...Oracle Real Application Clusters 19c- Best Practices and Internals- EMEA Tour...
Oracle Real Application Clusters 19c- Best Practices and Internals- EMEA Tour...
 
TFA Collector - what can one do with it
TFA Collector - what can one do with it TFA Collector - what can one do with it
TFA Collector - what can one do with it
 
Oracle Database performance tuning using oratop
Oracle Database performance tuning using oratopOracle Database performance tuning using oratop
Oracle Database performance tuning using oratop
 
Oracle RAC 12c Overview
Oracle RAC 12c OverviewOracle RAC 12c Overview
Oracle RAC 12c Overview
 
Introduction to Oracle Data Guard Broker
Introduction to Oracle Data Guard BrokerIntroduction to Oracle Data Guard Broker
Introduction to Oracle Data Guard Broker
 
Oracle Real Application Clusters (RAC) 12c Rel. 2 - Operational Best Practices
Oracle Real Application Clusters (RAC) 12c Rel. 2 - Operational Best PracticesOracle Real Application Clusters (RAC) 12c Rel. 2 - Operational Best Practices
Oracle Real Application Clusters (RAC) 12c Rel. 2 - Operational Best Practices
 
Oracle GoldenGate Performance Tuning
Oracle GoldenGate Performance TuningOracle GoldenGate Performance Tuning
Oracle GoldenGate Performance Tuning
 
Why oracle data guard new features in oracle 18c, 19c
Why oracle data guard new features in oracle 18c, 19cWhy oracle data guard new features in oracle 18c, 19c
Why oracle data guard new features in oracle 18c, 19c
 
Exadata master series_asm_2020
Exadata master series_asm_2020Exadata master series_asm_2020
Exadata master series_asm_2020
 

Similar to Oracle Multitenant 19c - All About Pluggable Databases

Oracle Multitenant - Oracle Ankara Day 2014
Oracle Multitenant - Oracle Ankara Day 2014Oracle Multitenant - Oracle Ankara Day 2014
Oracle Multitenant - Oracle Ankara Day 2014Mahir M. Quluzade
 
The first bug on Oracle Database 12c: how to create a pdb by cloning a remote...
The first bug on Oracle Database 12c: how to create a pdb by cloning a remote...The first bug on Oracle Database 12c: how to create a pdb by cloning a remote...
The first bug on Oracle Database 12c: how to create a pdb by cloning a remote...Marco Vigelini
 
Oracle12c Pluggable Database Hands On - TROUG 2014
Oracle12c Pluggable Database Hands On - TROUG 2014Oracle12c Pluggable Database Hands On - TROUG 2014
Oracle12c Pluggable Database Hands On - TROUG 2014Özgür Umut Vurgun
 
2-day-dba-oracle.pptx
2-day-dba-oracle.pptx2-day-dba-oracle.pptx
2-day-dba-oracle.pptxRocky572078
 
IOUG Collaborate 2015 - PDB Cloning Using SQL Commands
IOUG Collaborate 2015 - PDB Cloning Using SQL CommandsIOUG Collaborate 2015 - PDB Cloning Using SQL Commands
IOUG Collaborate 2015 - PDB Cloning Using SQL CommandsLeighton Nelson
 
12cR2 Single-Tenant: Multitenant Features for All Editions
12cR2 Single-Tenant: Multitenant Features for All Editions12cR2 Single-Tenant: Multitenant Features for All Editions
12cR2 Single-Tenant: Multitenant Features for All EditionsFranck Pachot
 
TechEvent 18c Multitenant New Features
TechEvent 18c Multitenant New FeaturesTechEvent 18c Multitenant New Features
TechEvent 18c Multitenant New FeaturesTrivadis
 
Security Multitenant
Security MultitenantSecurity Multitenant
Security MultitenantArush Jain
 
Oracle Multitenant - organized by Orient ITM - 12 Jul 2014
Oracle Multitenant - organized by  Orient ITM - 12 Jul 2014Oracle Multitenant - organized by  Orient ITM - 12 Jul 2014
Oracle Multitenant - organized by Orient ITM - 12 Jul 2014Mahir M. Quluzade
 
How Oracle Single/Multitenant will change a DBA's life
How Oracle Single/Multitenant will change a DBA's lifeHow Oracle Single/Multitenant will change a DBA's life
How Oracle Single/Multitenant will change a DBA's lifeGuatemala User Group
 
Schema replication using oracle golden gate 12c
Schema replication using oracle golden gate 12cSchema replication using oracle golden gate 12c
Schema replication using oracle golden gate 12cuzzal basak
 
OOW 17 - database consolidation using the oracle multitenant architecture
OOW 17 - database consolidation using the oracle multitenant architectureOOW 17 - database consolidation using the oracle multitenant architecture
OOW 17 - database consolidation using the oracle multitenant architecturePini Dibask
 
REST in Piece - Administration of an Oracle Cluster/Database using REST
REST in Piece - Administration of an Oracle Cluster/Database using RESTREST in Piece - Administration of an Oracle Cluster/Database using REST
REST in Piece - Administration of an Oracle Cluster/Database using RESTChristian Gohmann
 
Pluggable Databases: What they will break and why you should use them anyway!
Pluggable Databases: What they will break and why you should use them anyway!Pluggable Databases: What they will break and why you should use them anyway!
Pluggable Databases: What they will break and why you should use them anyway!Guatemala User Group
 
Oracle Multitenant Database 2.0 - Improvements in Oracle Database 12c Release 2
Oracle Multitenant Database 2.0 - Improvements in Oracle Database 12c Release 2Oracle Multitenant Database 2.0 - Improvements in Oracle Database 12c Release 2
Oracle Multitenant Database 2.0 - Improvements in Oracle Database 12c Release 2Markus Flechtner
 
Oracle Multitenant Database 2.0 - Improvements in Oracle Database 12c Release 2
Oracle Multitenant Database 2.0 - Improvements in Oracle Database 12c Release 2Oracle Multitenant Database 2.0 - Improvements in Oracle Database 12c Release 2
Oracle Multitenant Database 2.0 - Improvements in Oracle Database 12c Release 2Markus Flechtner
 
Setup oracle golden gate 11g replication
Setup oracle golden gate 11g replicationSetup oracle golden gate 11g replication
Setup oracle golden gate 11g replicationKanwar Batra
 
RMOUG 18 - Winning Performance Challenges in Oracle Multitenant
RMOUG 18 - Winning Performance Challenges in Oracle MultitenantRMOUG 18 - Winning Performance Challenges in Oracle Multitenant
RMOUG 18 - Winning Performance Challenges in Oracle MultitenantPini Dibask
 

Similar to Oracle Multitenant 19c - All About Pluggable Databases (20)

Oracle Multitenant - Oracle Ankara Day 2014
Oracle Multitenant - Oracle Ankara Day 2014Oracle Multitenant - Oracle Ankara Day 2014
Oracle Multitenant - Oracle Ankara Day 2014
 
Oracle 12c - Multitenant Feature
Oracle 12c - Multitenant FeatureOracle 12c - Multitenant Feature
Oracle 12c - Multitenant Feature
 
The first bug on Oracle Database 12c: how to create a pdb by cloning a remote...
The first bug on Oracle Database 12c: how to create a pdb by cloning a remote...The first bug on Oracle Database 12c: how to create a pdb by cloning a remote...
The first bug on Oracle Database 12c: how to create a pdb by cloning a remote...
 
Oracle12c Pluggable Database Hands On - TROUG 2014
Oracle12c Pluggable Database Hands On - TROUG 2014Oracle12c Pluggable Database Hands On - TROUG 2014
Oracle12c Pluggable Database Hands On - TROUG 2014
 
2-day-dba-oracle.pptx
2-day-dba-oracle.pptx2-day-dba-oracle.pptx
2-day-dba-oracle.pptx
 
IOUG Collaborate 2015 - PDB Cloning Using SQL Commands
IOUG Collaborate 2015 - PDB Cloning Using SQL CommandsIOUG Collaborate 2015 - PDB Cloning Using SQL Commands
IOUG Collaborate 2015 - PDB Cloning Using SQL Commands
 
12cR2 Single-Tenant: Multitenant Features for All Editions
12cR2 Single-Tenant: Multitenant Features for All Editions12cR2 Single-Tenant: Multitenant Features for All Editions
12cR2 Single-Tenant: Multitenant Features for All Editions
 
TechEvent 18c Multitenant New Features
TechEvent 18c Multitenant New FeaturesTechEvent 18c Multitenant New Features
TechEvent 18c Multitenant New Features
 
Security Multitenant
Security MultitenantSecurity Multitenant
Security Multitenant
 
Oracle Multitenant - organized by Orient ITM - 12 Jul 2014
Oracle Multitenant - organized by  Orient ITM - 12 Jul 2014Oracle Multitenant - organized by  Orient ITM - 12 Jul 2014
Oracle Multitenant - organized by Orient ITM - 12 Jul 2014
 
One PDB to go, please!
One PDB to go, please!One PDB to go, please!
One PDB to go, please!
 
How Oracle Single/Multitenant will change a DBA's life
How Oracle Single/Multitenant will change a DBA's lifeHow Oracle Single/Multitenant will change a DBA's life
How Oracle Single/Multitenant will change a DBA's life
 
Schema replication using oracle golden gate 12c
Schema replication using oracle golden gate 12cSchema replication using oracle golden gate 12c
Schema replication using oracle golden gate 12c
 
OOW 17 - database consolidation using the oracle multitenant architecture
OOW 17 - database consolidation using the oracle multitenant architectureOOW 17 - database consolidation using the oracle multitenant architecture
OOW 17 - database consolidation using the oracle multitenant architecture
 
REST in Piece - Administration of an Oracle Cluster/Database using REST
REST in Piece - Administration of an Oracle Cluster/Database using RESTREST in Piece - Administration of an Oracle Cluster/Database using REST
REST in Piece - Administration of an Oracle Cluster/Database using REST
 
Pluggable Databases: What they will break and why you should use them anyway!
Pluggable Databases: What they will break and why you should use them anyway!Pluggable Databases: What they will break and why you should use them anyway!
Pluggable Databases: What they will break and why you should use them anyway!
 
Oracle Multitenant Database 2.0 - Improvements in Oracle Database 12c Release 2
Oracle Multitenant Database 2.0 - Improvements in Oracle Database 12c Release 2Oracle Multitenant Database 2.0 - Improvements in Oracle Database 12c Release 2
Oracle Multitenant Database 2.0 - Improvements in Oracle Database 12c Release 2
 
Oracle Multitenant Database 2.0 - Improvements in Oracle Database 12c Release 2
Oracle Multitenant Database 2.0 - Improvements in Oracle Database 12c Release 2Oracle Multitenant Database 2.0 - Improvements in Oracle Database 12c Release 2
Oracle Multitenant Database 2.0 - Improvements in Oracle Database 12c Release 2
 
Setup oracle golden gate 11g replication
Setup oracle golden gate 11g replicationSetup oracle golden gate 11g replication
Setup oracle golden gate 11g replication
 
RMOUG 18 - Winning Performance Challenges in Oracle Multitenant
RMOUG 18 - Winning Performance Challenges in Oracle MultitenantRMOUG 18 - Winning Performance Challenges in Oracle Multitenant
RMOUG 18 - Winning Performance Challenges in Oracle Multitenant
 

Recently uploaded

Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...OnePlan Solutions
 
Intelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmIntelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmSujith Sukumaran
 
How to Track Employee Performance A Comprehensive Guide.pdf
How to Track Employee Performance A Comprehensive Guide.pdfHow to Track Employee Performance A Comprehensive Guide.pdf
How to Track Employee Performance A Comprehensive Guide.pdfLivetecs LLC
 
Folding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesFolding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesPhilip Schwarz
 
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...Cizo Technology Services
 
Introduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdfIntroduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdfFerryKemperman
 
Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Velvetech LLC
 
Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Hr365.us smith
 
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfGOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfAlina Yurenko
 
Buds n Tech IT Solutions: Top-Notch Web Services in Noida
Buds n Tech IT Solutions: Top-Notch Web Services in NoidaBuds n Tech IT Solutions: Top-Notch Web Services in Noida
Buds n Tech IT Solutions: Top-Notch Web Services in Noidabntitsolutionsrishis
 
PREDICTING RIVER WATER QUALITY ppt presentation
PREDICTING  RIVER  WATER QUALITY  ppt presentationPREDICTING  RIVER  WATER QUALITY  ppt presentation
PREDICTING RIVER WATER QUALITY ppt presentationvaddepallysandeep122
 
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样umasea
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEOrtus Solutions, Corp
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxTier1 app
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...stazi3110
 
React Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaReact Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaHanief Utama
 
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...Natan Silnitsky
 
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...Matt Ray
 

Recently uploaded (20)

Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
 
Intelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmIntelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalm
 
How to Track Employee Performance A Comprehensive Guide.pdf
How to Track Employee Performance A Comprehensive Guide.pdfHow to Track Employee Performance A Comprehensive Guide.pdf
How to Track Employee Performance A Comprehensive Guide.pdf
 
Folding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesFolding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a series
 
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
 
Introduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdfIntroduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdf
 
Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...
 
Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)
 
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfGOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
 
Buds n Tech IT Solutions: Top-Notch Web Services in Noida
Buds n Tech IT Solutions: Top-Notch Web Services in NoidaBuds n Tech IT Solutions: Top-Notch Web Services in Noida
Buds n Tech IT Solutions: Top-Notch Web Services in Noida
 
PREDICTING RIVER WATER QUALITY ppt presentation
PREDICTING  RIVER  WATER QUALITY  ppt presentationPREDICTING  RIVER  WATER QUALITY  ppt presentation
PREDICTING RIVER WATER QUALITY ppt presentation
 
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
 
2.pdf Ejercicios de programación competitiva
2.pdf Ejercicios de programación competitiva2.pdf Ejercicios de programación competitiva
2.pdf Ejercicios de programación competitiva
 
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort ServiceHot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
 
React Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaReact Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief Utama
 
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
 
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
 

Oracle Multitenant 19c - All About Pluggable Databases

  • 1. Oracle Multitenant 19c - All About Pluggable Databases Mahir M. Quluzade Central Bank of Azerbaijan #UKOUG #TECHFEST2019 #PASSTHEKHOWLEDGE Baku, Azerbaijan
  • 2. 2 Mahir M. Quluzade http://www.mahir-quluzade.com Mahir M. Quluzade  Oracle ACE  Board Member of Azerbaijan Oracle User Group (@AzerbaijanOUG)  Board Member of International Data Guard Oracle User Group (@idgoug)  Oracle Database Architect at Central Bank of Azerbaijan  Blogger since 2011 : http://www.mahir-quluzade.com @marzade
  • 3. 3 Mahir M. Quluzade http://www.mahir-quluzade.com Azerbaijan Oracle User Group @AzerbaijanOUG  Azerbaijan Oracle Users Group  Founded June 2012  Organized many international conferences, also local events @AzerbaijanOUG
  • 4. 4 Mahir M. Quluzade http://www.mahir-quluzade.com Traditional Oracle Database Architecture
  • 5. 5 Mahir M. Quluzade http://www.mahir-quluzade.com Oracle Database Architecture Pre-12c Oracle Database  Oracle Instance – SGA & PGA – Background Processes  Oracle Database – Control Files – Data Files – Redo Logs (Online and Archived) – Parameter and Password file
  • 6. 6 Mahir M. Quluzade http://www.mahir-quluzade.com Container Databases SQL> CREATE DATABASE ... ENABLE PLUGGABLE DATABASE
  • 7. 7 Mahir M. Quluzade http://www.mahir-quluzade.com Create as Container Database CREATE DATABASE cdb1 DATAFILE '/u01/app/oracle/oradata/cdb1/system01.dbf' SIZE 700M REUSE AUTOEXTEND ON NEXT 10240K MAXSIZE UNLIMITED EXTENT MANAGEMENT LOCAL SYSAUX DATAFILE '/u01/app/oracle/oradata/cdb1/sysaux01.dbf' SIZE 550M REUSE AUTOEXTEND ON NEXT 10240K MAXSIZE UNLIMITED SMALLFILE DEFAULT TEMPORARY TABLESPACE TEMP TEMPFILE '/u01/app/oracle/oradata/cdb1/temp01.dbf' SIZE 20M REUSE AUTOEXTEND ON NEXT 640K MAXSIZE UNLIMITED SMALLFILE UNDO TABLESPACE "UNDOTBS1" DATAFILE '/u01/app/oracle/oradata/cdb1/undotbs01.dbf' SIZE 200M REUSE AUTOEXTEND ON NEXT 5120K MAXSIZE UNLIMITED CHARACTER SET AL32UTF8 NATIONAL CHARACTER SET AL16UTF16 LOGFILE GROUP 1 ('/u01/app/oracle/oradata/cdb1/redo01.log') SIZE 50M, GROUP 2 ('/u01/app/oracle/oradata/cdb1/redo02.log') SIZE 50M, GROUP 3 ('/u01/app/oracle/oradata/cdb1/redo03.log') SIZE 50M USER SYS IDENTIFIED BY "&&sysPassword" USER SYSTEM IDENTIFIED BY "&&systemPassword" ENABLE PLUGGABLE DATABASE …;
  • 8. 8 Mahir M. Quluzade http://www.mahir-quluzade.com Oracle Database Architecture Multitenant Architecture – 19c  Oracle Multitenant Option – Root Container (CDB$ROOT) – Seed PDB (PDB$SEED) – Application Root  Application Seed  Application PDBS – Pluggable Database (PDBs)
  • 9. 9 Mahir M. Quluzade http://www.mahir-quluzade.com Oracle Database Architecture Multitenant Architecture – 19c  CDB with No Application Containers – Each PDB has its own dedicated application – A different PDB administrator manages each PDB – At the physical level, this CDB has a database instance and database files, just as a non-CDB does
  • 10. 10 Mahir M. Quluzade http://www.mahir-quluzade.com Oracle Database Architecture Multitenant Architecture – 19c  CDB with an Application Container – A CDB administrator manages the CDB itself. – An application container administrator manages the application container, including application installation and upgrades. – A PDB administrator manages hrpdb.
  • 11. 11 Mahir M. Quluzade http://www.mahir-quluzade.com Container Databases  System metadata required to manage PDBs  Does not store user data  Only for common users  Automatically created tablespaces – SYSTEM, SYSAUX, TEMP, UNDO  Oracle recommends AL32UTF8 for the root character set CDB Root - CDB$ROOT
  • 12. 12 Mahir M. Quluzade http://www.mahir-quluzade.com Container Databases  Template for the creation of PDBs  Created in all CDB  Automatically created – SYSTEM – SYSAUX – TEMP – UNDO  PDBs with different character sets can reside in the same CDB without requiring character set conversion Seed PDB - PDB$SEED
  • 13. 13 Mahir M. Quluzade http://www.mahir-quluzade.com Container Databases  Is an optional user-created CDB component – Stores data and metadata for application – A CDB includes zero or more application containers.. – The application root stores metadata and data that all application PDBs can share. – CREATE PLUGGABLE DATABASE statement with the AS APPLICATION CONTAINER clause Application Container
  • 14. 14 Mahir M. Quluzade http://www.mahir-quluzade.com Container Databases  PDB is a user-created – set of schemas, objects – related structures that appears logically to a client application as a separate database.  PDB is – owned by SYS regardless of which user created the PDB SYS is a common user in the CDB. Standard PDB
  • 15. 15 Mahir M. Quluzade http://www.mahir-quluzade.com Pluggable Databases SQL> CREATE PLUGGABLE DATABASE ...
  • 16. 16 Mahir M. Quluzade http://www.mahir-quluzade.com Creating a PDB Creating from Scratch Cloning Relocation Plugging In Referencing as a Proxy PDB Locally Remotely From a PDB From a Non-CDB Plugging in a Unplugged PDB Adopting a Non-CDB as a PDB
  • 17. 17 Mahir M. Quluzade http://www.mahir-quluzade.com Pluggable Databases Creating a PDB from Scratch
  • 18. 18 Mahir M. Quluzade http://www.mahir-quluzade.com Pluggable Databases  CDB1 $ sqlplus sys@cdb1 sys as sysdba SQL> ALTER SYSTEM SET db_create_file_dest = '/u01/app/oracle/oradata'; SQL> CREATE PLUGGABLE DATABASE pdb1 ADMIN USER pdb1adm IDENTIFIED BY *******; OR SQL> CREATE PLUGGABLE DATABASE pdb1 ADMIN USER pdb1adm IDENTIFIED BY ******* 2 CREATE_FILE_DEST='/u01/app/oracle/oradata'; OR SQL> CREATE PLUGGABLE DATABASE repotestpdb ADMIN USER pdbadm IDENTIFIED BY ******* FILE_NAME_CONVERT=('/u01/app/oracle/oradata/cdb1/pdbseed/','/u01/app/oracle/oradata/cdb1/pdb2/'); OR SQL> ALTER SESSION SET PDB_FILE_NAME_CONVERT='/u01/app/oracle/oradata/cdb1/pdbseed/' ,'/u01/app/oracle/oradata/cdb1/pdb3/'; SQL> CREATE PLUGGABLE DATABASE pdb3 ADMIN USER pdb_adm IDENTIFIED BY Password1 ROLES=(DBA); You must open the new PDB in read/write mode for Oracle Database to complete the integration of the new PDB into the CDB. Creating a PDB from Scratch
  • 19. 19 Mahir M. Quluzade http://www.mahir-quluzade.com Pluggable Databases Locally Cloning a PDB
  • 20. 20 Mahir M. Quluzade http://www.mahir-quluzade.com Pluggable Databases  CDB1 $ sqlplus sys@cdb1 sys as sysdba SQL> ALTER PLUGGABLE DATABASE PDB1 CLOSE; SQL> ALTER PLUGGABLE DATABASE PDB1 OPEN READ ONLY; SQL> CREATE PLUGGABLE DATABASE PDB2 FROM PDB1 2 STORAGE UNLIMITED TEMPFILE REUSE 3 FILE_NAME_CONVERT=('/u01/app/oracle/oradata/cdb1/pdb1/', '/u01/app/oracle/oradata/cdb1/pdb2');  PDB is in LOCAL UNDO MODE - HOT CLONING SQL> CREATE PLUGGABLE DATABASE PDB3 FROM PDB1 2 STORAGE UNLIMITED TEMPFILE REUSE 3 FILE_NAME_CONVERT=('/u01/app/oracle/oradata/cdb1/pdb1/', '/u01/app/oracle/oradata/cdb1/pdb3'); Locally Cloning a PDB
  • 21. 21 Mahir M. Quluzade http://www.mahir-quluzade.com Pluggable Databases Remotely Cloning a PDB
  • 22. 22 Mahir M. Quluzade http://www.mahir-quluzade.com Pluggable Databases  CDB1 $ sqlplus sys@cdb1 sys as sysdba SQL> CREATE USER c##remote_clone_user IDENTIFIED BY remote_clone_user CONTAINER=ALL; SQL> GRANT CREATE SESSION, CREATE PLUGGABLE DATABASE TO c##remote_clone_user CONTAINER=ALL; SQL> SELECT property_name, property_value FROM database_properties WHERE property_name = 'LOCAL_UNDO_ENABLED'; PROPERTY_NAME PROPERTY_VALUE ------------------------------ ------------------------------ LOCAL_UNDO_ENABLED TRUE  CDB2 $ sqlplus sys@cdb2 sys as sysdba SQL> CREATE DATABASE LINK clone_link CONNECT TO c##remote_clone_user IDENTIFIED BY remote_clone_user USING 'CDB1'; SQL> CREATE PLUGGABLE DATABASE PDB1CLONE FROM PDB1@clone_link; SQL> SELECT name, open_mode FROM v$pdbs WHERE name = 'PDB1CLONE'; NAME OPEN_MODE ------------------------------ ---------- PDB1CLONE MOUNTED  In local undo mode and archivelog mode, we don't need to turn the remote database into read-only mode Remotely Cloning a PDB
  • 23. 23 Mahir M. Quluzade http://www.mahir-quluzade.com Pluggable Databases Remotely Cloning a PDB - From a Non-CDB
  • 24. 24 Mahir M. Quluzade http://www.mahir-quluzade.com Pluggable Databases  DB19C NON-CDB $ sqlplus sys@db19c sys as sysdba SQL> CREATE USER c##remote_clone_user IDENTIFIED BY remote_clone_user; SQL> GRANT CREATE SESSION, CREATE PLUGGABLE DATABASE TO c##remote_clone_user; SQL> SELECT log_mode FROM v$database; LOG_MODE ------------ ARCHIVELOG  CDB1 $ sqlplus sys@cdb1 sys as sysdba SQL> CREATE DATABASE LINK clone_link CONNECT TO c##remote_clone_user IDENTIFIED BY remote_clone_user USING 'DB19C'; SQL> CREATE PLUGGABLE DATABASE DB19CPDB FROM NON$CDB@clone_link; SQL> SELECT name, open_mode FROM v$pdbs WHERE name = 'DB19CPDB'; NAME OPEN_MODE ------------------------------ ---------- DB19CPDB MOUNTED Remotely Cloning a PDB - From a Non-CDB
  • 25. 25 Mahir M. Quluzade http://www.mahir-quluzade.com Pluggable Databases Relocating a PDB
  • 26. 26 Mahir M. Quluzade http://www.mahir-quluzade.com Pluggable Databases  CDB1 SQL> CREATE USER c##remote_clone_user IDENTIFIED BY remote_clone_user CONTAINER=ALL; SQL> GRANT CREATE SESSION, CREATE PLUGGABLE DATABASE TO c##remote_clone_user CONTAINER=ALL; SQL> SELECT property_name, property_value FROM database_properties 2 WHERE property_name = 'LOCAL_UNDO_ENABLED‘ PROPERTY_NAME PROPERTY_VALUE ------------------------------ ------------------------------ LOCAL_UNDO_ENABLED TRUE  CDB2 SQL> CREATE DATABASE LINK clone_link CONNECT TO c##remote_clone_user IDENTIFIED BY remote_clone_user USING 'CDB1'; SQL> CREATE PLUGGABLE DATABASE PDB1CLONE FROM PDB1@clone_link RELOCATE; SQL> SELECT name, open_mode FROM v$pdbs WHERE name = 'PDB1CLONE'; NAME OPEN_MODE ------------------------------ ---------- PDB1CLONE MOUNTED  In local undo mode and archivelog mode, we don't need to turn the remote database into read-only mode Remotely Cloning a PDB
  • 27. 27 Mahir M. Quluzade http://www.mahir-quluzade.com Pluggable Databases Plugging In an Unplugged PDB
  • 28. 28 Mahir M. Quluzade http://www.mahir-quluzade.com Pluggable Databases UNPLUG SQL> CONNECT SYS@CDB1 AS SYSDBA SQL> ALTER PLUGGABLE DATABASE pdb1 CLOSE; SQL> ALTER PLUGGABLE DATABASE pdb1 UNPLUG INTO '/u01/app/oracle/oradata/cdb1/pdb1/pdb1.xml'; OR SQL> ALTER PLUGGABLE DATABASE pdb1 UNPLUG INTO '/u01/app/oracle/oradata/cdb1/pdb1/pdb1.pdb'; PLUG-IN SQL> CONNECT SYS@CDB2 as sysdba SQL> CREATE PLUGGABLE DATABASE pdb2 USING '/u01/app/oracle/oradata/cdb2/pdb2/pdb1.xml' 2 FILE_NAME_CONVERT=('/u01/app/oracle/oradata/cdb1/pdb1/','/u01/app/oracle/oradata/cdb2/pdb2/'); OR SQL> CREATE PLUGGABLE DATABASE pdb2 USING '/u01/app/oracle/oradata/cdb2/pdb2/pdb1.pdb' 2 FILE_NAME_CONVERT=('/u01/app/oracle/oradata/cdb1/pdb1/','/u01/app/oracle/oradata/cdb2/pdb2/'); SQL> ALTER PLUGGABLE DATABASE pdb2 OPEN READ WRITE; Plugging In an Unplugged PDB
  • 29. 29 Mahir M. Quluzade http://www.mahir-quluzade.com Pluggable Databases Adopting a Non-CDB as a PDB
  • 30. 30 Mahir M. Quluzade http://www.mahir-quluzade.com Pluggable Databases  DB19C NON-CDB sqlplus / as sysdba – SQL> shutdown immediate – SQL> startup mount exclusive – SQL> alter database open read only; – SQL> exec dbms_pdb.describe(pdb_descr_file=>'/u01/app/oracle/oradata/db19cnoncdb/noncdb.xml'); – SQL> shutdown immediate  CDB1 sqlplus / as sysdba – SQL> create pluggable database db19cpdb as clone using '/ u01/app/oracle/oradata/db19cnoncdb/noncdb.xml' 2 file_name_convert=('/u01/app/oracle/oradata/db19cnoncdb','/u01/app/oracle/oradata/db19cpdb') copy; – SQL> alter pluggable database db19cpdb open; sqlplus sys@db19cpdb as sysdba – SQL> @$ORACLE_HOME/rdbms/admin/noncdb_to_pdb.sql Adopting a Non-CDB as a PDB
  • 31. 31 Mahir M. Quluzade http://www.mahir-quluzade.com Pluggable Databases Creating a PDB as a Proxy PDB
  • 32. 32 Mahir M. Quluzade http://www.mahir-quluzade.com Pluggable Databases  CDB1 – SQL> CREATE USER c##remote_clone_user IDENTIFIED BY remote_clone_user CONTAINER=ALL; – SQL> GRANT CREATE SESSION, CREATE PLUGGABLE DATABASE TO c##remote_clone_user CONTAINER=ALL;  CDB2 – SQL> CREATE DATABASE LINK clone_link CONNECT TO c##remote_clone_user IDENTIFIED BY remote_clone_user USING 'CDB1'; – SQL> CREATE PLUGGABLE DATABASE PDB1PROXY AS PROXY FROM pdb1@clone_link; – SQL> ALTER PLUGGABLE DATABASE PDB1PROXY OPEN; – SQL> SELECT name, open_mode FROM v$pdbs WHERE name = 'PDB1PROXY'; NAME OPEN_MODE ------------------------------ ---------- PDB1PROXY READ WRITE Creating a PDB as a Proxy PDB
  • 33. 33 Mahir M. Quluzade http://www.mahir-quluzade.com Pluggable Databases Refreshable PDB
  • 34. 34 Mahir M. Quluzade http://www.mahir-quluzade.com Pluggable Databases  CDB1 – SQL> CREATE USER c##remote_clone_user IDENTIFIED BY remote_clone_user CONTAINER=ALL; – SQL> GRANT CREATE SESSION, CREATE PLUGGABLE DATABASE TO c##remote_clone_user CONTAINER=ALL; – SQL> SELECT property_name, property_value FROM database_properties 2 WHERE property_name = 'LOCAL_UNDO_ENABLED'; PROPERTY_NAME PROPERTY_VALUE ------------------------------ ------------------------------ LOCAL_UNDO_ENABLED TRUE  CDB2 – SQL> CREATE DATABASE LINK clone_link CONNECT TO c##remote_clone_user IDENTIFIED BY remote_clone_user USING 'CDB1'; – SQL> CREATE PLUGGABLE DATABASE PDB1RO FROM pdb1@clone_link REFRESH MODE MANUAL;; – SQL> SELECT name, open_mode FROM v$pdbs WHERE name = 'PDB1RO'; NAME OPEN_MODE ------------------------------ ---------- PDB1RO READ ONLY – SQL> ALTER PLUGGABLE DATABASE PDB1RO REFRESH MODE EVERY 60 MINUTES; – SQL> ALTER PLUGGABLE DATABASE PDB1RO REFRESH MODE EVERY 120 MINUTES; Refreshable PDB
  • 35. 35 Mahir M. Quluzade http://www.mahir-quluzade.com Pluggable Databases Refreshable PDB Switchover
  • 36. 36 Mahir M. Quluzade http://www.mahir-quluzade.com Pluggable Databases  CDB1 – SQL> CREATE DATABASE LINK clone_link CONNECT TO c##remote_clone_user IDENTIFIED BY remote_clone_user USING 'CDB2'; – SQL> ALTER SESSION SET CONTAINER = PDB1; – SQL> ALTER PLUGGABLE DATABASE REFRESH MODE MANUAL 2 FROM PDB1RO@clone_link 3 SWITCHOVER;  CDB2 – SQL> CREATE DATABASE LINK clone_link CONNECT TO c##remote_clone_user IDENTIFIED BY remote_clone_user USING 'CDB1'; – SQL> ALTER SESSION SET CONTAINER = PDB1RO; – SQL> ALTER PLUGGABLE DATABASE REFRESH MODE MANUAL 2 FROM PDB1@clone_link 3 SWITCHOVER; Refreshable PDB Switchover
  • 37. 37 Mahir M. Quluzade http://www.mahir-quluzade.com Pluggable Databases Creating Application Containers
  • 38. 38 Mahir M. Quluzade http://www.mahir-quluzade.com Pluggable Databases Creating Application Containers  CDB1 $ sqlplus sys@cdb1 sys as sysdba SQL> ALTER SYSTEM SET db_create_file_dest = '/u01/app/oracle/oradata'; SQL> CREATE PLUGGABLE DATABASE appcon1 AS APPLICATION CONTAINER ADMIN USER adm IDENTIFIED BY *****; SQL> ALTER PLUGGABLE DATABASE appcon1 OPEN; SQL> ALTER SESSION SET CONTAINER = appcon1; SQL> CREATE PLUGGABLE DATABASE apppdb1 ADMIN USER adm IDENTIFIED BY ***** SQL> ALTER PLUGGABLE DATABASE apppdb1 OPEN;
  • 39. 39 Mahir M. Quluzade http://www.mahir-quluzade.com Pluggable Databases Creating Application Containers  CDB1 $ sqlplus sys@cdb1 sys as sysdba SQL> ALTER SYSTEM SET db_create_file_dest = '/u01/app/oracle/oradata'; SQL> CREATE PLUGGABLE DATABASE appcon1 AS APPLICATION CONTAINER ADMIN USER adm IDENTIFIED BY *****; SQL> ALTER PLUGGABLE DATABASE appcon1 OPEN; SQL> ALTER SESSION SET CONTAINER = appcon1; SQL> CREATE PLUGGABLE DATABASE apppdb1 ADMIN USER adm IDENTIFIED BY ***** SQL> ALTER PLUGGABLE DATABASE apppdb1 OPEN;
  • 40. 40 Mahir M. Quluzade http://www.mahir-quluzade.com Pluggable Databases Installing Applications  CDB1 $ sqlplus sys@cdb1 sys as sysdba SQL> ALTER SESSION SET CONTAINER = appcon1; SQL> ALTER PLUGGABLE DATABASE APPLICATION app1 BEGIN INSTALL '1.0'; SQL> CREATE TABLESPACE … SQL> CREATE USER … SQL> GRANT CREATE SESSION, CREATE TABLE TO … SQL> CREATE TABLE … SQL> INSERT INTO … … SQL> ALTER PLUGGABLE DATABASE APPLICATION app1 END INSTALL; SQL> ALTER SESSION SET CONTAINER = apppdb1; SQL> ALTER PLUGGABLE DATABASE APPLICATION app1 SYNC;
  • 41. 41 Mahir M. Quluzade http://www.mahir-quluzade.com Pluggable Databases Snapshot Carousel PDB
  • 42. 42 Mahir M. Quluzade http://www.mahir-quluzade.com Pluggable Databases  Library of PDB snapshots – PDB snapshot is a point-in-time copy of a PDB – Maximum number of snapshots MAX_PDB_SNAPSHOTS = 8 (default)  NONE : The PDB does not support snapshots.  MANUAL : The PDB supports snapshots, but they are only created manually requested.  EVERY n HOURS : A snapshot is automatically created every "n" hours. Where "n" is between 1 and 1999.  EVERY n MINUTES : A snapshot is automatically created every "n" minutes. Where "n" is between 1 and 2999. SQL> CONNECT / AS SYSDBA SQL> CREATE PLUGGABLE DATABASE PDB2 ADMIN USER PDBADMIN IDENTIFIED BY *********** FILE_NAME_CONVERT=('pdbseed','pdb2') SNAPSHOT MODE EVERY 24 HOURS; SQL> ALTER PLUGGABLE DATABASE PDB2 OPEN; SQL> ALTER PLUGGABLE DATABASE PDB2 SAVE STATE; Snapshot Carousel PDB
  • 43. 43 Mahir M. Quluzade http://www.mahir-quluzade.com Pluggable Databases SQL> SELECT con_id, con_name,snapshot_name, snapshot_scn, full_snapshot_path 2 FROM cdb_pdb_snapshots 3 ORDER BY con_id, snapshot_scn; CON_ID CON_NAME SNAPSHOT_NAME SNAPSHOT_SCN FULL_SNAPSHOT_PATH ---------- ---------- ------------------------------ ------------ ------------------------------------------- 4 PDB2 SNAP_688979926_996491289 1764864 /u02/oradata/snap_688979926_1764864.pdb  Recovering From a PDB Snapshot SQL> CREATE PLUGGABLE DATABASE PDB2COPY FROM pdb2 USING SNAPSHOT SNAP_688979926_996491631; OR SQL> CREATE PLUGGABLE DATABASE PDB2COPY FROM pdb2 USING SNAPSHOT SNAP_688979926_996491631 SNAPSHOT MODE EVERY 24 HOURS; SQL> ALTER PLUGGABLE DATABASE DROP SNAPSHOT SNAP_688979926_996491289; Snapshot Carousel PDB
  • 44. 44 Mahir M. Quluzade http://www.mahir-quluzade.com Pluggable Databases Container Database (CDB) Fleet Management
  • 45. 45 Mahir M. Quluzade http://www.mahir-quluzade.com Pluggable Databases  CDB1 - LEAD SQL> CONN sys/SysPassword1@cdb1 AS SYSDBA SQL> ALTER DATABASE SET lead_cdb = TRUE; SQL> SELECT property_name, property_value FROM database_properties WHERE property_name = 'LEAD_CDB'; PROPERTY_NAME PROPERTY_VALUE ------------------------------ ------------------------------ LEAD_CDB TRUE SQL> CREATE USER c##cdb_fleet_link_user IDENTIFIED BY cdb_fleet_link_user; SQL> GRANT CREATE SESSION TO c##cdb_fleet_link_user; Container Database (CDB) Fleet Management – Lead CDB
  • 46. 46 Mahir M. Quluzade http://www.mahir-quluzade.com Pluggable Databases Container Database (CDB) Fleet Management – Members CDB  CDB2 - MEMBER SQL> CONN sys/SysPassword1@cdb2 AS SYSDBA SQL> CREATE PUBLIC DATABASE LINK lead_cdb_link CONNECT TO c##cdb_fleet_link_user IDENTIFIED BY cdb_fleet_link_user USING 'cdb1'; SQL> ALTER DATABASE SET lead_cdb_uri = 'dblink:LEAD_CDB_LINK'; SQL> SELECT property_value FROM database_properties WHERE property_name = 'LEAD_CDB_URI'; PROPERTY_VALUE -------------------------- dblink:LEAD_CDB_LINK  CDB3 - MEMBER SQL> CONN sys/SysPassword1@cdb2 AS SYSDBA SQL> CREATE PUBLIC DATABASE LINK lead_cdb_link CONNECT TO c##cdb_fleet_link_user IDENTIFIED BY cdb_fleet_link_user USING 'cdb1'; SQL> ALTER DATABASE SET lead_cdb_uri = 'dblink:LEAD_CDB_LINK'; SQL> SELECT property_value FROM database_properties WHERE property_name = 'LEAD_CDB_URI'; PROPERTY_VALUE -------------------------- dblink:LEAD_CDB_LINK
  • 47. 47 Mahir M. Quluzade http://www.mahir-quluzade.com Pluggable Databases  LEAD CDB1 SQL> CONN sys/SysPassword1@cdb1 AS SYSDBA SQL> SELECT con_id, 2 name, 3 open_mode, 4 proxy_pdb 5 FROM v$pdbs 6 ORDER BY name; CON_ID NAME OPEN_MODE PROXY_PDB ---------- ------------------------------ ---------- ---------- 2 PDB$SEED READ ONLY NO 3 PDB1 READ WRITE NO 5 PDB4 MOUNTED YES 7 PDB5 MOUNTED YES Container Database (CDB) Fleet Management – LEAD CDB
  • 48. 48 Mahir M. Quluzade http://www.mahir-quluzade.com Pluggable Databases Removing a PDB
  • 49. 49 Mahir M. Quluzade http://www.mahir-quluzade.com Pluggable Databases  SQL> CONNECT sys@CDB1 AS SYSDBA  SQL> ALTER PLUGGABLE DATABASE pdb1 CLOSE;  SQL> DROP PLUGGABLE DATABASE PDB1 INCLUDING DATAFILES; OR  SQL> DROP PLUGGABLE DATABASE PDB1 KEEP DATAFILES;  If a PDB was created with the SNAPSHOT COPY clause, then you must specify INCLUDING DATAFILES when you drop the PDB Removing a PDB
  • 50. 50 Mahir M. Quluzade http://www.mahir-quluzade.com Administering a Multitenant Environment
  • 51. 51 Mahir M. Quluzade http://www.mahir-quluzade.com Administering a Multitenant Environment  DBCA supporting manage container database – Manage Pluggable Database  Create a Pluggable Database  Delete a Pluggable Database  Unplug a Pluggable Database  Configure a Pluggable Database – It also enables you to create, relocate, clone, plug in, and unplug PDBs  Silent mode Using DBCA
  • 52. 52 Mahir M. Quluzade http://www.mahir-quluzade.com Administering a Multitenant Environment  Common User : The user is present in all containers (root and all PDBs). SQL> CONNECT SYS@CDB1 AS SYSDBA – Create the common user using the CONTAINER clause. SQL> CREATE USER c##test_user1 IDENTIFIED BY password1 CONTAINER=ALL; SQL> GRANT CREATE SESSION TO c##test_user1 CONTAINER=ALL; – Create the common user using the default CONTAINER setting. SQL> CREATE USER c##test_user2 IDENTIFIED BY password1; SQL> GRANT CREATE SESSION TO c##test_user2; Users in CDB
  • 53. 53 Mahir M. Quluzade http://www.mahir-quluzade.com Administering a Multitenant Environment  Local User : The user is only present in a specific PDB – The same username can be present in multiple PDBs, but they are unrelated SQL> CONNECT SYS@CDB1 AS SYSDBA SQL> ALTER SESSION SET CONTAINER = pdb1; – Create the local user using the CONTAINER clause. SQL> CREATE USER test_user3 IDENTIFIED BY password1 CONTAINER=CURRENT; SQL> GRANT CREATE SESSION TO test_user3 CONTAINER=CURRENT; – Create the local user using the default CONTAINER setting SQL> CONNECT system/password@pdb1 SQL> CREATE USER test_user4 IDENTIFIED BY password1; SQL> GRANT CREATE SESSION TO test_user4; Users in PDB
  • 54. 54 Mahir M. Quluzade http://www.mahir-quluzade.com Administering a Multitenant Environment  Common Role : The role is present in all containers (root and all PDBs) SQL> CONN / AS SYSDBA – Create the common role SQL> CREATE ROLE c##test_role1; SQL> GRANT CREATE SESSION TO c##test_role1; – Grant it to a common user. GRANT c##test_role1 TO c##test_user1 CONTAINER=ALL; – Grant it to a local user. SQL> ALTER SESSION SET CONTAINER = pdb1; SQL> GRANT c##test_role1 TO test_user3; Roles in CDB
  • 55. 55 Mahir M. Quluzade http://www.mahir-quluzade.com Administering a Multitenant Environment  Local Role : The role is only present in a specific PDB. – The same role name can be used in multiple PDBs, but they are unrelated. SQL> CONN / AS SYSDBA – Switch container. SQL> ALTER SESSION SET CONTAINER = pdb1; – Alternatively, connect to a local or common user with the PDB service SQL> CONN system/password@pdb1 – Create the common role SQL> CREATE ROLE test_role1; SQL> GRANT CREATE SESSION TO test_role1; – Grant it to a common and local user SQL> GRANT test_role1 TO c##test_user1; SQL> GRANT test_role1 TO test_user3; Roles in PDB
  • 56. 56 Mahir M. Quluzade http://www.mahir-quluzade.com Administering a Multitenant Environment Connecting to CDB  Using SID  Using TNSNAMES and EZCONNECT
  • 57. 57 Mahir M. Quluzade http://www.mahir-quluzade.com Administering a Multitenant Environment Connecting to PDB  Using TNSNAMES and EZCONNECT  Using ALTER SESSION SET CONTAINER  Can’t use SID for connecting to PDB
  • 58. 58 Mahir M. Quluzade http://www.mahir-quluzade.com Using Oracle Features in a Multitenant Environment
  • 59. 59 Mahir M. Quluzade http://www.mahir-quluzade.com Using Oracle Features in a Multitenant Environment Recovery Manager - RMAN  Backup CDB RMAN> CONNECT TARGET SYS@CDB1 RMAN> BACKUP DATABASE PLUS ARCHIVELOG;  Backup Pluggable Database RMAN> CONNECT TARGET SYS@CDB1 RMAN> BACKUP PLUGGABLE DATABASE pdb1; RMAN> BACKUP PLUGGABLE DATABASE pdb1, pdb2, pdb3;  Point In Time Recovery RMAN> ALTER PLUGGABLE DATABASE pdb5 CLOSE; RMAN>run { SET UNTIL SCN 1066; RESTORE PLUGGABLE DATABASE pdb5; RECOVER PLUGGABLE DATABASE pdb5; } RMAN> ALTER PLUGGABLE DATABASE pdb5 OPEN RESETLOGS;
  • 60. 60 Mahir M. Quluzade http://www.mahir-quluzade.com Using Oracle Features in a Multitenant Environment Data Guard Configurations  Data Guard Configuring on CDB – Control Files – Redo Logs – Standby Redo Logs – Archive Log Mode – Flashback Logs SQL> CREATE PLUGGABLE DATABASE … STANDBYS= NONE | ALL [EXCEPT ('pdb_name', 'pdb_name', ...)]}
  • 61. 61 Mahir M. Quluzade http://www.mahir-quluzade.com Using Oracle Features in a Multitenant Environment Sharding  Horizontal Partitioned Database – Pluggable databases  As Shards  Shard catalogs
  • 62. 62 Mahir M. Quluzade http://www.mahir-quluzade.com Oracle Multitenant 20c
  • 63. 63 Mahir M. Quluzade http://www.mahir-quluzade.com Oracle Multitenant  Non-CDB Architecture Deprecated/Desupported – From Oracle database 12c version 12.1.0.2, the non-CDB architecture is DEPRECATED  In Oracle Database 20c the non-CDB architecture will be DESUPPORTED – “For all offerings, if you are not licensed for Oracle Multitenant, then you may have up to 3 PDBs in a given container database at any time.” Oracle Database 20c
  • 64. 64 Mahir M. Quluzade http://www.mahir-quluzade.com Q&A
  • 65. 65 Mahir M. Quluzade http://www.mahir-quluzade.com THANK YOU #UKOUG #TECHFEST2019 #PASSTHEKNOWLEDGE
  • 66. 66 Mahir M. Quluzade http://www.mahir-quluzade.com Mahir M. Quluzade @marzade mahir.quluzade@gmail.com http://www.mahir-quluzade.com
  • 67. 67 Mahir M. Quluzade http://www.mahir-quluzade.com Baku, Azerbaijan