CDB基本组成
CDB根容器:pdb$root。存放整个CDB的元数据和公共用户(common users)。
种子PDB:pdb$seed。是创建用户PDB的模板,由系统创建维护,用户不可添加或修改。READ ONLY。
用户创建的PDB:存储用户数据,可插拔的数据库(pluggable database),可创建0~n个。
/*查看是否是CDB*/ SQL> select CDB from v$database; CDB --- YES
复制
Common user & Local user
根容器中创建的用户为公共用户(common user),用户pdb中创建的用户为本地用户(local user)。创建common user需加前缀“c##”。当创建公共用户时,各PDB中同时创建该用户,如果有的PDB未打开,则创建工作会以任务的方式延后。在视图DBA_USERS和CDB_USERS中都包含了一个COMMON字段,用于标识公共用户和本地用户。
SQL> show con_name CON_NAME ------------------------------ CDB$ROOT SQL> create user lian identified by lian; create user lian identified by lian * ERROR at line 1: ORA-65096: invalid common user or role name SQL> create user c##lian identified by lian; User created. SQL> grant create session to c##lian;---此时只有根容器授权成功,可以登录,pdb无法登录 Grant succeeded. SQL> grant create session to c##lian container=all;---CDB和PDBs都授权,都可登录 Grant succeeded. SQL> drop user c##lian;---根容器正常删除,pdb中无法删除公共用户。(谁的用户谁删除) User dropped.
复制
对于客户端来说,CDB和non-CDB没有区别变化。
CDB优点:
- Cost reduction(共用实例资源,降低成本)
By consolidating hardware and database infrastructure to a single set of background processes, and efficiently sharing computational and memory resources, you reduce costs for hardware and maintenance. For example, 100 PDBs on a single server share one database instance. - Easier and more rapid movement of data and code(更简单快速的移动数据和代码。可插拔)
By design, you can quickly plug a PDB into a CDB, unplug the PDB from the CDB, and then plug this PDB into a different CDB. You can also clone PDBs while they remain available. You can plug in a PDB with any character set and access it without character set conversion. If the character set of the CDB is CDB’s character set is AL32UTF8, then PDBs with different database character sets can exist in the same CDB. - Easier management and monitoring of the physical database(更容易管理和监控物理数据库,打补丁、rman备份)
The CDB administrator can manage the environment as an aggregate by executing a single operation, such as patching or performing an RMAN backup, for all hosted tenants and the CDB root. Backup strategies and disaster recovery are simplified. - Separation of data and code(数据和代码分离,安全,各pdb之间互不影响)
Although consolidated into a single physical database, PDBs mimic the behavior of non-CDBs. For example, if user error loses critical data, then a PDB administrator can use Oracle Flashback or point-in-time recovery to retrieve the lost data without affecting other PDBs. - Secure separation of administrative duties(管理职责安全分离。common user在权限允许的情况下可以连接任何一个pdb,local user只能连接特定的pdb。)
A common user can connect to any container on which it has sufficient privileges, whereas a local user is restricted to a specific PDB. Administrators can divide duties as follows:
An administrator uses a common account to manage a CDB or application container. Because a privilege is contained within the container in which it is granted, a local user on one PDB does not have privileges on other PDBs within the same CDB.
An administrator uses a local account to manage an individual PDB. - Ease of performance tuning(轻松地性能优化)
It is easier to collect performance metrics for a single database than for multiple databases. It is easier to size one SGA than 100 SGAs. - Fewer database patches and upgrades(更少的数据库补丁和升级)
It is easier to apply a patch to one database than to 100 databases, and to upgrade one database than to upgrade 100 databases.
缺点
每个调整操作务必小心谨慎,牵一发而动全身。
「喜欢这篇文章,您的关注和赞赏是给作者最好的鼓励」
关注作者
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。