Connect to a PDB of Oracle12c, pdboracle12c

Source: Internet
Author: User

Connect to a PDB of Oracle12c, pdboracle12c
Story about CDB and PDB

Oracle12c has a new feature and definition of CDB and PDB. if you first use 12c you will get confused like me. so that is necessary to know some basic definitions before you start. oracle's official document is always the best material.

What is CBD and PDB and why introduce them?


Login a CBD
[oracle@ol65 ~]$ <strong>sqlplus /nolog</strong>SQL*Plus: Release 12.1.0.2.0 Production on Mon Oct 27 23:07:56 2014Copyright (c) 1982, 2014, Oracle.  All rights reserved.SQL> conn sys@orcl as sysdbaEnter password: Connected.SQL> sho con_nameCON_NAME------------------------------CDB$ROOTSQL> 
** Sho con_name-show current container name. Root container is always called CDB # ROOT.

How many PDBs in your root container now?
SQL> sho pdbs    CON_ID CON_NAME  OPEN MODE  RESTRICTED---------- ------------------------------ ---------- ---------- 2 PDB$SEED  READ ONLY  NO 3 PDBORCL  MOUNTEDSQL> 

** PDB $ SEED is a seed PDB, as its name Oracle12c will take is
Default status of a new PDB is mounted. It's not running, you have to 'open' it before you start using it.
Open a PDBYou must have sysdba privilege.
SQL> alter pluggable database PDBORCL open;Pluggable database altered.SQL> sho pdbs    CON_ID CON_NAME  OPEN MODE  RESTRICTED---------- ------------------------------ ---------- ---------- 2 PDB$SEED  READ ONLY  NO 3 PDBORCL  READ WRITE NOSQL> 

Login a PDB
SQL> sho con_nameCON_NAME------------------------------CDB$ROOTSQL> alter session set container=PDBORCL;Session altered.SQL> sho con_nameCON_NAME------------------------------PDBORCLSQL> 
Now you login a PDB. now you can create a new user as you operate a Oracle DB before 12c. this user is not common user. it's a user for this PDB. you also can understand PDB as a general DB of the version before 12c.
Login Root Container again and Stop a PDB
SQL> conn sys as sysdbaEnter password: Connected.SQL> alter pluggable database PDBORCL close immediate;Pluggable database altered.SQL> 

Register a Entry of a PDBEdit config file/$ ORACLE_HOME/network/admin/tnsnames. ora.
ORCL =  (DESCRIPTION =    (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))    (CONNECT_DATA =      (SERVER = DEDICATED)      (SERVICE_NAME = orcl.localdomain)    )  )<strong>PDBORCL =  (DESCRIPTION =    (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))    (CONNECT_DATA =      (SERVER = DEDICATED)      (SERVICE_NAME = pdborcl.localdomain)    )  )</strong>
Save and quit. Go to open this PDB again. Now you can access PDBORCL by service name.
[oracle@ol65 admin]$ sqlplus sys@pdborcl as sysdbaSQL*Plus: Release 12.1.0.2.0 Production on Tue Oct 28 00:08:52 2014Copyright (c) 1982, 2014, Oracle.  All rights reserved.Enter password: Connected to:Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit ProductionWith the Partitioning, OLAP, Advanced Analytics and Real Application Testing optionsSQL> 
And the most importance is that now you are able to remotely connect this PDB!
Now you application can use this DB as well.

Oracle12c does not have scott user

Yes, because the pdb connection requires listening and tns. You must first establish a tns connection to pdb, and then change the utlsampl. SQL script. The connection string is missing after connect scott/tiger.


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.