本文主要是介绍OCA/OCP Oracle 数据库12c考试指南读书笔记:第33章:Managing Storage, Security, Availability, Performance in CDB/PDB,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
多租户环境下的空间管理
多租户环境下,表空间和数据文件都是与容器关联的,或者是CDB或者是PDB。
表空间架构
容器ID和表空间名唯一确定表空间。
SQL> select con_id, c.name c, t.name t, d.name d from v$containers c join v$tablespace t using (con_id) join v$datafile d using (con_id, ts#) order by 1,2,3;CON_ID C T D
---------- ---------- ---------- ----------------------------------------------------------------------------------------------------1 CDB$ROOT SYSAUX /opt/oracle/oradata/ORCLCDB/sysaux01.dbf1 CDB$ROOT SYSTEM /opt/oracle/oradata/ORCLCDB/system01.dbf1 CDB$ROOT UNDOTBS1 /opt/oracle/oradata/ORCLCDB/undotbs01.dbf1 CDB$ROOT USERS /opt/oracle/oradata/ORCLCDB/users01.dbf2 PDB$SEED SYSAUX /opt/oracle/oradata/ORCLCDB/pdbseed/sysaux01.dbf2 PDB$SEED SYSTEM /opt/oracle/oradata/ORCLCDB/pdbseed/system01.dbf2 PDB$SEED UNDOTBS1 /opt/oracle/oradata/ORCLCDB/pdbseed/undotbs01.dbf3 ORCLPDB1 SYSAUX /opt/oracle/oradata/ORCLCDB/ORCLPDB1/sysaux01.dbf3 ORCLPDB1 SYSTEM /opt/oracle/oradata/ORCLCDB/ORCLPDB1/system01.dbf3 ORCLPDB1 UNDOTBS1 /opt/oracle/oradata/ORCLCDB/ORCLPDB1/undotbs01.dbf3 ORCLPDB1 USERS /opt/oracle/oradata/ORCLCDB/ORCLPDB1/users01.dbf4 ORCLPDB2 SYSAUX /opt/oracle/oradata/ORCLCDB/9B24E21F078450CDE0530100007FB288/datafile/o1_mf_sysaux_h0vql1ps_.dbf4 ORCLPDB2 SYSTEM /opt/oracle/oradata/ORCLCDB/9B24E21F078450CDE0530100007FB288/datafile/o1_mf_system_h0vql1pm_.dbf4 ORCLPDB2 UNDOTBS1 /opt/oracle/oradata/ORCLCDB/9B24E21F078450CDE0530100007FB288/datafile/o1_mf_undotbs1_h0vql1py_.dbf4 ORCLPDB2 USERS /opt/oracle/oradata/ORCLCDB/9B24E21F078450CDE0530100007FB288/datafile/o1_mf_users_h0vql1q4_.dbf15 rows selected.
可以为每一个PDB设置空间限制:
alter pluggable database orclpdb1 storage(maxsize 2g);
使用 CREATE TABLESPACE
命令和non-CDB是一样的。
根据所在容器,CDB_TABLESPACES ,CDB_DATA_FILE,V$TABLESPACE
和V$DATAFILE
可显示所有和所在PDB的表空间。
为方便管理,建议为PDB表空间使用单独目录。
PDB中的默认临时和永久表空间
alter session set container=orclpdb2;
create tablespace orclpdb2_dflt datafile size 100m autoextend on next 100m maxsize 1g;
alter database default tablespace orclpdb2_dflt;
create temporary tablespace temp_dflt tempfile size 100m autoextend on next 100m maxsize 500m;
alter database default temporary tablespace temp_dflt;
管理COMMON和本地用户,角色和权限
CDB中可定义common用户和角色,PDB中可定义本地用户和角色。
Common 和本地用户
两类用户,common和本地。common用户以c##为前缀(由COMMON_USER_PREFIX 定义),自动在PDB中建立。
create user c##user01 identified by Welcome1;
根容器中不能有本地用户。
common用户不代表在PDB中有相同的权限,默认没有任何权限,需要显式赋予。
$ rlwrap sqlplus c##user01/Welcome1@orclcdbSQL*Plus: Release 19.0.0.0.0 - Production on Thu Jan 2 22:25:51 2020
Version 19.3.0.0.0Copyright (c) 1982, 2019, Oracle. All rights reserved.ERROR:
ORA-01045: user C##USER01 lacks CREATE SESSION privilege; logon deniedSQL> grant create session, set container to c##user01;Grant succeeded.
$ rlwrap sqlplus c##user01/Welcome1@orclcdbSQL*Plus: Release 19.0.0.0.0 - Production on Thu Jan 2 22:27:38 2020
Version 19.3.0.0.0Copyright (c) 1982, 2019, Oracle. All rights reserved.Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0SQL> alter session set container=orclpdb1;
ERROR:
ORA-01031: insufficient privilegesSQL> grant create session, set container to c##user01 container=all;Grant succeeded.SQL> exit
Disconnected from Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0
[oracle@oracle-19c-vagrant ~]$ rlwrap sqlplus c##user01/Welcome1@orclcdbSQL*Plus: Release 19.0.0.0.0 - Production on Thu Jan 2 22:29:15 2020
Version 19.3.0.0.0Copyright (c) 1982, 2019, Oracle. All rights reserved.Last Successful login time: Thu Jan 02 2020 22:27:38 +08:00Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0SQL> alter session set container=orclpdb1;Session altered.
全局和本地赋权
grant ... container=orclpdb1;
grant ... container=all;
grant ... container=current;
管理Common和本地角色
和用户一样,common角色以c##为前缀。
create role c##role1;
grant c##role1 to user01;
运行Common用户访问指定PDB中的数据
两类共享对象,都是link,分布为object link和metadata link。前者将PDB与根容器中的表连接,所有每个PDB看到同样的内容;后者是根容器中的内容和PDB中私有内容的合并,如dba_users。
-- dba_users中没有con_id,以下是在PDB中执行
SQL> select username, common from dba_users;
USERNAME COM
------------------------ ---
SYS YES
SYSTEM YES
XS$NULL YES
LBACSYS YES
OUTLN YES
DBSNMP YES
APPQOSSYS YES
DBSFWUSER YES
GGSYS YES
ANONYMOUS YES
CTXSYS YES
DVSYS YES
DVF YES
GSMADMIN_INTERNAL YES
MDSYS YES
OLAPSYS YES
XDB YES
WMSYS YES
GSMCATUSER YES
MDDATA YES
SYSBACKUP YES
REMOTE_SCHEDULER_AGENT YES
PDBADMIN NO
GSMUSER YES
SYSRAC YES
HR NO
BI NO
OJVMSYS YES
SI_INFORMTN_SCHEMA YES
AUDSYS YES
DIP YES
ORDPLUGINS YES
OE NO
PM NO
C##USER01 YES
SYSKM YES
ORDDATA YES
ORACLE_OCM YES
SYS$UMF YES
IX NO
SYSDG YES
ORDSYS YES
SH NO43 rows selected.SQL> select con_id, username, common from cdb_users order by username, con_id;CON_ID USERNAME COM
---------- ------------------------ ---1 ANONYMOUS YES3 ANONYMOUS YES4 ANONYMOUS YES1 APPQOSSYS YES3 APPQOSSYS YES4 APPQOSSYS YES1 AUDSYS YES3 AUDSYS YES4 AUDSYS YES3 BI NO1 C##USER01 YES3 C##USER01 YES4 C##USER01 YES1 CTXSYS YES3 CTXSYS YES4 CTXSYS YES1 DBSFWUSER YES3 DBSFWUSER YES4 DBSFWUSER YES1 DBSNMP YES3 DBSNMP YES4 DBSNMP YES1 DIP YES3 DIP YES4 DIP YES1 DVF YES3 DVF YES4 DVF YES1 DVSYS YES3 DVSYS YES4 DVSYS YES1 GGSYS YES3 GGSYS YES4 GGSYS YES1 GSMADMIN_INTERNAL YES3 GSMADMIN_INTERNAL YES4 GSMADMIN_INTERNAL YES1 GSMCATUSER YES3 GSMCATUSER YES4 GSMCATUSER YES1 GSMROOTUSER YES4 GSMROOTUSER YES1 GSMUSER YES3 GSMUSER YES4 GSMUSER YES3 HR NO3 IX NO
...
示例:
conn system/Welcome1@orclcdbselect con_id, username, common, oracle_maintained from cdb_users order by 1,2;select con_id, username, common, oracle_maintained from cdb_users order by 2,1;create user user1 identified by oracle; -- failedcreate user c##user1 identified by oracle;show parameter common_user_prefix; -- c##create user c##user2 identified by oracle container=all;grant dba to c##user1; -- only grant to user in root containergrant dba to c##user2 container=all;conn c##user1/oracle@orclcdbconn c##user1/oracle@orclpdb1 -- failed because of no privilegeconn c##user2/oracle@orclpdb1create user locala identified by oracle container=current;grant dba to locala;connect locala/oracle@orclpdb1select * from session_roles; -- DBA includedconn sys/Welcome1@orclcdb as sysdba-- new created user is not oracle maintainedselect con_id, username, common, oracle_maintained from cdb_users order by 1,2; conn system/Welcome1@orclcdbselect role, common, oracle_maintained, con_id from cdb_roles order by role;create role myrole1 container=current; -- failed, only common role can be createdcreate role c##myrole1 container=current; -- failed, current is not allowedcreate role c##myrole1 container=all;create role c##myrole2 container=all;grant c##myrole1 to c##user2 container=all;grant c##myrole2 to c##user2 container=orclpdb1; -- failed, syntax errorconn system/Welcome1@orclpdb1;grant c##myrole1 to c##user2 container=all; -- failed, not allowedgrant c##myrole1 to c##user2 container=current;conn system/Welcome1@orclcdbselect grantee, granted_role, common, con_id from cdb_role_privs where grantee like 'C##%' order by 1,2,3;
GRANTEE GRANTED_ROLE COM CON_ID
------------ ------------ --- ----------
C##USER1 DBA NO 1
C##USER2 C##MYROLE1 NO 3
C##USER2 C##MYROLE1 YES 4
C##USER2 C##MYROLE1 YES 1
C##USER2 C##MYROLE1 YES 3
C##USER2 DBA YES 3
C##USER2 DBA YES 4
C##USER2 DBA YES 18 rows selected.
conn c##user2/oracle@orclpdb1
select * from session_roles; -- DBA & C##MYROLE1
由Oracle脚本创建的对象会将oracle_maintained设置为Y。这些对象不要手工改,而是仍通过Oracle提供的脚本修改。
多租户环境下的审计
传统审计仍有效(AUDIT_%参数和Audit命令),但多租户环境下建议使用统一审计。
当前容器的审计记录通过视图UNIFIED_AUDIT_TRAIL查看,CDB_UNIFIED_AUDIT_TRAIL 是所有容器的审计记录。
PDB中建立的policy只对PDB有效,CDB中建立的policy可在所有PDB中启用。
示例:
conn / as sysdba -- root container
create audit policy audit_sys actions all
when 'sys_context(''userenv'', ''isdba'')=''TRUE'''
evaluate per statement;
audit policy audit_sys whenever successful;
conn sys/Welcome1@orclpdb1 as sysdba
noaudit policy audit_sys; -- failed
select count(*) from hr.employees;
select con_id, dbusername, sql_text from cdb_unified_audit_trail where unified_audit_policies='AUDIT_SYS' and sql_text like '%emp%';
-- 都成功了,不知为何没有结果
多租户备份与恢复
可以备份整个CDB,单个PDB,表空间,数据文件。可以用RMAN DUPLICATE拷贝所有或指定的PDB。
CDB中的数据恢复建议器和non-CDB没有区别:
list failure;
advise failure;
repair failure;
备份CDB和单个PDB
$ rman target /
RMAN> report schema;Report of database schema for database with db_unique_name ORCLCDBList of Permanent Datafiles
===========================
File Size(MB) Tablespace RB segs Datafile Name
---- -------- -------------------- ------- ------------------------
1 910 SYSTEM YES /opt/oracle/oradata/ORCLCDB/system01.dbf
3 590 SYSAUX NO /opt/oracle/oradata/ORCLCDB/sysaux01.dbf
4 330 UNDOTBS1 YES /opt/oracle/oradata/ORCLCDB/undotbs01.dbf
5 270 PDB$SEED:SYSTEM NO /opt/oracle/oradata/ORCLCDB/pdbseed/system01.dbf
6 320 PDB$SEED:SYSAUX NO /opt/oracle/oradata/ORCLCDB/pdbseed/sysaux01.dbf
7 5 USERS NO /opt/oracle/oradata/ORCLCDB/users01.dbf
8 100 PDB$SEED:UNDOTBS1 NO /opt/oracle/oradata/ORCLCDB/pdbseed/undotbs01.dbf
9 280 ORCLPDB1:SYSTEM YES /opt/oracle/oradata/ORCLCDB/ORCLPDB1/system01.dbf
10 350 ORCLPDB1:SYSAUX NO /opt/oracle/oradata/ORCLCDB/ORCLPDB1/sysaux01.dbf
11 100 ORCLPDB1:UNDOTBS1 YES /opt/oracle/oradata/ORCLCDB/ORCLPDB1/undotbs01.dbf
12 207 ORCLPDB1:USERS NO /opt/oracle/oradata/ORCLCDB/ORCLPDB1/users01.dbf
17 900 ORCLPDB2:SYSTEM YES /opt/oracle/oradata/ORCLCDB/9B24E21F078450CDE0530100007FB288/datafile/o1_mf_system_h0vql1pm_.dbf
18 530 ORCLPDB2:SYSAUX NO /opt/oracle/oradata/ORCLCDB/9B24E21F078450CDE0530100007FB288/datafile/o1_mf_sysaux_h0vql1ps_.dbf
19 955 ORCLPDB2:UNDOTBS1 YES /opt/oracle/oradata/ORCLCDB/9B24E21F078450CDE0530100007FB288/datafile/o1_mf_undotbs1_h0vql1py_.dbf
20 5 ORCLPDB2:USERS NO /opt/oracle/oradata/ORCLCDB/9B24E21F078450CDE0530100007FB288/datafile/o1_mf_users_h0vql1q4_.dbfList of Temporary Files
=======================
File Size(MB) Tablespace Maxsize(MB) Tempfile Name
---- -------- -------------------- ----------- --------------------
1 32 TEMP 32767 /opt/oracle/oradata/ORCLCDB/temp01.dbf
2 36 PDB$SEED:TEMP 32767 /opt/oracle/oradata/ORCLCDB/pdbseed/temp012020-01-02_14-54-57-386-PM.dbf
3 36 ORCLPDB1:TEMP 32767 /opt/oracle/oradata/ORCLCDB/ORCLPDB1/temp01.dbf
4 32 ORCLPDB2:TEMP 32767 /opt/oracle/oradata/ORCLCDB/9B24E21F078450CDE0530100007FB288/datafile/o1_mf_temp_h0vql1q3_.dbf
备份命令示例,默认的备份位置在$ORACLE_HOME/dbs下:
rman target /
backup database;
backup pluggable database orclpdb1;
backup tablespace orclpdb1:users, orclpdb1:sysaux;
rman target sys/Welcome1@orclpdb1 -- rman连到PDB
backup database; -- 备份当前PDB
backup tablespace users;
Restore 和Recovery
从mount到open状态,实例恢复会自动进行。
对于CDB,最重要的是SYSTEM和UNDO。对于PDB,最重要的是SYSTEM。
使用RMAN复制PDB
CREATE PLUGGABLE DATABASE . . . FROM
可以复制PDB,但RMAN更灵活,可复制整个CDB或部分PDB。需要启动一个辅助实例,辅助实例的初始化参数需设置ENABLE_PLUGGABLE_DATABASE=TRUE.
以下为部分命令示例:
duplicate database to orclcdb2 pluggable database pdb1, pdb2...;
duplicate database to orclcdb2 skip pluggable database pdb3, pdb4...;
duplicate database to orclcdb2 pluggable database pdb1, pdb2... tablespace pdb3:users;
多租户性能监控与调优
通常,数据库和实例的调优在根容器做,SQL的调优在PDB中做。方法论和non-CDB是一样的:
- 发现问题,设定目标
- 确定可能原因
- 给出解决方案
- 确定方案是否有效
- 重复2直到问题解决
有些区别是PDB可能影响其它PDB, 因此需要资源管理器来控制。
调优实例
CDB就是单个实例。CDB中的内存调整和non-CDB一样。需要将CDB中所有PDB的内存需求合计(但需要做一些扣减,因不是所有PDB都是活动的)。使用Enterprise Manager可以方便的监控。
资源分配策略有三种,None(默认,无限制的,有争用时平均分配),保证最小值,保证最小/限制最大。
资源分配依靠权重(share)。
CDB只有一个spfile,存储所有参数,但很多参数可以在PDB一级修改:
SQL> select ispdb_modifiable, count(ispdb_modifiable) from v$parameter group by ispdb_modifiable;ISPDB COUNT(ISPDB_MODIFIABLE)
----- -----------------------
TRUE 191
FALSE 254
可以查询PDB一级设置过的参数,本例中ORCLPDB2是从non-CDB转过来的:
SQL> select pdb_uid, pdb_name, name, value$ from pdb_spfile$ ps join cdb_pdbs cp on ps.pdb_uid=cp.con_uid;PDB_UID PDB_NAME NAME VALUE$
---------- ---------- -------------------- ------------------------------------991076965 ORCLPDB2 sga_target 1207959552991076965 ORCLPDB2 open_cursors 300991076965 ORCLPDB2 nls_language 'AMERICAN'991076965 ORCLPDB2 nls_territory 'AMERICA'991076965 ORCLPDB2 pga_aggregate_target 402653184
使用内存建议器
CDB中的buffer cache被所有PDB共享。因此block中是存了CON_ID的。
在CDB层面调,PGA_AGGREGATE_LIMIT是硬限制。
PDB层面可调的为SORT_AREA_SIZE 和 SORT_AREA_RETAINED_SIZE。
管理PDB之间和PDB内的资源分配
CDB层面必须创建资源计划,其它和non-CDB一样。
通过Share管理PDB间资源
CDB中的PDB竞争的资源有CPU,parallel servers,如果是Exadata,还有I/O。
默认每个插入的PDB得到一个share。
最小保证的CPU是通过share的合计来计算的。
创建和修改资源管理计划
PDB内的资源可进一步细化控制。
限制PDB资源使用的参数
UTILIZATION_LIMIT和PARALLEL_SERVER_LIMIT实施控制。前者限制CPU, I/O和parallel servers。后者限制parallel server limit。
创建CDB资源计划
和non-CDB类似,多了一个对PDB的限制。在根容器中定义。使用DBMS_RESOURCE_MANAGER定义,步骤为:
- CREATE_PENDING_AREA
- CREATE_CDB_PLAN
- CREATE_CDB_PLAN_DIRECTIVE
- CREATE_CDB_DEFAULT_DIRECTIVE
- UPDATE_CDB_AUTOTASK_DIRECTIVE
- VALIDATE_PENDING_AREA
- SUBMIT_PENDING_AREA
其它包括UPDATE_CDB_PLAN,DELETE_CDB_PLAN,UPDATE_CDB_PLAN_DIRECTIVE 和DELETE_CDB_PLAN_DIRECTIVE。
示例:
conn / as sysdba
exec dbms_resource_manager.create_pending_area();
begindbms_resource_manager.create_cdb_plan(plan => 'low_prio_apps',comment => 'orclpdb1 and orclpdb2 database low priority');
end;
/
begindbms_resource_manager.create_cdb_plan_directive(plan => 'low_prio_apps',pluggable_database => 'orclpdb1',shares => 1,utilization_limit => 50,parallel_server_limit => 50);
end;
/
begindbms_resource_manager.create_cdb_plan_directive(plan => 'low_prio_apps',pluggable_database => 'orclpdb2',shares => 1,utilization_limit => 75,parallel_server_limit => 75);
end;
/
exec dbms_resource_manager.validate_pending_area();
exec dbms_resource_manager.submit_pending_area();
alter system set resource_manager_plan='low_prio_apps';
以下是设置前后的resource plan:
SQL> show parameter resourceNAME TYPE VALUE
------------------------------------ ----------- ------------------------------
resource_limit boolean TRUE
resource_manage_goldengate boolean FALSE
resource_manager_cpu_allocation integer 2
resource_manager_plan string SCHEDULER[0x4D57]:DEFAULT_MAINTENANCE_PLAN
SQL> alter system set resource_manager_plan='low_prio_apps';System altered.SQL> show parameter resourceNAME TYPE VALUE
------------------------------------ ----------- ------------------------------
resource_limit boolean TRUE
resource_manage_goldengate boolean FALSE
resource_manager_cpu_allocation integer 2
resource_manager_plan string low_prio_apps
查看资源计划Directive
SQL> select plan, pluggable_database, shares, utilization_limit, parallel_server_limit from dba_cdb_rsrc_plan_directives order by plan, pluggable_database;PLAN PLUGGABLE_DATABASE SHARES UTILIZATION_LIMIT PARALLEL_SERVER_LIMIT
------------------------ -------------------------------- ---------- ----------------- ---------------------
DEFAULT_CDB_PLAN ORA$AUTOTASK 90
DEFAULT_CDB_PLAN ORA$DEFAULT_PDB_DIRECTIVE 1
DEFAULT_MAINTENANCE_PLAN ORA$AUTOTASK 90
DEFAULT_MAINTENANCE_PLAN ORA$DEFAULT_PDB_DIRECTIVE 1
LOW_PRIO_APPS ORA$AUTOTASK 90
LOW_PRIO_APPS ORA$DEFAULT_PDB_DIRECTIVE 1
LOW_PRIO_APPS ORCLPDB1 1 50 50
LOW_PRIO_APPS ORCLPDB2 1 75 75
ORA$INTERNAL_CDB_PLAN ORA$AUTOTASK
ORA$INTERNAL_CDB_PLAN ORA$DEFAULT_PDB_DIRECTIVE
ORA$QOS_CDB_PLAN ORA$AUTOTASK 90
ORA$QOS_CDB_PLAN ORA$DEFAULT_PDB_DIRECTIVE 112 rows selected.
在12c前,资源计划的视图为DBA_RSRC_PLAN_DIRECTIVES
管理PDB内的资源
和non-CDB类似,叫做PDB资源计划
PDB资源计划和non-CDB的区别如下:
资源计划特性 | Non-CDB | PDB |
---|---|---|
多层级plan | 是 | 否 |
最多消费组 | 32 | 8 |
subplan | 是 | 否 |
CREATE_PLAN_DIRECTIVE参数 | N/A | SHARE |
CREATE_PLAN_DIRECTIVE参数 | MAX_UTILIZATION_LIMIT | UTILIZATION_LIMIT |
CREATE_PLAN_DIRECTIVE参数 | PARALLEL_TARGET_PERCENTAGE | PARALLEL_SERVER_LIMIT |
视图仍可查询V$RSRC_PLAN,如果CON_ID=1,则为CDB资源计划:
SQL> select * from V$RSRC_PLAN where con_id = 1;ID NAME IS_TO CPU INS PARALLEL_SERVERS_ACTIVE PARALLEL_SERVERS_TOTAL
---------- -------------------- ----- --- --- ----------------------- ----------------------
PARALLEL_EXECUTION_MANAGED CON_ID DIRECTIVE_TYPE SHARES UTILIZATION_LIMIT
-------------------------------- ---------- -------------------------------- ---------- -----------------
PARALLEL_SERVER_LIMIT MEMORY_MIN MEMORY_LIMIT PROFILE
--------------------- ---------- ------------ --------------------------------73301 LOW_PRIO_APPS TRUE ON OFF 0 40
FULL 1SQL> select * from V$RSRC_PLAN;ID NAME IS_TO CPU INS PARALLEL_SERVERS_ACTIVE PARALLEL_SERVERS_TOTAL
---------- -------------------- ----- --- --- ----------------------- ----------------------
PARALLEL_EXECUTION_MANAGED CON_ID DIRECTIVE_TYPE SHARES UTILIZATION_LIMIT
-------------------------------- ---------- -------------------------------- ---------- -----------------
PARALLEL_SERVER_LIMIT MEMORY_MIN MEMORY_LIMIT PROFILE
--------------------- ---------- ------------ --------------------------------73301 LOW_PRIO_APPS TRUE ON OFF 0 40
FULL 119630 INTERNAL_PLAN TRUE ON OFF 0 16
FULL 2 DEFAULT_DIRECTIVE 119630 INTERNAL_PLAN TRUE ON OFF 0 16
FULL 3 PDB 1 505019630 DEFAULT_MAINTENANCE_ TRUE ON OFF 0 16PLAN
FULL 4 PDB 1 7575
迁移Non-CDB资源计划
如果插入的non-CDB有资源计划,插入时会做转换,之前的资源计划会保留在DBA_RSRC_PLAN_DIRECTIVES中,其STATUS为LEGACY
执行 DATABASE REPLAY
你可将之前多个non-CDB的负载在多租户环境下重放,以评估整合的效果。
捕捉源数据库负载
大致步骤为:
- 捕捉non-CDB或PDB的工作负载,一般为8-24小时,也就是1天
- 导出数据库AWR快照(可选)
- 恢复数据库到目标平台
- 修改导入的数据库,如升级到12c
- 将负载文件拷贝到目标平台
- 预先理工作负载(一次性)
- 对于其它备选数据库,重复1-6,捕捉的时段最好保持一致
- 配置目标平台用于重放
- 在目标平台重放所有PDB的工作负载
处理目标平台的工作负载
目标CDB的工作负载重放: Consolidated Replay
重放时,需要重新映射数据库连接,需要定义重放日程。由于需要多次测试,可利用闪回和时间点恢复保存和恢复到测试前状态。同时和生产库一样,也需要抓取AWR快照。
2020年1月4日13:54(完)
这篇关于OCA/OCP Oracle 数据库12c考试指南读书笔记:第33章:Managing Storage, Security, Availability, Performance in CDB/PDB的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!