温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

12C关于CDB、PDB创建AWR的方法和总结

发布时间:2020-08-17 14:31:17 来源:ITPUB博客 阅读:234 作者:lusklusklusk 栏目:关系型数据库

官方文档

http://docs.oracle.com/database/122/TGDBA/gathering-database-statistics.htm#TGDBA-GUID-D64AEB01-18FF-47EF-BB5C-A0611117D180

https://docs.oracle.com/en/database/oracle/oracle-database/12.2/refrn/AWR_PDB_AUTOFLUSH_ENABLED.html#GUID-08FA21BC-8FB1-4C51-BEEA-139C734D17A7

https://docs.oracle.com/en/database/oracle/oracle-database/12.2/refrn/AWR_SNAPSHOT_TIME_OFFSET.html#GUID-90CD8379-DCB2-4681-BB90-0A32C6029C4E

总结

1、12c中CDB创建AWR报告的生成方法和之前的版本一样,CDB的AWR会记录PDB的信息,比如top sql里面就多了一列PDB Name

2、12.2.0.1开始可以为PDB单独创建AWR

3、为PDB单独创建AWR,可以不做任何设置,直接进入该PDB,创建AWR的过程中location of AWR Data时只能选择AWR_ROOT,此时该PDB的AWR使用的是CDB的快照dba_hist_snapshot,生成的AWR只有该PDB的信息

4、为PDB单独创建AWR,可以单独对PDB做设置,设置该PDB的参数AWR_PDB_AUTOFLUSH_ENABLED、AWR_SNAPSHOT_TIME_OFFSET并重新设置PDB的快照生成方式(cdb_hist_wr_control.SNAP_INTERVAL字段值不再出现40150),直接进入该PDB,创建AWR的过程中location of AWR Data时选择AWR_ROOT或AWR_PDB都行,选择AWR_ROOT此时该PDB的AWR使用的是CDB的快照dba_hist_snapshot,生成的AWR只有该PDB的信息,选择AWR_PDB此时该PDB的AWR使用的是PDB自己的快照awr_pdb_snapshot,生成的AWR只有该PDB的信息

CDB创建AWR的方法

方法1

CDB$ROOT这个容器下执行

SQL> @?/rdbms/admin/awrrpt.sql

方法2

CDB$ROOT这个容器下执行

select * from dba_hist_snapshot order by 1 desc

select * from table(dbms_workload_repository.awr_report_html(DBID, INSTANCE_NUMBER, startsnapid,endsnapid))

PDB创建AWR的方法

方法1

无需对PDB做任何设置

SQL> alter session set container=PDB_NAME;

SQL> @?/rdbms/admin/awrrpt.sql 

备注:期间会出现如下提示, 只能选择AWR_ROOT

Specify the location of AWR Data

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

AWR_ROOT - Use AWR data from root (default)

AWR_PDB - Use AWR data from PDB

Enter value for awr_location:

方法2

需要先对PDB做设置

alter session set container=PDB_NAME;

alter system set awr_pdb_autoflush_enabled=true;

select * from cdb_hist_wr_control;SNAP_INTERVAL字段值出现了40150,具体为40150 00:01:00.0 +00008

execute dbms_workload_repository.modify_snapshot_settings(interval => 30);

select * from cdb_hist_wr_control;SNAP_INTERVAL字段值不再出现40150,具体为+00000 00:30:00.0 +00008

alter system set AWR_SNAPSHOT_TIME_OFFSET=1000000

SQL> alter session set container=PDB_NAME;

SQL> @?/rdbms/admin/awrrpt.sql

备注:期间会出现如下提示, 可以选择AWR_ROOT或AWR_PDB

Specify the location of AWR Data

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

AWR_ROOT - Use AWR data from root (default)

AWR_PDB - Use AWR data from PDB

Enter value for awr_location: 选择AWR_ROOT表示使用CDB的snapshot即dba_hist_snapshot来导出这个PDB的awr,选择AWR_PDB表示使用PDB的snapshot即awr_pdb_snapshot来导出这个PDB的awr。其中选择AWR_ROOT导出不是这个整个CDB和所有PDB的awr,仅仅导出这个PDB的awr,但是使用的是CDB的snapshot

方法3

需要先对PDB做设置

alter session set container=PDB_NAME;

alter system set awr_pdb_autoflush_enabled=true;

select * from cdb_hist_wr_control;SNAP_INTERVAL字段值出现了40150,具体为40150 00:01:00.0 +00008

execute dbms_workload_repository.modify_snapshot_settings(interval => 30);

select * from cdb_hist_wr_control;SNAP_INTERVAL字段值不再出现40150,具体为+00000 00:30:00.0 +00008

alter system set AWR_SNAPSHOT_TIME_OFFSET=1000000

SQL> alter session set container=PDB_NAME;

SQL> select * from awr_pdb_snapshot order by 1 desc

SQL> select * from table(dbms_workload_repository.awr_report_html(DBID, INSTANCE_NUMBER, startsnapid,endsnapid))

The AWR_PDB_AUTOFLUSH_ENABLED initialization parameter enables you to specify whether to enable or disable automatic snapshots for all the PDBs in a CDB or for individual PDBs in a CDB. The automatic snapshot operations are enabled by default for a CDB, but are disabled by default for a PDB. To enable automatic snapshots for a PDB, the PDB administrator must connect to that PDB, set the value for the AWR_PDB_AUTOFLUSH_ENABLED parameter to true, and set the snapshot generation interval to a value greater than 0.

使用AWR_PDB_AUTOFLUSH_ENABLED初始化参数,您可以指定为CDB中的所有PDB还是CDB中的单个PDB启用或禁用自动快照。 自动快照操作默认情况下为CDB启用,但默认情况下为PDB禁用。 要为PDB启用自动快照,PDB管理员必须连接到该PDB,将AWR_PDB_AUTOFLUSH_ENABLED参数的值设置为true,并将快照生成间隔设置为大于0的值。

AWR_PDB_AUTOFLUSH_ENABLED enables you to specify whether to enable or disable automatic Automatic Workload Repository (AWR) snapshots for all the PDBs in a CDB or for individual PDBs in a CDB.

The default value of AWR_PDB_AUTOFLUSH_ENABLED is false. Thus, by default, automatic AWR snapshots are disabled for all the PDBs in a CDB.

When you change the value of AWR_PDB_AUTOFLUSH_ENABLED in the CDB root, the new value takes effect in all the PDBs in the CDB.

Therefore, if you change the value of AWR_PDB_AUTOFLUSH_ENABLED in the CDB root to true, the value of AWR_PDB_AUTOFLUSH_ENABLED is also changed to true in all of the PDBs, so that automatic AWR snapshots are enabled for all the PDBs.

You can also change the value of AWR_PDB_AUTOFLUSH_ENABLED in any of the individual PDBs in a CDB, and the value that is set for each individual PDB will be honored. This enables you to enable or disable automatic AWR snapshots for individual PDBs.

When a new PDB is created, or a PDB from a previous database release is upgraded to the current database release, automatic AWR snapshots are enabled or disabled for the PDB based on the current value of AWR_PDB_AUTOFLUSH_ENABLED in the root.

AWR_PDB_AUTOFLUSH_ENABLED使您可以指定是为CDB中的所有PDB还是CDB中的单个PDB启用或禁用自动自动工作负载存储库(AWR)快照。

AWR_PDB_AUTOFLUSH_ENABLED的默认值为false。因此,默认情况下,对CDB中的所有PDB禁用自动AWR快照。

当您更改CDB根目录中的AWR_PDB_AUTOFLUSH_ENABLED的值时,新值将在CDB中的所有PDB中生效。

因此,如果将CDB根目录中的AWR_PDB_AUTOFLUSH_ENABLED的值更改为true,则所有PDB中的AWR_PDB_AUTOFLUSH_ENABLED的值也将更改为true,以便为所有PDB启用自动AWR快照。

您还可以在CDB中的任何单个PDB中更改AWR_PDB_AUTOFLUSH_ENABLED的值,并且将尊重为每个单个PDB设置的值。这使您可以为单个PDB启用或禁用自动AWR快照。

创建新的PDB或将先前数据库版本的PDB升级到当前数据库版本时,将根据根目录中AWR_PDB_AUTOFLUSH_ENABLED的当前值为PDB启用或禁用自动AWR快照。

AWR_SNAPSHOT_TIME_OFFSET specifies an offset for the Automatic Workload Repository (AWR) snapshot start time.

AWR snapshots normally start at the top of the hour (12:00, 1:00, 2:00, and so on). This parameter allows DBAs to specify an offset for the AWR snapshot start time.

This is a useful parameter to avoid CPU spikes from multiple instances all starting their AWR snapshots at the same time. If you have a large system with many instances on it (like many Exadata installations), and you are experiencing such CPU spikes, this parameter can be very useful.

The parameter is specified in seconds. Normally, you set it to a value less than 3600. If you set the special value 1000000 (1,000,000), you get an automatic mode, in which the offset is based on the database name.

The automatic mode is an effective way of getting a reasonable distribution of offset times when you have a very large number of instances running on the same node.

AWR_SNAPSHOT_TIME_OFFSET指定自动工作量存储库(AWR)快照开始时间的偏移量。

AWR快照通常在小时的顶部(12:00、1:00、2:00等)开始。 此参数允许DBA为AWR快照开始时间指定偏移量。

这是一个有用的参数,可避免来自多个实例的CPU尖峰同时启动它们的AWR快照。 如果您的大型系统上有许多实例(例如许多Exadata安装),并且遇到了此类CPU高峰,则此参数可能非常有用。

以秒为单位指定参数。 通常,将其设置为小于3600的值。如果将特殊值设置为1000000(1,000,000),则会得到一种自动模式,在该模式下,偏移量基于数据库名称。

当您在同一节点上运行大量实例时,自动模式是一种有效分配偏移时间的有效方法。

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI