oracle container & pluggable databases for apps dba
TRANSCRIPT
Oracle Container & PluggableDatabases for Apps DBA
Biju Thomas
@biju_thomas
Manage Oracle 19c Pluggable Database with EBS 12.1 or 12.2
Features Missing in EBS Database
12cR2
• Privilege Analysis
• Automatic locking of
inactive users
• Real-time materialized
views
• Online conversion of non-
partitioned table to
partitioned
• Online table move
• Read-only partitions
• Automatically
synchronize password
files in DG configurations
19c
• LISTAGG with DISTINCT
• Active Data Guard DML
redirection
• High frequency automatic
optimizer statistics
collection.
• Stats during conventional
DML operations
• Hybrid partitioned table
• PDB recovery catalog
18c
• Termination of runaway
queries.
• Scalable sequences
• RPM & Image Based
installation
• Read-only Oracle home
• Schema only accounts
• Inline External tables
• Change partitioning
scheme
• DBCA for PDB
management
E-Business Suite support for CDB architecture
• EBS12.2.3 and later or EBS 12.1.3
– Oracle Database 19c on-premises
– Oracle Database 12cR1 VM DB Systems
– Oracle Database 12cR1 in an Exadata DB System
• Oracle E-Business Suite supports a single PDB (single tenant) in a CDB.
• Oracle Database 19c is certified on OCI PaaS
– OCI PaaS Supports 11gR2 & 12cR1 CDB
– 1-Node VM DB System (Single Instance)
– 2-Node VM DB System (Oracle RAC)
– Exadata DB System (Oracle RAC)
• Oracle Cloud Infrastructure Compute VM (11gR2, 12cR1, 19c)
Getting Started with Oracle E-Business Suite on Oracle Cloud Infrastructure (Doc ID 2517025.1)
Oracle Database & Instance Architecture
https://www.oracle.com/webfolder/technetwork/tutorials/architecture-diagrams/19/database-technical-architecture.html
Oracle Container Database Architecture
https://www.oracle.com/webfolder/technetwork/tutorials/architecture-diagrams/19/database-technical-architecture.html
Startup & Shutdown
• Startup and Shutdown of CDB (the container database) is the same as regular instance. – STARTUP [FORCE] [RESTRICT] [QUIET] [ MOUNT | [ OPEN] | NOMOUNT ]
– SHUTDOWN [ABORT | IMMEDIATE | NORMAL | TRANSACTIONAL [LOCAL]]
• Connected to the PDB as SYSDBA (and other system privileges) using SQL*Plus
– STARTUP [FORCE] [UPGRADE] [RESTRICT]
– STARTUP OPEN [READ WRITE | READ ONLY] [RESTRICT]
– SHUTDOWN [IMMEDIATE]
• Connected to the CDB using SQL*Plus
– STARTUP PLUGGABLE DATABASE <pdb_name> [FORCE]|[UPGRADE]|[RESTRICT]
– STARTUP PLUGGABLE DATABASE <pdb_name> OPEN [READ ONLY|READ WRITE]
Startup & Shutdown
• Use ALTER PLUGGABLE DATABASE to start & stop Pluggable Database (PDB)
– Connected to the CDB
• ALTER PLUGGABLE DATABASE <pdb-name-clause> OPEN [READ WRITE|READ ONLY]
[RESTRICT]
• ALTER PLUGGABLE DATABASE <pdb-name-clause> OPEN [UPGRADE]
• ALTER PLUGGABLE DATABASE <pdb-name-clause> CLOSE [IMMEDIATE]
– Connected to the PDB
• ALTER PLUGGABLE DATABASE OPEN [READ WRITE | READ ONLY | UPGRADE]
• ALTER PLUGGABLE DATABASE CLOSE [IMMEDIATE]
• Save PDB State
– ALTER PLUGGABLE DATABASE <pdb_name> SAVE STATE
– DBA_PDB_SAVED_STATES
Connecting to CDB
• Connecting to CDB using OS Authentication
$ export ORACLE_SID=cdb1
$ sqlplus / as sysdba
• Connect to a user in CDB from SQL*Plus
SQL> CONN system/pass
SQL> CONN system/pass@//localhost:1521/cdb1
SQL> CONN system/pass@cdb1
Connecting to PDB
• Connecting to PDB requires Service
• Find the services from V$SERVICES
– NAME of the service, PDB associated with
SQL> CONN system/pass@//localhost:1521/pdb1
SQL> CONN system/pass@pdb1
• Connecting to PDB using OS Authentication
– Use TWO_TASK=pdb_service
• / AS SYSDBA does not work.
$ export ORACLE_SID=cdb1
$ sqlplus / as sysdba
• Use username/password
– SQL> connect system/manager@PDB as sysdba
Running SQL in a PDB
• Connect to the PDB and run statements.
• Connect to CDB and run:
ALTER SESSION SET CONTAINER = <pdb_name>;
SHOW CON_NAME
SELECT SYS_CONTEXT ('USERENV', 'CON_NAME') FROM DUAL;
USE_SID_AS_SERVICE_<LISTENER>
• Database clients with earlier releases of Oracle Database that have hard-coded
connect descriptors can use this parameter to connect to a container or
pluggable database.
• Edit the "$ORACLE_HOME/network/admin/listener.ora" file, adding the
following entry, with the "listener" name matching that used by your listener.USE_SID_AS_SERVICE_listener=on
• Reload or restart the listener.$ lsnrctl reload
• Both connections workjdbc:oracle:thin:@myhost:1521:pdb1
jdbc:oracle:thin:@myhost:1521/pdb1
Alert Log Location
• Alert log is associated with the CDB.
• No separate alert log file for each PDB.
• SELECT NAME, VALUE FROM V$DIAG_INFO;
Common User vs Local User
• Common user
– Exists in the CDB and all current and future PDBs.
– Must be in the root container to create common users.
– When creating user from root container, CONTAINER=ALL is the default.
– COMMON_USER_PREFIX initialization parameter. By default, the prefix is C##.
– All Oracle-supplied users are common users, though they do not have the prefix.
• Local User
– Exists only in the current PDB.
– Same username can exist in multiple PDBs, but they are unrelated.
– When creating user from root container, CONTAINER=CURRENT is the default.
– The name of a local user can never begin with C## or c##
The Dictionary Views
❖ CDB_ : All the objects in the CDB across all PDBs
❖ DBA_ : All the objects in a container or PDB
❖ALL_ : Objects assessible by the current user from the container or PDB
❖USER_ : Objects owned by the current user
✓ The CDB_* views can be queried by users with
✓ SYSDBA system privilege
✓ SELECT ANY DICTIONARY privilege
✓ SELECT_CATALOG_ROLE role
➢ The CONTAINER_DATA attribute associated with a common user
Common User – CONTAINER_DATA Attribute
• When a user connected to the root queries a CDB_* view, the query results will depend on the CONTAINER_DATA attribute for users for the view.
• Container Data Objects
– V$, GV$, CDB_, and some DBA_HIST* views.
– CREATE USER c##DBA1 IDENTIFIED BY dba1;
– GRANT CREATE SESSION, DBA TO c##DBA1 CONTAINER=ALL;
– SELECT name, bytes FROM v$datafile;
• Shows only current container
– ALTER USER c##DBA1 SET CONTAINER_DATA=ALL CONTAINER=CURRENT;
– ALTER USER c##DBA1 SET CONTAINER_DATA=(CDB$ROOT,EBS1)
CONTAINER=CURRENT;
Common User – CONTAINER_DATA Attribute
• When you create a common user, specify which PDB data visible to that
common user using the CONTAINER_DATA clause
• Specify the object-level CONTAINER_DATA attributes for a user using the
ALTER USER command
• View the information about the user-level and object-level CONTAINER_DATA
attributes using CDB_CONTAINER_DATA dictionary view.
• You can add and remove specific container names using the ADD
CONTAINER_DATA and REMOVE CONTAINER_DATA clauses respectively.
• Using SET CONTAINER_DATA clause will overwrite any existing settings.
ALTER USER c##DBA2 REMOVE CONTAINER_DATA=(EBS1) CONTAINER=CURRENT;
ALTER USER c##DBA3 ADD CONTAINER_DATA=(PDB$SEED) CONTAINER=CURRENT;
The CONTAINER_ID
• CON_ID column in many V$, CDB_, GV$ views.
• Shows the ID of the container to which the data pertains.
• CON_ID Column in Container Data Objects.
– 0 = The data pertains to the entire CDB. (and non-CDB)
– 1= The data pertains to the root
– 2= The data pertains to the seed
– 3 - 254 = The data pertains to a PDB, Each PDB has its own container ID.
Instance Parameters – CDB & PDB
• SPFILE / PFILE is associated with the CDB.
• Connect to CBD$ROOT to change instance wide parameter.
• Certain parameters are modifiable at the PDB level.– V$SYSTEM_PARAMETER: ISPDB_MODIFIABLE = TRUE
• Connect to the PDB to change PDB parameter.
• PDB init parameters are stored in PDB_SPFILE$ view
– Only if you specify SCOPE=SPFILE or SCOPE=BOTH.
• ALTER SYSTEM SET log_archive_dest_1 = '…'; SCOPE=SPFILE;
• ALTER SYSTEM RESET log_archive_dest_1 SCOPE=SPFILE;
Managing Undo and Temporary Tablespaces
• Shared Undo– ALTER DATABASE LOCAL UNDO OFF;
• Local Undo – ALTER DATABASE LOCAL UNDO ON;
• Shared Temporary Tablespace
– Tablespace in CDB$ROOT
• Temporary Tablespace for PDB
– Additional tablespace(s) in PDB
• Local Temporary Tablespace
– For RAC instances, files are local to that node.
– CREATE LOCAL TEMPORARY TABLESPACE
statement. https://blog.dbi-services.com/oracle-12cr2-multitenant-local-undo/
PDB Remote Clone
• Must use local undo and archive log mode for hot clone.
• In shared undo mode, the source PDB must be open in read-only.
• Create a database link in the CDB target (DEV) connecting to a user in the CDB
source (PRODC) or PDB source (PRODP).
Export ORACLE_SID=DEV
CREATE DATABASE LINK prodlink CONNECT TO c##cloneuser
IDENTIFIED BY pwd USING 'prodc';
CREATE PLUGGABLE DATABASE devp FROM prodp@prodlink;
ALTER PLUGGABLE DATABASE devp OPEN;
Backup and Recovery - PDB
• RMAN commands used to backup and recover CDBs and PDBs are the same
as those used for non-CDBs, with minor variations in the syntax.
• The backup and recovery operations performed on non-CDBs can also be
performed on CDBs and PDBs.
• Connect to CDB$ROOT as SYSDBA or SYSBACKUP, do perform backup or
recovery on all PDBs.
– the same commands on non-CDBs
• PDB level operations
– Connect to the PDB
• BACKUP DATABASE;
– Connect to CDB$ROOT
• BACKUP PLUGGABLE DATABASE hrpdb, salespdb, invpdb;
Backup and Recovery – Undo Mode
• Undo mode has no impact of how you do backups.
• Shared Undo mode PDB recovery
– To recovery a PDB, connect to CDB$ROOT
– Include AUXILIARY DESTINATION clause in the RECOVER command.
– RMAN uses an auxiliary destination to store temporary files created during recovery.
If a fast recovery area has been configured, then it is used as the auxiliary
destination.
• Local Undo mode PDB recovery
– Connect to CDB or PDB
– RECOVER DATABASE
– RECOVERY PLUGGABLE DATABASE
DBMS_JOB → DBMS_SCHEDULER
• During upgrades to 19c, any jobs defined using DBMS_JOB get converted to
DBMS_SCHEDULER jobs.
• You can still use DBMS_JOB, but they automatically get converted to
DBMS_SCHEDULER.
PDB Lockdown Profiles
• A lockdown profile is a mechanism to restrict certain functionalities in a PDB.
• Used to restrict user access in a PDB.
• A lockdown profile can prevent PDB users from:
– Executing certain SQL statements, such as ALTER SYSTEM and ALTER SESSION,
– Running procedures that access the network (e.g. UTL_SMTP, UTL_HTTP),
– Accessing a common user’s objects,
– Making unrestricted cross-PDB connections in a CDB,
– Taking AWR snapshots,
– Using JAVA partially or as a whole,
– Using certain database options such as Advanced Queueing and Partitioning.
• Query DBA_LOCKDOWN_PROFILES to see the details of lockdown profile.
https://blogs.oracle.com/multitenant/a-simple-guide-to-lockdown-profiles
PDB Lockdown Profile - Example
SQL> create lockdown profile sec_profile;
SQL> alter lockdown profile sec_profile disable statement=
('ALTER SYSTEM');
SQL> alter lockdown profile sec_profile enable statement=
('ALTER SYSTEM') clause=('SET') users=common;
SQL> alter lockdown profile sec_profile enable statement=
('ALTER SYSTEM') clause=('KILL SESSION’);
SQL> alter lockdown profile sec_profile disable statement=
('ALTER PLUGGABLE DATABASE') users=local;
SQL> alter lockdown profile sec_profile enable statement=
('ALTER PLUGGABLE DATABASE’)
clause=('DEFAULT EDITION', 'SET TIME_ZONE’,
'DATAFILE RESIZE', 'DATAFILE AUTOEXTEND ON’,
'OPEN', 'CLOSE', 'PROPERTY');
SQL> alter system set pdb_lockdown=sec_profile;
Upgrading to 19c
• Interoperability Notes: Oracle E-Business Suite Release 12.2 with Oracle Database 19c (Doc ID 2552181.1)
• Create empty shell Container Database using DBCA.
• Set a few init parameters on 12.1 or 11.2.0.4 database and restart the instance.
• Upgrade database using dbua
• Convert the upgraded database to a pluggable database.$ cd $ORACLE_HOME/appsutil
$ . ./txkSetCfgCDB.env dboraclehome=<full path of ORACLE_HOME>
$ cd $ORACLE_HOME/appsutil/bin
$ perl txkCreatePDB.pl -dboraclehome=<ORACLE_HOME> -outdir=<ORACLE_HOME>/appsutil/log \
-cdbsid=<CDB SID> -pdbsid=<source SID> -dbuniquename=<CDB SID> -servicetype=onpremise
• Create the TNS files for EBS specifically using txkGenCDBTnsAdmin.pl.
ADDM / ASH / AWR in PDB
• In a CDB, ADDM works in the same way as it works in a non-CDB, that is, the
ADDM analysis is performed each time an AWR snapshot is taken on a CDB
root or a PDB, and the ADDM results are stored on the same database system
where the snapshot is taken.
• To use ADDM in a PDB, you must enable automatic AWR snapshots in the PDB
by setting the AWR_PDB_AUTOFLUSH_ENABLED initialization parameter to
TRUE and AWR snapshot interval greater than 0.
• AWR snapshot can be taken at the CDB level or at the PDB.
• ASH or AWR report when run from the PDB:
– AWR_ROOT - Use AWR data from root (default)
– AWR_PDB - Use AWR data from PDB
UTL_FILE_DIR Desupported in 19c
• During the 19c upgrade, you will perform steps to migrate directories defined for PL/SQL File I/O to database directory objects.
• Use script txkCfgUtlfileDir.pl to migrate your previous UTL_FILE_DIR database initialization parameter settings.
• Specify the directories that you want Oracle E-Business Suite to use for PL/SQL file I/O in the supplemental UTL_FILE_DIR parameter within the apps.v$parameter and apps.v$parameter2 views.
• Directory defined by APPLTMP must be defined in the supplemental UTL_FILE_DIR parameter.
• Any existing custom code that uses UTL_FILE functions and relies on UTL_FILE_DIR for the directory location should continue to operate in the same way as before the upgrade, now referencing the new supplemental parameter.
Using UTL_FILE_DIR or Database Directories for PL/SQL File I/O in Oracle E-Business Suite Releases 12.1 and 12.2 (Doc ID 2525754.1)
EBS Database Tier Context File Parameters
• s_undo_tablespace=<PDB system undo tablespace name>
• s_db_oh=<Location of ORACLE_HOME>
• s_dbhost=<hostname>
• s_dbSid=<PDB name>
• s_pdb_name=<PDB name>
• s_cdb_name=<CDB SID>
• s_base=<Base directory for DB Oracle Home>
• s_dbuser=<DB User>
• s_dbgroup=<DB group>
• s_dbhome1=<Data directory>
• s_display=<Display>
• s_dbCluster=false
• s_isDBCluster=n
• s_dbport=<DB port>
• s_port_pool=<Port pool number>
Learn More from …
https://oracle-base.com/articles/12c/multitenant-overview-container-
database-cdb-12cr1
https://apex.oracle.com/database-features/
https://docs.oracle.com/en/database/oracle/oracle-
database/19/multi/index.html
Useful 19c EBS MOS Notes – 12.2
• Interoperability Notes: Oracle E-Business Suite Release 12.2 with Oracle Database 19c (Doc ID 2552181.1)
• Using Oracle 19c RAC Multitenant (Single PDB) with Oracle E-Business Suite Release 12.2 (Doc ID 2530665.1)
• Business Continuity for Oracle E-Business Suite Release 12.2 on Oracle Database 19c Using Physical Host Names (Doc ID 2617787.1)
• Business Continuity for Oracle E-Business Suite Release 12.2 on Oracle Database 19c Using Logical Host Names (Doc ID 2617788.1)
• Export/Import Process for Oracle E-Business Suite Release 12.2 Database Instances Using Oracle Database 19c (Doc ID 2554156.1)
• Using Active Data Guard Reporting with Oracle E-Business Suite Release 12.2 and Oracle Database 19c (Doc ID 2608030.1)
• Oracle 12c Multitenant: Frequently Asked Questions (Doc ID 1511619.1)
• bde_chk_cbo.sql - EBS initialization parameters - Healthcheck (Doc ID 174605.1)
35
https://twitter.com/biju_thomasTwitter
https://www.facebook.com/oraclenotesFacebook
https://www.linkedin.com/in/bijutLinkedIn
https://bijoos.com/oraclenotesBlog
https://dataintensity.com Data Intensity
https://go.dataintensity.com/cloudfirst/social#CloudFirst Podcast
Daily #OraTidbit on Facebook and Twitter
Session ID:
Please remember to complete the session evaluation that you
will receive via email from the webinar service provider.
Questions?
www.bijoos.com
@biju_thomas
@oraclenotes
ASSESSMENTDESIGN IMPLEMENTATION MIGRATION INTEGRATION
UPGRADE
ON-DEMAND SERVICE MANAGEMENT
TOTAL SERVICE MANAGEMENT
Middleware
Databases
BI/Analytics
Infrastructure
OS/Virtualization
Service Management
Integrations
Cloud Platform
Applications
ENGINEERED SYSTEMS
SOLUTIONS
MULTI-CLOUD WORKLOAD
MANAGEMENTSOLUTIONS
DATA & DATABASEMANAGEMENT
SOLUTIONS
ENTERPRISEAPPLICATIONSOLUTIONS
ORACLELICENSE
SOLUTIONS
PROCUREMENT SERVICE
SOLUTIONS
DI Solutions, Services & Products Portfolio
38https://www.dataintensity.com/solutions/oracle-to-azure-migration-solutions
Data Intensity is the largest independent multi-cloud services
provider focused on managing mission-critical applications and services in a hybrid cloud world. Our purpose-built solutions and services focus on the life-cycle
design, implementation, support, and operation of technologies and platforms that power our customers’ business processes.
Customers choose Data Intensity because we allow them to focus on their critical business needs
while we focus on their applications and multi-cloud
investments.