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 2014

Copyright (c) 1982, 2014, Oracle.  All rights reserved.

SQL> conn sys@orcl as sysdba
Enter password:
Connected.
SQL> sho con_name CON_NAME
------------------------------
CDB$ROOT
SQL>

** 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 MOUNTED
SQL>

** 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 PDB

You 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 NO
SQL>

Login a PDB

SQL> sho con_name

CON_NAME
------------------------------
CDB$ROOT
SQL> alter session set container=PDBORCL; Session altered. SQL> sho con_name CON_NAME
------------------------------
PDBORCL
SQL>

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 sysdba
Enter password:
Connected.
SQL> alter pluggable database PDBORCL close immediate; Pluggable database altered. SQL>

Register a Entry of a PDB

Edit 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)
)
) PDBORCL =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = pdborcl.localdomain)
)
)
Save and quit. Go to open this PDB again. Now you can access PDBORCL by service name.
[oracle@ol65 admin]$ sqlplus sys@pdborcl as sysdba

SQL*Plus: Release 12.1.0.2.0 Production on Tue Oct 28 00:08:52 2014

Copyright (c) 1982, 2014, Oracle.  All rights reserved.

Enter password: 

Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options SQL>

And the most importance is that now you are able to remotely connect this PDB!


Now you application can use this DB as well.

[Oracle] - Connect to a PDB of Oracle12c的更多相关文章

  1. Oracle “CONNECT BY” 使用 [转]

    Oracle “CONNECT BY”是层次查询子句,一般用于树状或者层次结果集的查询.其语法是: 1 [ START WITH condition ]2 CONNECT BY [ NOCYCLE ] ...

  2. Oracle “CONNECT BY” 使用

    Oracle “CONNECT BY” 使用 功能说明: 语法结构如下: [ START WITH condition ] CONNECT BY [ NOCYCLE ] condition 说明: 1 ...

  3. Oracle下载与Oracle安装图解(Oracle19c,Oracle18c,Oracle12c,Oracle11g)

    Oracle下载与Oracle安装图解(Oracle19c,Oracle18c,Oracle12c,Oracle11g) 1.Oracle下载(Oracle11g) oracle下载方法,请根据以下步 ...

  4. Oracle “CONNECT BY” (层级递归查询)

    Oracle “CONNECT BY”是层次查询子句,一般用于树状或者层次结果集的查询.其语法是: ? 1 2 [ START WITH condition ] CONNECT BY [ NOCYCL ...

  5. Oracle “CONNECT BY” 用法

    Oracle “CONNECT BY”是层次查询子句,一般用于树状或者层次结果集的查询.其语法是: [ START WITH condition ] CONNECT BY [ NOCYCLE ] co ...

  6. Oracle 12C CDB、PDB常用管理命令

    Oracle 12C CDB.PDB常用管理命令 --查看PDB信息(在CDB模式下) show pdbs  --查看所有pdbselect name,open_mode from v$pdbs;  ...

  7. 转 Oracle 12C 之 CDB/PDB用户的创建与对象管理

    在Oracle 12C中,账号分为两种,一种是公用账号,一种是本地账号(亦可理解为私有账号).共有账号是指在CDB下创建,并在全部PDB中生效的账号,另一种是在PDB中创建的账号. 针对这两种账号的测 ...

  8. Oracle 12c 如何在 PDB 中添加 SCOTT 模式(手工方式)

    Oracle 12c 建库后,没有 scott 模式,本篇使用手工脚本方式,在12c版本中创建 scott 模式及相关表. 目录 1. PDB中创建用户 2. PDB中用户授权 3. PDB中创建表空 ...

  9. Oracle 12c 如何在 PDB 中添加 SCOTT 模式(数据泵方式)

    Oracle 12c 建库后,没有 scott 模式,本篇使用数据泵方式,在12c版本之前数据库中 expdp 导出 scott 模式,并连接 12c 的 pdb 进行 impdp 导入. 目录 1. ...

随机推荐

  1. javascript设计模式-单体模式

    场景:假设有一个Girl(美女)实体,该实体拥有姓名.年龄两个属性,拥有显示姓名和洗澡两个方法,下面分步骤构造该实体. 1.用简单基本单体模式: var Girl1 = { name:"昭君 ...

  2. git 本地项目推送至远程仓库

    1 在本地文件夹下创建一个 Git 仓库(如test目录下) git init 2 此时test文件夹即是你的maste主分支,你可以在改文件夹下写自己的项目 3 将test文件夹下的内容提交至暂存区 ...

  3. 乐字节-Java8核心特性实战-接口默认方法

    JAVA8已经发布很久,是自java5(2004年发布)之后Oracle发布的最重要的一个版本.其中包括语言.编译器.库.工具和JVM等诸多方面的新特性,对于国内外互联网公司来说,Java8是以后技术 ...

  4. 10-XML

    今日知识 1. xml * 概念 * 语法 * 解析 xml概念 1. 概念:Extensible Markup Language 可扩展标记语言 * 可扩展:标签都是自定义的. <user&g ...

  5. ACM_支离破碎(递推dp)

    支离破碎 Time Limit: 4000/2000ms (Java/Others) Problem Description: 远古时期有一位魔王想向一座宫殿里的公主求婚.为了考验魔王的智力,太后给了 ...

  6. guice基本使用,guice整合guice-servlet,web开发(五)

    介绍 Guice Servlet 为使用web应用程序和Servlet容器提供了一个完整的模式.. Guice's servlet 扩展允许从你的servlet应用中完全淘汰web.xml,并且具有类 ...

  7. 10.2&10.3 Xcode开发包

    10.2开发包下载链接 10.3开发包下载链接 Finder打开后,按command+shift+G前往这个地址: /Applications/Xcode.app/Contents/Developer ...

  8. 4.Projects and Scenes介绍

    1.Project 一个项目是由一系列的文件(如图片.音频.几何).场景以及vzp文件组成.这些文件被导入到项目对应的文件夹中.项目外部资源在场景中被使用后,会导入项目中,除非该资源被标记为外部引用. ...

  9. poj1149 PIGS 最大流(神奇的建图)

    一开始不看题解,建图出错了.后来发现是题目理解错了.  if Mirko wants, he can redistribute the remaining pigs across the unlock ...

  10. MemCached总结二:数据管理指令

    管理memcached中的数据包括添加(add).修改(set).删除(delete)及获取(get)等操作. 命令格式: 1.set set userId 0 0 5 12345 STORED ge ...