ORACLE 12C PDB 维护基础介绍
来自:http://www.xifenfei.com/2013/05/oracle-12c-pdb-%E7%AE%A1%E7%90%86%E4%BB%8B%E7%BB%8D1.html
CDB和PDB是ORACLE 12C一个很亮的新特性,由于他们的引入导致传统的ORACLE数据库管理理念不少发生了改变,这里列举了部分最基本的cdb和pdb管理方式
cdb和pdb关系图
ORACLE 12C版本
SQL> select * from v$version; BANNER CON_ID -------------------------------------------------------------------------------- ---------- Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production 0 PL/SQL Release 12.1.0.1.0 - Production 0 CORE 12.1.0.1.0 Production 0 TNS for Linux: Version 12.1.0.1.0 - Production 0 NLSRTL Version 12.1.0.1.0 - Production 0 |
启动关闭pdb
SQL> startup ORACLE instance started. Total System Global Area 597098496 bytes Fixed Size 2291072 bytes Variable Size 272632448 bytes Database Buffers 314572800 bytes Redo Buffers 7602176 bytes Database mounted. Database opened. SQL> select con_id,dbid, NAME ,OPEN_MODE from v$pdbs; CON_ID DBID NAME OPEN_MODE ---------- ---------- ------------------------------ ---------- 2 4048821679 PDB$SEED READ ONLY 3 3313918585 PDB1 MOUNTED 4 3872456618 PDB2 MOUNTED SQL> alter PLUGGABLE database pdb1 open ; Pluggable database altered. SQL> select con_id,dbid, NAME ,OPEN_MODE from v$pdbs; CON_ID DBID NAME OPEN_MODE ---------- ---------- ------------------------------ ---------- 2 4048821679 PDB$SEED READ ONLY 3 3313918585 PDB1 READ WRITE 4 3872456618 PDB2 MOUNTED SQL> alter PLUGGABLE database pdb1 close ; Pluggable database altered. SQL> select con_id,dbid, NAME ,OPEN_MODE from v$pdbs; CON_ID DBID NAME OPEN_MODE ---------- ---------- ------------------------------ ---------- 2 4048821679 PDB$SEED READ ONLY 3 3313918585 PDB1 MOUNTED 4 3872456618 PDB2 MOUNTED SQL> alter PLUGGABLE database all open ; Pluggable database altered. SQL> select con_id,dbid, NAME ,OPEN_MODE from v$pdbs; CON_ID DBID NAME OPEN_MODE ---------- ---------- ------------------------------ ---------- 2 4048821679 PDB$SEED READ ONLY 3 3313918585 PDB1 READ WRITE 4 3872456618 PDB2 READ WRITE SQL> alter PLUGGABLE database all close ; Pluggable database altered. SQL> select con_id,dbid, NAME ,OPEN_MODE from v$pdbs; CON_ID DBID NAME OPEN_MODE ---------- ---------- ------------------------------ ---------- 2 4048821679 PDB$SEED READ ONLY 3 3313918585 PDB1 MOUNTED 4 3872456618 PDB2 MOUNTED SQL> alter session set container=pdb1; Session altered. SQL> startup Pluggable Database opened. SQL> select con_id,dbid, NAME ,OPEN_MODE from v$pdbs; CON_ID DBID NAME OPEN_MODE ---------- ---------- ------------------------------ ---------- 3 3313918585 PDB1 READ WRITE |
pdb的管理可以在cdb中进行也可以在pdb中进行,如果是cdb中进行,需要PLUGGABLE关键字,如果是pdb中直接和普通数据库一样
登录pdb
[oracle@xifenfei ~]$ lsnrctl status LSNRCTL for Linux: Version 12.1.0.1.0 - Production on 12-MAY-2013 08:07:02 Copyright (c) 1991, 2013, Oracle. All rights reserved. Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=xifenfei)(PORT=1521))) STATUS of the LISTENER ------------------------ Alias LISTENER Version TNSLSNR for Linux: Version 12.1.0.1.0 - Production Start Date 11-MAY-2013 18:30:54 Uptime 0 days 13 hr. 36 min . 8 sec Trace Level off Security ON : Local OS Authentication SNMP OFF Listener Parameter File /u01/app/grid/product/12.1/network/admin/listener.ora Listener Log File /u01/app/grid/diag/tnslsnr/xifenfei/listener/alert/log.xml Listening Endpoints Summary... (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)( KEY =EXTPROC1521))) (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=xifenfei)(PORT=1521))) (DESCRIPTION=(ADDRESS=(PROTOCOL=tcps)(HOST=xifenfei)(PORT=5500)) (Security=(my_wallet_directory=/u01/oracle/12.1/db_1/admin/cdb/xdb_wallet))(Presentation=HTTP)(Session=RAW)) Services Summary... Service "+ASM" has 1 instance(s). Instance "+ASM" , status READY, has 1 handler(s) for this service... Service "cdb" has 1 instance(s). Instance "cdb" , status READY, has 1 handler(s) for this service... Service "cdbXDB" has 1 instance(s). Instance "cdb" , status READY, has 1 handler(s) for this service... Service "pdb1" has 1 instance(s). Instance "cdb" , status READY, has 1 handler(s) for this service... Service "pdb2" has 1 instance(s). Instance "cdb" , status READY, has 1 handler(s) for this service... The command completed successfully [oracle@xifenfei ~]$ tnsping pdb1 TNS Ping Utility for Linux: Version 12.1.0.1.0 - Production on 12-MAY-2013 08:07:09 Copyright (c) 1997, 2013, Oracle. All rights reserved. Used parameter files: Used TNSNAMES adapter to resolve the alias Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = xifenfei) (PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = pdb1))) OK (20 msec) [oracle@xifenfei ~]$ sqlplus sys/xifenfei@pdb1 as sysdba SQL*Plus: Release 12.1.0.1.0 Production on Sun May 12 08:08:02 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, Automatic Storage Management, OLAP, Advanced Analytics and Real Application Testing options SQL> show con_name; CON_NAME ------------------------------ PDB1 [oracle@xifenfei ~]$ sqlplus / as sysdba SQL*Plus: Release 12.1.0.1.0 Production on Sun May 12 08:09:14 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, Automatic Storage Management, OLAP, Advanced Analytics and Real Application Testing options SQL> alter session set container=pdb1; Session altered. SQL> show con_name; CON_NAME ------------------------------ PDB1 |
pdb可以通过alter session container进入也可以直接通过tns方式登录
创建用户
SQL> show con_name; CON_NAME ------------------------------ CDB$ROOT SQL> select con_id,dbid, NAME ,OPEN_MODE from v$pdbs; CON_ID DBID NAME OPEN_MODE ---------- ---------- ------------------------------ ---------- 2 4048821679 PDB$SEED READ ONLY 3 3313918585 PDB1 READ WRITE 4 3872456618 PDB2 MOUNTED SQL> create user xff identified by xifenfei; create user xff identified by xifenfei * ERROR at line 1: ORA-65096: invalid common user or role name SQL> !oerr ora 65096 65096, 00000, "invalid common user or role name" // *Cause: An attempt was made to create a common user or role with a name // that wass not valid for common users or roles. In addition to // the usual rules for user and role names, common user and role // names must start with C## or c## and consist only of ASCII // characters. // * Action : Specify a valid common user or role name . // SQL> create user c##xff identified by xifenfei; User created. SQL> SELECT USERNAME,CON_ID,USER_ID FROM CDB_USERS WHERE USERNAME= 'C##XFF' ; USERNAME CON_ID USER_ID ---------- ---------- ---------- C##XFF 1 103 C##XFF 3 104 SQL> alter session set container=pdb1; Session altered. SQL> show con_name CON_NAME ------------------------------ PDB1 SQL> create user xff identified by xifenfei; User created. SQL> create user c##abc identified by xifenfei; create user c##abc identified by xifenfei * ERROR at line 1: ORA-65094: invalid local user or role name |
创建用户默认的是container=all,在cdb中只能创建全局用户(c##开头),会在cdb和所有的pdb中创建该用户(但是pdb中的全局用户需要另外授权才能够在pdb中访问)。在pdb中只能创建的用户为本地用户
用户授权
SQL> grant connect to c##xff; Grant succeeded. SQL> select GRANTEE,con_id from cdb_ROLE_PRIVS where GRANTED_ROLE= 'CONNECT' AND GRANTEE= 'C##XFF' ; GRANTEE CON_ID ------------------------------ ---------- C##XFF 1 SQL> grant resource to c##xff container= all ; Grant succeeded. SQL> select GRANTEE,con_id from cdb_ROLE_PRIVS where GRANTED_ROLE= 'RESOURCE' AND GRANTEE= 'C##XFF' ; GRANTEE CON_ID ------------------------------ ---------- C##XFF 1 C##XFF 3 |
用户授权默认情况下是只会给当前container,在cdb中也可以指定container=all,对所有open的pdb且存在该用户都进行授权
修改参数
SQL> alter system set open_cursors=500 container= all ; System altered. SQL> conn sys/xifenfei@pdb1 as sysdba Connected. SQL> show parameter open_cursors; NAME TYPE VALUE ------------------------------------ ----------- ------------------------------ open_cursors integer 500 SQL> alter system set open_cursors=100; alter system set open_cursors=100 * ERROR at line 1: ORA-01219: database or pluggable database not open : queries allowed on fixed tables or views only SQL> alter database open ; Database altered. SQL> alter system set open_cursors=100; System altered. SQL> show parameter open_cursors; NAME TYPE VALUE ------------------------------------ ----------- ------------------------------ open_cursors integer 100 SQL> conn / as sysdba Connected. SQL> show parameter open_cursors; NAME TYPE VALUE ------------------------------------ ----------- ------------------------------ open_cursors integer 500 |
这里可以看到在cdb中修改,pdb会继承进去;如果在pdb中修改会覆盖pdb从cdb中继承的参数含义
ORACLE 12C PDB 维护基础介绍的更多相关文章
- oracle 12c pdb开启和关闭
oracle 12c pdb开启和关闭 //开启数据库 sqlplus / as sysdba; //登录连接CDB,默认是root container;startu ...
- Oracle 12c pdb的数据泵导入导出
12c推出了可插拔数据库,在一个容器cdb中以多租户的形式同时存在多个数据库pdb.在为pdb做数据泵导入导出时和传统的数据库有少许不同. 1,需要为pdb添加tansnames ...
- Oracle 12c Windows安装、介绍及简单使用(图文)
1.下载 地址为:http://www.oracle.com/technetwork/cn/database/enterprise-edition/downloads/index.html 含企业版和 ...
- (转)Oracle 12c Windows安装、介绍及简单使用(图文)
版权声明:http://blog.csdn.net/anxpp https://blog.csdn.net/anxpp/article/details/51345074 转载请注明出处:http:// ...
- Oracle 12c pdb自动启动
PDB Pluggable Database是12c中扛鼎的一个新特性, 但是对于CDB中的PDB,默认启动CDB时不会将所有的PDB带起来,这样我们就需要手动alter pluggable data ...
- 关于Oracle 12C pdb用户无法登录的问题
新装了oracle12c,对新的CDB和PDB用户如何登录一直一头雾水,经过一晚上的查找,终于解决. sqlplus /nolog -> conn /as sysdba 登录到oracle 将s ...
- Oracle 12c PDB和CDB全局用户权限问题
Oracle12c版本中引入了新的CDB和PDB 默认登陆CDB后创建的用户为全局用户必须以c##开头 如果要访问CDB中的表,可以用GRANT命令赋权 但是上面的赋权并不会再PDB中生效 如果要这个 ...
- Oracle 12c 用户创建、角色、权限
aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAd4AAADHCAIAAAA4UqVzAAAgAElEQVR4nOy9Z5Bk13UmyN/6vZrlrG
- SQL记录-Linux CentOS配置ORACLE 12c
1.准备LIINX软件包 操作系统:centos7 虚拟机:VMware 12 JDK:1.8 数据库:oracle 12c 2.配置基础环境 2.1 部署虚拟机VM(过程略) 2.2 部署操作系统C ...
随机推荐
- error: jump to label ‘XXXX’ [-fpermissive]
http://www.cnblogs.com/foohack/p/4090124.html 下面的类似的源码在MSVC上能正确编译通过.但是gcc/g++上就会错: 1. if(expr)2. got ...
- java并发编程-线程池的使用
参考文章:http://www.cnblogs.com/dolphin0520/p/3932921.html 深入剖析线程池实现原理 将从下面几个方面讲解: 1.线程池状态 2.任务的执行 3.线程池 ...
- JavaScript中关于bool类型判断的一些总结。
我从书上看到了一些关于 int类型 0 转换成boolean值得时候会把0转换成 false ,string 类型 的 "" 也会装换成false; 所以我就想,我能不能用一 ...
- 【Android测试】【第二节】性能——CPU时间片
◆版权声明:本文出自胖喵~的博客,转载必须注明出处. 转载请注明出处:http://www.cnblogs.com/by-dream/p/5143192.html 前言 第一节讲CPU的时候留下了一个 ...
- php---apache的A/B测试
A/B测试 A/B测试是一种新兴的网页优化方法,可以用于增加转化率注册率等网页指标..A/B测试的目的在于通过科学的实验设计.采样样本代表性.流量分割与小流量测试等方式来获得具有代表性的实验结论,并确 ...
- RESTFul Web Api 服务框架(一)
简介: 基于 REST 的 Web 服务日益成为后端企业服务集成的首选,因为它比 SOAP 更加简单.这篇文章介绍了一 个简单的可扩展框架,使用Asp.net Web Api作为 REST 服务的实现 ...
- mysql基本sql语句大全(基础用语篇)
1.说明:创建数据库 CREATE DATABASE database-name 2.说明:删除数据库 drop database dbname 3.说明:备份sql server --- 创建 备份 ...
- ArcGIS Engine开发之旅02--ArcGIS Engine中的类库
原文:ArcGIS Engine开发之旅02--ArcGIS Engine中的类库 System类库 System类库是ArcGIS体系结构中最底层的类库.System类库包含给构成ArcGIS的其他 ...
- Windows-004-显示文件的扩展名
此文主要讲述 Windows 7 下如何显示文件的扩展名,敬请亲们参阅.若有不足之处,敬请大神指正,不胜感激! 通常安装好 Win7 后,文件的扩展名默认是不显示的,如下所示: 点击工具栏中的 组织, ...
- django 部署到 apache
安装完django之后,每次都需要通过命令来启动启动开发服务器.虽然调试和测试方便,但只能在本地运行,并且不能承受许多用户同时使用的负载.所以需要将Django部署到生产级的服务器,这里选择apach ...