SlideShare una empresa de Scribd logo
1 de 7
Pluggable Database Tutorial Part 1
Osama Mustafa Page 1
[oracle@test12c Desktop]$ sqlplus / as sysdba
SQL*Plus: Release 12.1.0.1.0 Production on Wed Jul 3 19:05:10 2013
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics, Real Application Testing
and Unified Auditing options
SQL>show con_name
CON_NAME
-------------------
CDB$ROOT
Where
CON_NAME:
Displays the name of the Container to which you are connected when connected to a
Consolidated Database. For non-consolidated database, it will return "Non Consolidated".
SQL>show con_id
CON_ID
------------
1
Where
CON_ID: Displays the id of the Container to which you are connected when connected to a
Consolidated Database. If issued when connected to a non-Consolidated Database, this command
returns 0.
Pluggable Database Tutorial Part 1
Osama Mustafa Page 2
Now I want to check how Name for my my pluggable database , while installation i chosen five
container with prefix db_
SQL>select name, con_id from v$active_services order by 1;
NAME CON_ID
SYS$BACKGROUND 1
SYS$USERS 1
db12c 1
db12cXDB 1
Db_1 2
Db_2 3
Listener will look like the below:
Example how to connect Container, In my case i didn't create service in tnsnames.ora i am using
easy connect:
SQL>conn sys/sys@localhost:1521/db_1 as sysdba
Connected.
SQL>show con_name
CON_NAME
----------------
DB_1
SQL>show con_id
Pluggable Database Tutorial Part 1
Osama Mustafa Page 3
CON_ID
------------
3
Work On Pluggable Database:
After create Container and enable pluggable database, we need to add new one since container
empty.
Under /u01/app/oracle/oradata ,create new folder
[oracle@test12c db12c]$ mkdir test
[oracle@test12c db12c]$ chmod -R 775 test
Sqlplus / as sysdba
SQL >create pluggable database TEST admin user admin identified by admin
file_name_convert=
('/u01/app/oracle/oradata/db12c/pdbseed/','/u01/app/oracle/oradata/db12c/test/');
Pluggable database created.
SQL>select pdb_name, status from cdb_pdbs;
PDB_NAME Status
----------------------- ------------
PDB$SEED NORMAL
TEST NEW
SQL>select name, open_mode from v$pdbs;
NAME OPEN_MODE
------------------------------ ----------
PDB$SEED READ ONLY
TEST MOUNTED
SQL>select name, con_id from v$active_services order by 1;
NAME CON_ID
----------------------------------------------
SYS$BACKGROUND 1
SYS$USERS 1
db12c 1
db12cXDB 1
TEST 3
Pluggable Database Tutorial Part 1
Osama Mustafa Page 4
Now Con_id=3 , Most of Oracle Data Dictionary contains new_column called con_id , to check
datafile related to new pluaggable database :
SQL>select name from v$datafile where con_id=3 ;
NAME
--------------------------------------------------------------------------------
/u01/app/oracle/oradata/db12c/gls/system01.dbf
/u01/app/oracle/oradata/db12c/gls/sysaux01.dbf
Manage Oracle Container and Pluggable Database :
If you need to shutdown container, it will not be different as before:
SQL>show con_name
CON_NAME
------------------------------
CDB$ROOT
SQL>shutdown ;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL>startup ;
ORACLE instance started.
Total System Global Area 1252663296 bytes
Fixed Size 2287864 bytes
Variable Size 788530952 bytes
Database Buffers 452984832 bytes
Redo Buffers 8859648 bytes
Database mounted.
Database opened.
Check status for PDB :
SQL>select name, open_mode from v$pdbs;
NAME OPEN_MODE
------------------------------ ----------
PDB$SEED READ ONLY
TEST MOUNTED
Pluggable Database Tutorial Part 1
Osama Mustafa Page 5
If you the above Status for Test Database you will see it as mounted state which mean we cannot
create anything yet on database, Let's Open it
SQL>alter pluggable database TEST open;
Pluggable database altered.
SQL>select name,open_mode from v$pdbs ;
NAME OPEN_MODE
------------------------------ ----------
PDB$SEED READ ONLY
TEST READ WRITE
The same for close Option
SQL>alter pluggable database TEST close immediate;
Pluggable database altered.
SQL>select name,open_mode from v$pdbs ;
NAME OPEN_MODE
------------------------------ ----------
PDB$SEED READ ONLY
TEST MOUNTED
Now you can open/close all pluggable database :
SQL >Alter pluggable database all Open;
SQL >Alter pluggable database all close ;
SQL>select tablespace_name, con_id from cdb_tablespaces where con_id=3 ;
TABLESPACE_NAME CON_ID
------------------------------ ----------
SYSTEM 3
SYSAUX 3
TEMP 3
to get data file
SQL>select file_name, con_id from cdb_data_files where con_id=3 ;
NAME
--------------------------------------------------------------------------------
/u01/app/oracle/oradata/db12c/gls/system01.dbf
/u01/app/oracle/oradata/db12c/gls/sysaux01.dbf
Pluggable Database Tutorial Part 1
Osama Mustafa Page 6
SQL>select file_name, con_id from cdb_temp_files where con_id=3;
FILE_NAME CON_ID
------------------------------------------
/u01/app/oracle/oradata/db12c/gls/pdbseed_temp01.dbf 3
If you do the below query to create table space, it will not be created under TEST database,
therefore it will be created on root :
SQL >create tablespace cdata datafile '/u01/app/oracle/oradata/db12c/gls/test.dbf' SIZE
30M;
SQL>select tablespace_name, con_id from cdb_tablespaces order by
con_id;
TABLESPACE_NAME CON_ID
------------------------------ ----------
SYSTEM 1
CDATA 1
SYSAUX 1
TEMP 1
UNDOTBS1 1
USERS 1
SYSTEM 2
TEMP 2
SYSAUX 2
SYSTEM 3
SYSAUX 3
TEMP 3
12 rows selected.
Same for temp tablespace :
SQL>create temporary tablespace root_temp tempfile
'/u01/app/oracle/oradata/db12c/temp_01.dbf' SIZE 30M;
If you need to create Tablespace in pluggable database follow the below, you have to options
 connect to pluggable database in our case test using tnsnames.ora or easy connect
o connect sys/sys@localhost:1521/test
 alter session command line
o alter session set container= <Name>
Pluggable Database Tutorial Part 1
Osama Mustafa Page 7
SQL>alter session set container=TEST;
Session altered.
SQL>create tablespace pdb_test datafile
'/u01/app/oracle/oradata/db12c/TEST/test_pdb.dbf' SIZE 20M;
Tablespace created.
SQL>select tablespace_name, con_id from cdb_tablespaces order by con_id;
TABLESPACE_NAME CON_ID
------------------------------ ----------
SYSTEM 3
SYSAUX 3
TEMP 3
PDB_TEST 3
Same for temporary table space, next post i will provide another manage for pluggable database.
Reference:
1- oracle Documentation Here
2- Oracle Documentation Here

Más contenido relacionado

La actualidad más candente

Are You Ready for 12c? Data Migration and Upgrade Best Practices
Are You Ready for 12c? Data Migration and Upgrade Best PracticesAre You Ready for 12c? Data Migration and Upgrade Best Practices
Are You Ready for 12c? Data Migration and Upgrade Best Practices
Performance Tuning Corporation
 
Oracle business intelligence enterprise edition 11g
Oracle business intelligence enterprise edition 11gOracle business intelligence enterprise edition 11g
Oracle business intelligence enterprise edition 11g
uzzal basak
 
Oracle Linux 7 Beta First Look (Installations)
Oracle Linux 7 Beta First Look (Installations)Oracle Linux 7 Beta First Look (Installations)
Oracle Linux 7 Beta First Look (Installations)
Osama Mustafa
 

La actualidad más candente (20)

Are You Ready for 12c? Data Migration and Upgrade Best Practices
Are You Ready for 12c? Data Migration and Upgrade Best PracticesAre You Ready for 12c? Data Migration and Upgrade Best Practices
Are You Ready for 12c? Data Migration and Upgrade Best Practices
 
12c on RHEL7
12c on RHEL712c on RHEL7
12c on RHEL7
 
Ebs clone r12.2.4
Ebs clone r12.2.4Ebs clone r12.2.4
Ebs clone r12.2.4
 
Install oracle grid infrastructure on linux 6.6
Install oracle grid infrastructure on linux 6.6Install oracle grid infrastructure on linux 6.6
Install oracle grid infrastructure on linux 6.6
 
Installing oracle timesten database On Linux
Installing oracle timesten database On Linux Installing oracle timesten database On Linux
Installing oracle timesten database On Linux
 
12c installation
12c installation12c installation
12c installation
 
Eouc 12 on 12c osama mustafa
Eouc 12 on 12c osama mustafaEouc 12 on 12c osama mustafa
Eouc 12 on 12c osama mustafa
 
Install and upgrade Oracle grid infrastructure 12.1.0.2
Install and upgrade Oracle grid infrastructure 12.1.0.2Install and upgrade Oracle grid infrastructure 12.1.0.2
Install and upgrade Oracle grid infrastructure 12.1.0.2
 
Oracle api gateway installation as cluster and single node
Oracle api gateway installation as cluster and single nodeOracle api gateway installation as cluster and single node
Oracle api gateway installation as cluster and single node
 
Step by Step Restore rman to different host
Step by Step Restore rman to different hostStep by Step Restore rman to different host
Step by Step Restore rman to different host
 
Step by Step to Install oracle grid 11.2.0.3 on solaris 11.1
Step by Step to Install oracle grid 11.2.0.3 on solaris 11.1Step by Step to Install oracle grid 11.2.0.3 on solaris 11.1
Step by Step to Install oracle grid 11.2.0.3 on solaris 11.1
 
Oracle business intelligence enterprise edition 11g
Oracle business intelligence enterprise edition 11gOracle business intelligence enterprise edition 11g
Oracle business intelligence enterprise edition 11g
 
Oracle Linux 7 Beta First Look (Installations)
Oracle Linux 7 Beta First Look (Installations)Oracle Linux 7 Beta First Look (Installations)
Oracle Linux 7 Beta First Look (Installations)
 
21 Rac
21 Rac21 Rac
21 Rac
 
Install oracle solaris 11.2 using gui
Install oracle solaris 11.2 using guiInstall oracle solaris 11.2 using gui
Install oracle solaris 11.2 using gui
 
61 Rac
61 Rac61 Rac
61 Rac
 
Oracle data guard configuration in 12c
Oracle data guard configuration in 12cOracle data guard configuration in 12c
Oracle data guard configuration in 12c
 
41 Pdfsam
41 Pdfsam41 Pdfsam
41 Pdfsam
 
10 ways to improve your rman script
10 ways to improve your rman script10 ways to improve your rman script
10 ways to improve your rman script
 
141 Rac
141 Rac141 Rac
141 Rac
 

Destacado

competitive pricing in business market
competitive pricing in business marketcompetitive pricing in business market
competitive pricing in business market
welcometofacebook
 
firm performance presentation(INDUSTRAT)
firm performance presentation(INDUSTRAT)firm performance presentation(INDUSTRAT)
firm performance presentation(INDUSTRAT)
welcometofacebook
 
Database reports generation(database)
Database reports generation(database)Database reports generation(database)
Database reports generation(database)
welcometofacebook
 

Destacado (20)

Oracle Compute Cloud Service vs. Amazon Web Services EC2 : A Hands-On Review
Oracle Compute Cloud Service vs. Amazon Web Services EC2 : A Hands-On ReviewOracle Compute Cloud Service vs. Amazon Web Services EC2 : A Hands-On Review
Oracle Compute Cloud Service vs. Amazon Web Services EC2 : A Hands-On Review
 
competitive pricing in business market
competitive pricing in business marketcompetitive pricing in business market
competitive pricing in business market
 
Oracle tutorial
Oracle tutorialOracle tutorial
Oracle tutorial
 
25605 tutorial migrasi database dari my sql ke oracle ( kelompok 9 )
25605 tutorial migrasi database dari my sql ke oracle ( kelompok 9 )25605 tutorial migrasi database dari my sql ke oracle ( kelompok 9 )
25605 tutorial migrasi database dari my sql ke oracle ( kelompok 9 )
 
firm performance presentation(INDUSTRAT)
firm performance presentation(INDUSTRAT)firm performance presentation(INDUSTRAT)
firm performance presentation(INDUSTRAT)
 
Database reports generation(database)
Database reports generation(database)Database reports generation(database)
Database reports generation(database)
 
Migrasi database mysql ke oracle-sql developer
Migrasi database mysql ke oracle-sql developerMigrasi database mysql ke oracle-sql developer
Migrasi database mysql ke oracle-sql developer
 
Oracle Database View
Oracle Database ViewOracle Database View
Oracle Database View
 
Cloud Trends 2017
Cloud Trends 2017Cloud Trends 2017
Cloud Trends 2017
 
Aws S3 uploading tricks 2016
Aws S3 uploading tricks 2016Aws S3 uploading tricks 2016
Aws S3 uploading tricks 2016
 
Oracle smart flash cache
Oracle smart flash cacheOracle smart flash cache
Oracle smart flash cache
 
Exadata Smart Scan - What is so smart about it?
Exadata Smart Scan  - What is so smart about it?Exadata Smart Scan  - What is so smart about it?
Exadata Smart Scan - What is so smart about it?
 
Tutorial Migrasi Database dari Microsoft SQL Server ke Oracle Database
Tutorial Migrasi Database dari Microsoft SQL Server ke Oracle DatabaseTutorial Migrasi Database dari Microsoft SQL Server ke Oracle Database
Tutorial Migrasi Database dari Microsoft SQL Server ke Oracle Database
 
AWR & ASH Analysis
AWR & ASH AnalysisAWR & ASH Analysis
AWR & ASH Analysis
 
Oracl DBA lab manual
Oracl DBA lab manualOracl DBA lab manual
Oracl DBA lab manual
 
Oracle sql tutorial
Oracle sql tutorialOracle sql tutorial
Oracle sql tutorial
 
Oracle Tablespace - Basic
Oracle Tablespace - BasicOracle Tablespace - Basic
Oracle Tablespace - Basic
 
Review Oracle OpenWorld 2015 - Overview, Main themes, Announcements and Future
Review Oracle OpenWorld 2015 - Overview, Main themes, Announcements and FutureReview Oracle OpenWorld 2015 - Overview, Main themes, Announcements and Future
Review Oracle OpenWorld 2015 - Overview, Main themes, Announcements and Future
 
Tell Me Something About Yourself - Job Interview Answers.
Tell Me Something About Yourself - Job Interview Answers.Tell Me Something About Yourself - Job Interview Answers.
Tell Me Something About Yourself - Job Interview Answers.
 
Oracle Database Trigger
Oracle Database TriggerOracle Database Trigger
Oracle Database Trigger
 

Similar a Pluggable database tutorial

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
 
12c: Testing audit features for Data Pump (Export & Import) and RMAN jobs
12c: Testing audit features for Data Pump (Export & Import) and RMAN jobs12c: Testing audit features for Data Pump (Export & Import) and RMAN jobs
12c: Testing audit features for Data Pump (Export & Import) and RMAN jobs
Monowar Mukul
 
oracle cloud with 2 nodes processing
oracle cloud with 2 nodes processingoracle cloud with 2 nodes processing
oracle cloud with 2 nodes processing
mahdi ahmadi
 

Similar a Pluggable database tutorial (20)

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
 
Database decommission process
Database decommission processDatabase decommission process
Database decommission process
 
Clone_a_remote_PDB_in_Data_Guard_Environments_19c_1698741799.pdf
Clone_a_remote_PDB_in_Data_Guard_Environments_19c_1698741799.pdfClone_a_remote_PDB_in_Data_Guard_Environments_19c_1698741799.pdf
Clone_a_remote_PDB_in_Data_Guard_Environments_19c_1698741799.pdf
 
12c db upgrade from 11.2.0.4
12c db upgrade from 11.2.0.412c db upgrade from 11.2.0.4
12c db upgrade from 11.2.0.4
 
12c: Testing audit features for Data Pump (Export & Import) and RMAN jobs
12c: Testing audit features for Data Pump (Export & Import) and RMAN jobs12c: Testing audit features for Data Pump (Export & Import) and RMAN jobs
12c: Testing audit features for Data Pump (Export & Import) and RMAN jobs
 
br_test_lossof-datafile_10g.doc
br_test_lossof-datafile_10g.docbr_test_lossof-datafile_10g.doc
br_test_lossof-datafile_10g.doc
 
oracle cloud with 2 nodes processing
oracle cloud with 2 nodes processingoracle cloud with 2 nodes processing
oracle cloud with 2 nodes processing
 
Db health check
Db health checkDb health check
Db health check
 
Physical_Standby_Database_R12.2.4
Physical_Standby_Database_R12.2.4Physical_Standby_Database_R12.2.4
Physical_Standby_Database_R12.2.4
 
How to create a pluggable database by cloning an existing local pdb
How to create a pluggable database by cloning an existing local pdbHow to create a pluggable database by cloning an existing local pdb
How to create a pluggable database by cloning an existing local pdb
 
oracle dba
oracle dbaoracle dba
oracle dba
 
New Features for Multitenant in Oracle Database 21c
New Features for Multitenant in Oracle Database 21cNew Features for Multitenant in Oracle Database 21c
New Features for Multitenant in Oracle Database 21c
 
Oracle 12c Automatic Data Optimization (ADO) - ILM
Oracle 12c Automatic Data Optimization (ADO) - ILMOracle 12c Automatic Data Optimization (ADO) - ILM
Oracle 12c Automatic Data Optimization (ADO) - ILM
 
TrinityCore server install guide
TrinityCore server install guideTrinityCore server install guide
TrinityCore server install guide
 
Odv oracle customer_demo
Odv oracle customer_demoOdv oracle customer_demo
Odv oracle customer_demo
 
Less04 Instance
Less04 InstanceLess04 Instance
Less04 Instance
 
Oracle 12c Multi Tenant
Oracle 12c Multi TenantOracle 12c Multi Tenant
Oracle 12c Multi Tenant
 
Oracle database 12.2 new features
Oracle database 12.2 new featuresOracle database 12.2 new features
Oracle database 12.2 new features
 
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
 

Más de Osama Mustafa

Más de Osama Mustafa (20)

Case study for software architect
Case study for software architectCase study for software architect
Case study for software architect
 
DevOps for database
DevOps for databaseDevOps for database
DevOps for database
 
Does cloud mean the end of the dba
Does cloud mean the end of the dbaDoes cloud mean the end of the dba
Does cloud mean the end of the dba
 
Using git hub for your code
Using git hub for your codeUsing git hub for your code
Using git hub for your code
 
DevOps Project
DevOps Project DevOps Project
DevOps Project
 
Java business service
Java business serviceJava business service
Java business service
 
Steps creating data_integration_services
Steps creating data_integration_servicesSteps creating data_integration_services
Steps creating data_integration_services
 
Build, Deploy and Run Node Js Application on Azure using Docker
Build, Deploy and Run Node Js Application on Azure using DockerBuild, Deploy and Run Node Js Application on Azure using Docker
Build, Deploy and Run Node Js Application on Azure using Docker
 
Helping implementer dealing with famous siebel based system messages and er...
Helping implementer dealing with famous siebel   based system messages and er...Helping implementer dealing with famous siebel   based system messages and er...
Helping implementer dealing with famous siebel based system messages and er...
 
Weblogic and docker
Weblogic and dockerWeblogic and docker
Weblogic and docker
 
Weblogic 101 for dba
Weblogic  101 for dbaWeblogic  101 for dba
Weblogic 101 for dba
 
Oracle obia 11.1.1.10.1 installation
Oracle obia 11.1.1.10.1 installation Oracle obia 11.1.1.10.1 installation
Oracle obia 11.1.1.10.1 installation
 
Oracle Enterprise manager 13c Installation
Oracle Enterprise manager 13c InstallationOracle Enterprise manager 13c Installation
Oracle Enterprise manager 13c Installation
 
Erp installation r12.2
Erp installation r12.2Erp installation r12.2
Erp installation r12.2
 
OBIA Installation
OBIA Installation OBIA Installation
OBIA Installation
 
Install oracle siebel on windows 2008 r2
Install oracle siebel on windows 2008 r2Install oracle siebel on windows 2008 r2
Install oracle siebel on windows 2008 r2
 
Oracle autovue
Oracle autovueOracle autovue
Oracle autovue
 
How to apply new patch on siebel 8.2.2.4
How to apply new patch on siebel 8.2.2.4How to apply new patch on siebel 8.2.2.4
How to apply new patch on siebel 8.2.2.4
 
J2ee user managment using dwh builder
J2ee user managment using dwh builderJ2ee user managment using dwh builder
J2ee user managment using dwh builder
 
How to add storage to esxi 5.5
How to add storage to esxi 5.5How to add storage to esxi 5.5
How to add storage to esxi 5.5
 

Último

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 

Último (20)

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelNavi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 

Pluggable database tutorial

  • 1. Pluggable Database Tutorial Part 1 Osama Mustafa Page 1 [oracle@test12c Desktop]$ sqlplus / as sysdba SQL*Plus: Release 12.1.0.1.0 Production on Wed Jul 3 19:05:10 2013 Copyright (c) 1982, 2013, Oracle. All rights reserved. Connected to: Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production With the Partitioning, OLAP, Advanced Analytics, Real Application Testing and Unified Auditing options SQL>show con_name CON_NAME ------------------- CDB$ROOT Where CON_NAME: Displays the name of the Container to which you are connected when connected to a Consolidated Database. For non-consolidated database, it will return "Non Consolidated". SQL>show con_id CON_ID ------------ 1 Where CON_ID: Displays the id of the Container to which you are connected when connected to a Consolidated Database. If issued when connected to a non-Consolidated Database, this command returns 0.
  • 2. Pluggable Database Tutorial Part 1 Osama Mustafa Page 2 Now I want to check how Name for my my pluggable database , while installation i chosen five container with prefix db_ SQL>select name, con_id from v$active_services order by 1; NAME CON_ID SYS$BACKGROUND 1 SYS$USERS 1 db12c 1 db12cXDB 1 Db_1 2 Db_2 3 Listener will look like the below: Example how to connect Container, In my case i didn't create service in tnsnames.ora i am using easy connect: SQL>conn sys/sys@localhost:1521/db_1 as sysdba Connected. SQL>show con_name CON_NAME ---------------- DB_1 SQL>show con_id
  • 3. Pluggable Database Tutorial Part 1 Osama Mustafa Page 3 CON_ID ------------ 3 Work On Pluggable Database: After create Container and enable pluggable database, we need to add new one since container empty. Under /u01/app/oracle/oradata ,create new folder [oracle@test12c db12c]$ mkdir test [oracle@test12c db12c]$ chmod -R 775 test Sqlplus / as sysdba SQL >create pluggable database TEST admin user admin identified by admin file_name_convert= ('/u01/app/oracle/oradata/db12c/pdbseed/','/u01/app/oracle/oradata/db12c/test/'); Pluggable database created. SQL>select pdb_name, status from cdb_pdbs; PDB_NAME Status ----------------------- ------------ PDB$SEED NORMAL TEST NEW SQL>select name, open_mode from v$pdbs; NAME OPEN_MODE ------------------------------ ---------- PDB$SEED READ ONLY TEST MOUNTED SQL>select name, con_id from v$active_services order by 1; NAME CON_ID ---------------------------------------------- SYS$BACKGROUND 1 SYS$USERS 1 db12c 1 db12cXDB 1 TEST 3
  • 4. Pluggable Database Tutorial Part 1 Osama Mustafa Page 4 Now Con_id=3 , Most of Oracle Data Dictionary contains new_column called con_id , to check datafile related to new pluaggable database : SQL>select name from v$datafile where con_id=3 ; NAME -------------------------------------------------------------------------------- /u01/app/oracle/oradata/db12c/gls/system01.dbf /u01/app/oracle/oradata/db12c/gls/sysaux01.dbf Manage Oracle Container and Pluggable Database : If you need to shutdown container, it will not be different as before: SQL>show con_name CON_NAME ------------------------------ CDB$ROOT SQL>shutdown ; Database closed. Database dismounted. ORACLE instance shut down. SQL>startup ; ORACLE instance started. Total System Global Area 1252663296 bytes Fixed Size 2287864 bytes Variable Size 788530952 bytes Database Buffers 452984832 bytes Redo Buffers 8859648 bytes Database mounted. Database opened. Check status for PDB : SQL>select name, open_mode from v$pdbs; NAME OPEN_MODE ------------------------------ ---------- PDB$SEED READ ONLY TEST MOUNTED
  • 5. Pluggable Database Tutorial Part 1 Osama Mustafa Page 5 If you the above Status for Test Database you will see it as mounted state which mean we cannot create anything yet on database, Let's Open it SQL>alter pluggable database TEST open; Pluggable database altered. SQL>select name,open_mode from v$pdbs ; NAME OPEN_MODE ------------------------------ ---------- PDB$SEED READ ONLY TEST READ WRITE The same for close Option SQL>alter pluggable database TEST close immediate; Pluggable database altered. SQL>select name,open_mode from v$pdbs ; NAME OPEN_MODE ------------------------------ ---------- PDB$SEED READ ONLY TEST MOUNTED Now you can open/close all pluggable database : SQL >Alter pluggable database all Open; SQL >Alter pluggable database all close ; SQL>select tablespace_name, con_id from cdb_tablespaces where con_id=3 ; TABLESPACE_NAME CON_ID ------------------------------ ---------- SYSTEM 3 SYSAUX 3 TEMP 3 to get data file SQL>select file_name, con_id from cdb_data_files where con_id=3 ; NAME -------------------------------------------------------------------------------- /u01/app/oracle/oradata/db12c/gls/system01.dbf /u01/app/oracle/oradata/db12c/gls/sysaux01.dbf
  • 6. Pluggable Database Tutorial Part 1 Osama Mustafa Page 6 SQL>select file_name, con_id from cdb_temp_files where con_id=3; FILE_NAME CON_ID ------------------------------------------ /u01/app/oracle/oradata/db12c/gls/pdbseed_temp01.dbf 3 If you do the below query to create table space, it will not be created under TEST database, therefore it will be created on root : SQL >create tablespace cdata datafile '/u01/app/oracle/oradata/db12c/gls/test.dbf' SIZE 30M; SQL>select tablespace_name, con_id from cdb_tablespaces order by con_id; TABLESPACE_NAME CON_ID ------------------------------ ---------- SYSTEM 1 CDATA 1 SYSAUX 1 TEMP 1 UNDOTBS1 1 USERS 1 SYSTEM 2 TEMP 2 SYSAUX 2 SYSTEM 3 SYSAUX 3 TEMP 3 12 rows selected. Same for temp tablespace : SQL>create temporary tablespace root_temp tempfile '/u01/app/oracle/oradata/db12c/temp_01.dbf' SIZE 30M; If you need to create Tablespace in pluggable database follow the below, you have to options  connect to pluggable database in our case test using tnsnames.ora or easy connect o connect sys/sys@localhost:1521/test  alter session command line o alter session set container= <Name>
  • 7. Pluggable Database Tutorial Part 1 Osama Mustafa Page 7 SQL>alter session set container=TEST; Session altered. SQL>create tablespace pdb_test datafile '/u01/app/oracle/oradata/db12c/TEST/test_pdb.dbf' SIZE 20M; Tablespace created. SQL>select tablespace_name, con_id from cdb_tablespaces order by con_id; TABLESPACE_NAME CON_ID ------------------------------ ---------- SYSTEM 3 SYSAUX 3 TEMP 3 PDB_TEST 3 Same for temporary table space, next post i will provide another manage for pluggable database. Reference: 1- oracle Documentation Here 2- Oracle Documentation Here