How to connect an Oracle 12c pluggable database

Source: Internet
Author: User
Tags dba

To start the root container:
[Oracle@eric ~]$ Export Oracle_sid=cup
[Oracle@eric ~]$ Sqlplus/as SYSDBA
Sql*plus:release 12.1.0.2.0 Production on Wed Jan 21 16:00:06 2015
Copyright (c) 1982, Oracle. All rights reserved.
Connected to an idle instance.
Sql> Startup-----will not start all pluggable databases directly, if you want to start all pluggable databases, execute the command: Alter pluggable database all open
ORACLE instance started.
Total System Global area 767557632 bytes
Fixed Size 2929112 bytes
Variable Size 574623272 bytes
Database buffers 184549376 bytes
Redo buffers 5455872 bytes
Database mounted.
Database opened.
To stop the root container:
sql> shutdown Immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
See if the CDB is created, if there is a display name:
Sql> select name,cdb from V$database;
NAME CDB
--------- ---
CUP YES

Sql> Show parameter service;

NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
Service_names String Cup
Look at the container name, which has 3 containers: the root container, the seed container, and the container you created:
Sql> select Con_id,name from V$containers;

con_id NAME
---------- ------------------------------
1 Cdb$root---root container
2 pdb$seed---Seed container, readable only
3 TEA---Pluggable database created by itself

Sql> select file_name from Dba_data_files;
file_name
--------------------------------------------------------------------------------
/oracle/app/oradata/cup/datafile/o1_mf_system_bch07kvz_.dbf
/oracle/app/oradata/cup/datafile/o1_mf_sysaux_bch020oo_.dbf
/oracle/app/oradata/cup/datafile/o1_mf_undotbs1_bch0d2on_.dbf
/oracle/app/oradata/cup/datafile/o1_mf_users_bch0d15n_.dbf

Sql> select file_name from Cdb_data_files;

file_name
--------------------------------------------------------------------------------
/oracle/app/oradata/cup/datafile/o1_mf_system_bch07kvz_.dbf
/oracle/app/oradata/cup/datafile/o1_mf_sysaux_bch020oo_.dbf
/oracle/app/oradata/cup/datafile/o1_mf_undotbs1_bch0d2on_.dbf
/oracle/app/oradata/cup/datafile/o1_mf_users_bch0d15n_.dbf
To create a public user:
sql> Create User C # #eric identified by Gao;
User created.
Sql> Conn C # #eric/gao
ERROR:
Ora-01045:user C # #ERIC lacks CREATE SESSION privilege; Logon denied----have no permissions, we can give it permission individually, or we can assign a role to it.
Warning:you is no longer connected to ORACLE.
Sql> Conn/as SYSDBA
Connected.
Sql> Grant DBA to C # #eric Container=all; ---to its DBA role, with a role scope covering all containers
Grant succeeded.

Sql> Conn C # #eric/gao
Connected. ---connection succeeded

To switch containers:
Start the container database that you created first:
sql> Alter pluggable database tea open; ---Start the PDB database first

Sql> ALTER session Set container = Tea;

Session altered.

Sql> Show Con_name---View the current container name
Con_name
------------------------------
TEA
To turn off pluggable databases:
sql> Alter pluggable database tea close immediate;
Pluggable database altered.

How to connect an Oracle 12c pluggable database

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.