AMIS organiseerde op maandagavond 15 juli het seminar ‘Oracle database 12c revealed’. Deze avond bood AMIS Oracle professionals de eerste mogelijkheid om de vernieuwingen in Oracle database 12c in actie te zien! De AMIS specialisten die meer dan een jaar bèta testen hebben uitgevoerd lieten zien wat er nieuw is en hoe we dat de komende jaren gaan inzetten!
Deze presentatie is deze avond gegeven in de vorm van een parallelsessie.
2. Demonstration
Oracle Multitenant
• Environment
• Cloning a Pluggable database locally
• Cloning a Pluggable database remotely
• Unplug/plug a database
– Unplug PDB
– Plug as nocopy
– Plug as copy
– Plug as move
• Adopting a non-CDB as a PDB
3. 3
Environment
• Two Oracle Enterprise Linux 6 VM’s in Virtualbox
– 4 vcpu
– 8Gb memory
– 50Gb disk
• Oracle database 12.1.0.1 installed
• Created databases, using DBCA
– System 1 (db12c-1)
• 1 Container database (cdb1)
• 1 Pluggable database (pdb2)
– System 2 (db12c-2)
• 1 Container database (cdb2)
• 1 non-CDB database
4. 4
Cloning a
Pluggable database locally
• Using sqlplus
alter pluggable database pdb2 close immediate;
alter pluggable database pdb2 open read only;
create pluggable database pdb4 from pdb2
file_name_convert =
('/u02/oradata/CDB1/datafile/PDB2/','/u02/oradata/CDB1/datafile/PDB4/');
select name, open_mode from v$pdbs;
alter pluggable database pdb2 open force;
alter pluggable database pdb4 open;
select name, open_mode from v$pdbs;
5. 5
Cloning a
Pluggable database remotely
• Using sqlplus
alter pluggable database pdb2 close immediate;
alter pluggable database pdb2 open read only;
-- On destination cdb
-- create destination directory
mkdir /u02/oradata/CDB2/datafile/PDB5
-- Create database link
create database link pdb2_link connect to system identified by Welcome01 using 'pdb2';
create pluggable database pdb5 from pdb2@pdb2_link
file_name_convert =
('/u02/oradata/CDB1/datafile/PDB2/','/u02/oradata/CDB2/datafile/PDB5/');
6. 6
Unplug/plug a PDB
• Unplug PDB
alter pluggable database pdb4 close immediate;
alter pluggable database pdb4 unplug into '/u02/oradata/CDB1/datafile/PDB4/pdb4.xml';
drop pluggable database pdb4 keep datafiles;
• Plug as nocopy
create pluggable database pdb4 using '/u02/oradata/CDB2/datafile/PDB4/pdb4.xml'
source_file_name_convert=('CDB1','CDB2')
nocopy
tempfile reuse;
7. 7
Unplug/plug a PDB
• Plug as copy
create pluggable database pdb5 as clone using
'/u02/oradata/CDB2/datafile/PDB4/pdb4.xml'
source_file_name_convert=('CDB1','CDB2')
copy
file_name_convert =
('/u02/oradata/CDB2/datafile/PDB4/','/u02/oradata/CDB2/datafile/PDB5/');
• Plug as move
create pluggable database pdb7 using '/u02/oradata/CDB2/datafile/PDB4/pdb4.xml'
source_file_name_convert=('CDB1','CDB2')
move
file_name_convert =
('/u02/oradata/CDB2/datafile/PDB4/','/u02/oradata/CDB2/datafile/PDB7/');
8. 8
Adopting a non-CDB as a PDB
• Adoption of the content of a non-CDB
– Create an export using Datapump
– Create a new PDB
– Import content using Datapump
– Alternative, use Oracle GoldenGate to populate a new PDB
from the source non-CDB
• Direct adoption of a 12.1 non-CDB as a PDB
(Upgrade pre 12c database to 12c using the usual approach if needed)
– Put the non-CDB in Read-only mode
– Generate PDB manifest file
– Create and plug-in PDB using manifest file
– Convert to PDB Data dictionary
9. 9
Adopting a non-CDB as a PDB
• Setting the Non-CDB to Read-Only Mode
Set the ORACLE_SID variable to noncdb
sqlplus / as sysdba
shutdown immediate
startup mount exclusive
alter database open read only;
select name, open_mode from v$database;
• Generating a Pluggable Database Manifest File for the Non-CDB
exec dbms_pdb.describe(pdb_descr_file=>'/u02/oradata/noncdb/noncdb.xml');
exit
10. 10
Adopting a non-CDB as a PDB
• Creating and Plugging in a PDB into cdb2 by Using the noncdb Manifest
File
Set the ORACLE_SID variable to cdb2
sqlplus / as sysdba
create pluggable database exnoncdb as clone using '/u02/oradata/noncdb/noncdb.xml'
copy
file_name_convert=('/u02/oradata/noncdb','/u02/oradata/CDB2/datafile/EXNONCDB');
alter pluggable database exnoncdb open;
alter pluggable database exnoncdb close immediate;
alter pluggable database exnoncdb open restricted;
• Converting to PDB Data Dictionary
alter session set container = EXNONCDB
@$ORACLE_HOME/rdbms/admin/noncdb_to_pdb.sql
• Note. Can take up to 20 minutes
11. 11
Final
• Other tools besides sqlplus.
– Oracle Enterprise manager 12c
– SQL Developer supports Pluggable databases
– DBCA supports Pluggable databases, on the server.
– Other tools ….
• Questions?
• jaap@amis.nl of jaap.poot@amis.nl