Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Pluggable Databases: What they will break and why you should use them anyway!
1. http://oracle-base.com
Pluggable
Databases
:
What
they
will
break
and
why
you
should
use
them
anyway!
Tim
Hall
Oracle
ACE
Director
Oracle
ACE
of
the
Year
2006
OakTable
Network
OCP
DBA
(7,
8,
8i,
9i,
10g,
11g)
OCP
Advanced
PL/SQL
Developer
Oracle
Database:
SQL
CerTfied
Expert
hWp://oracle-‐base.com
Books
Oracle
PL/SQL
Tuning
Oracle
Job
Scheduling
12. http://oracle-base.com
Break?
§ What
do
I
mean
by,
“What
they
will
break”?
§ The
way
you
did
things
in
the
past
no
long
works!
§ There
will
be
an
alternaTve
soluTon,
so
it's
not
really
broken.
§ You
will
have
to
change!
§ What
I’m
not
talking
about.
§ Changes
that
affect
both
CDBs
and
non-‐CDBs.
§ Oracle
12c
is
very
different.
There
is
a
lot
to
learn!
13. http://oracle-base.com
OS
AuthenTcaTon
§ OS
authenTcaTon
doesn't
work.
§ Must
connect
using
services,
even
when
connecTng
to
sys@pdb.
§ Those
CRON
jobs
you
use
are
probably
broken!
§ What
can
we
do
about
this?
14. http://oracle-base.com
OS
AuthenTcaTon
ALTER
SESSION
SET
CONTAINER
§ For
SYS
connecTons,
you
can
use
the
ALTER
SESSION
SET
CONTAINER
command.
sqlplus / as sysdba <<EOF
ALTER SESSION SET CONTAINER = pdb1;
-- Do something.
EXIT;
EOF
15. http://oracle-base.com
OS
AuthenTcaTon
TWO_TASK
§ For
non-‐SYS
connecTons
that
include
a
password,
you
can
use
TWO_TASK.
export TWO_TASK=pdb1
sqlplus test/test <<EOF
-- Do something.
EXIT;
EOF
17. http://oracle-base.com
OS
AuthenTcaTon
Secure
External
Password
Store
§ Create
the
wallet.
$ mkdir -p /u01/app/oracle/wallet
$ orapki wallet create -wallet "/u01/app/oracle/wallet" -
pwd "mypassword" -auto_login_local
Oracle Secret Store Tool : Version 12.1.0.1
Copyright (c) 2004, 2012, Oracle and/or its affiliates.
All rights reserved.
Enter password:
Enter password again:
$
18. http://oracle-base.com
OS
AuthenTcaTon
Secure
External
Password
Store
§ Set
the
credenTals.
$ mkstore -wrl "/u01/app/oracle/wallet" -createCredential
pdb1_test test test
Oracle Secret Store Tool : Version 12.1.0.1
Copyright (c) 2004, 2012, Oracle and/or its affiliates.
All rights reserved.
Enter wallet password
Create credential oracle.security.client.connect_string1
$
19. http://oracle-base.com
OS
AuthenTcaTon
Secure
External
Password
Store
§ Add
an
entry
into
the
"$ORACLE_HOME/network/admin/tnsnames.ora"
file.
PDB1_TEST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)
(HOST = ol6-121)
(PORT = 1521)
)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = pdb1)
)
)
21. http://oracle-base.com
OS
AuthenTcaTon
DBMS_SCHEDULER
-‐
Script
Jobs
§ New
jobs
in
12c
§ EXTERNAL_SCRIPT
:
Commands
in
file
or
PL/SQL
variable
run
in
shell.
§ SQL_SCRIPT
:
Commands
in
file
or
PL/SQL
variable
run
using
SQL*Plus
from
shell.
§ BACKUP_SCRIPT
:
Commands
in
file
or
PL/SQL
variable
run
using
RMAN
from
shell.
§ Variants
of
external
jobs.
§ All
jobs
use
credenTals
to
connect
to
the
proper
OS
and
database
users.
§ CredenTals
held
in
the
database.
22. http://oracle-base.com
Running
$ORACLE_HOME/rdbms/admin
built-‐in
scripts
§ Built-‐in
funcTonality
open
requires
scripts
to
be
run
in
CDB
and
all
PDBs.
§ Example
of
installing
"catblock.sql".
$ cd $ORACLE_HOME/rdbms/admin/
$ perl catcon.pl -d $ORACLE_HOME/rdbms/admin -b /
tmp/catblock_output catblock.sql
$ ls /tmp/catblock_output*
catblock_output0.log catblock_output1.log
catblock_output2.log catblock_output3.log
$
23. http://oracle-base.com
catcon.pl
(conTnued)
§ Can
use
catcon.pl
to
run
a
query
in
all
PDBs.
$ cd $ORACLE_HOME/rdbms/admin/
$ perl catcon.pl -e -b /tmp/query_output -- --x"SELECT
SYS_CONTEXT('USERENV', 'CON_NAME') FROM dual“
$ ls /tmp/query_output*
/tmp/query_output0.log /tmp/query_output1.log /tmp/
query_output2.log /tmp/query_output3.log
$
§ Use
"-‐c"
flag
for
include
list
or
"-‐C"
for
exclude
list.
$ rm -f /tmp/select_output*
$ cd $ORACLE_HOME/rdbms/admin/
$ perl catcon.pl -e -C 'CDB$ROOT PDB$SEED' -b /tmp/select_output
-- --x"SELECT SYS_CONTEXT('USERENV', 'CON_NAME') FROM dual“
$
24. http://oracle-base.com
Redo
and
Undo
Management
§ Undo
and
Redo
belong
to
the
CDB.
PDBs
have
no
direct
control
over
Undo
and
Redo.
§ Remember
to
perform
maintenance
of
these
at
the
CDB
level.
§ ConsolidaTng
mulTple
redo-‐intensive
PDBs
into
one
CDB
may
be
unwise.
§ Shared
undo
means
undo-‐based
flashback
operaTons
may
be
affected
if
undo
is
not
sized
properly.
Consider
Flashback
Data
Archive
(FDA).
25. http://oracle-base.com
Backup
and
Recovery
§ Backup/Recovery
of
CDB
is
similar
to
non-‐CDB,
but
affects
all
PDBs.
§ Backup/Recovery
of
PDBs
is
available.
§ PITR
of
a
PDB
possible,
similar
to
tablespace
PITR.
Does
PITR
of
CDB
to
in
auxiliary
instance.
§ If
you
do
PITR
of
a
PDB,
you
can't
flashback
the
CDB
before
that
Tme.
§ You
will
have
to
relearn
B&R,
especially
caveats.
26. http://oracle-base.com
Flashback
Database
§ You
can't
use
FLASHBACK
DATABASE
for
a
PDB.
§ FLASHBACK
DATABASE
only
works
with
CDB.
§ If
you
do
PITR
of
a
PDB,
you
can't
flashback
the
CDB
before
that
Tme.
§ Flashback
of
a
PDB
may
be
coming!
27. http://oracle-base.com
ApplicaTon
Express
(APEX)
§ By
default
APEX
installaTons
are
split
between
the
CDB
and
PDB.
§ CDB
holds
common
components.
§ PDB
holds
database-‐specific
components
and
applicaTon
metadata.
§ All
APEX
installaTons
must
be
maintained
at
the
same
version.
§ Once
a
PDB
is
present,
you
*can't*
remove
shared
APEX
installaTon.
§ Must
remove
it
first,
then
build
PDBs
with
separate
APEX
installaTons.
28. http://oracle-base.com
Transparent
Data
EncrypTon
(TDE)
§ The
key
management
has
changed
in
12c,
which
affects
TDE.
§ ADMINISTER
KEY
MANAGEMENT
replaces
the
ALTER
SYSTEM
SET
ENCRYPTION
KEY
and
ALTER
SYSTEM
SET
ENCRYPTION
WALLET
commands.
§ Under
mulTtenant,
some
operaTons
have
to
be
performed
at
CDB
before
PDB.
§ You
need
to
relearn
it!
30. http://oracle-base.com
Features
Not
Available
With
MulTtenant
§ Not
currently
supported
under
mulTtenant
in
12.1.0.2.
§ DBVERIFY
§ Data
Recovery
Advisor
§ Flashback
Pluggable
Database
§ Flashback
TransacTon
Backout
§ Database
Change
NoTficaTon
§ ConTnuous
Query
NoTficaTon
(CQN)
§ Client
Side
Cache
§ Heat
map
§ AutomaTc
Data
OpTmizaTon
§ Oracle
Streams
§ If
you
need
them,
use
non-‐CDB
architecture.
32. http://oracle-base.com
Non-‐CDB
Deprecated
§ From
12.1.0.2
the
non-‐CDB
architecture
is
deprecated.
"The
non-‐CDB
architecture
is
deprecated
in
Oracle
Database
12c,
and
may
be
desupported
and
unavailable
in
a
release
aper
Oracle
Database
12c
Release
2.
Oracle
recommends
use
of
the
CDB
architecture..“
hWps://docs.oracle.com/database/121/UPGRD/deprecated.htm#BABDBCJI
33. http://oracle-base.com
Lone-‐PDB
is
free!
§ A
CDB
with
a
single
PDB
(Lone-‐PDB,
Single
Tenant)
is
free
and
available
in
all
ediTons.
§ You
can
have
mulTple
CDBs
on
a
server,
each
with
one
PDB.
§ A
CDB
with
mulTple
PDBs
costs
$.
§ Lone-‐PDB
allows
you
to
get
used
to
MulTtenant
at
no
extra
cost.
34. http://oracle-base.com
Patching,
Upgrading
and
Cloning
§ "PotenTal"
improvements
in
the
speed
of
patching
and
upgrades.
§ Transfers
using
Unplug/Plugin
are
simple.
§ Cloning
a
PDB
between
local
and
remote
CDBs
is
awesome.
(Hot-‐Cloning
coming?)
CREATE PLUGGABLE DATABASE pdb5
FROM remote_pdb5@remotecdb1
FILE_NAME_CONVERT=(
'/u01/app/oracle/oradata/cdb1/remote_pdb5/',
'/u01/app/oracle/oradata/cdb1/pdb5/‘
);
ALTER PLUGGABLE DATABASE pdb5 OPEN READ WRITE;
36. http://oracle-base.com
Get
Started
Now!
§ MulTtenant
introduces
a
lot
of
changes
for
DBAs.
§ If
you
upgrade
to
non-‐CDB
in
12.1,
you
may
be
forced
to
change
to
CDB
in
12.2.
§ That
makes
12.2
a
big
upgrade.
§ Put
the
effort
in
now!
37. http://oracle-base.com
Future-‐Proof
Yourself
§ This
is
the
future
of
the
Oracle
Database.
§ Lots
of
the
old-‐guard
DBAs
will
be
in
denial
and
struggle
to
get
up
to
speed.
§ Make
yourself
stand
out!