溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊(cè)×
其他方式登錄
點(diǎn)擊 登錄注冊(cè) 即表示同意《億速云用戶服務(wù)條款》

12C關(guān)于CDB、PDB創(chuàng)建AWR的方法和總結(jié)

發(fā)布時(shí)間:2020-08-17 14:31:17 來(lái)源:ITPUB博客 閱讀:249 作者:lusklusklusk 欄目:關(guān)系型數(shù)據(jù)庫(kù)

官方文檔

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

總結(jié)

1、12c中CDB創(chuàng)建AWR報(bào)告的生成方法和之前的版本一樣,CDB的AWR會(huì)記錄PDB的信息,比如top sql里面就多了一列PDB Name

2、12.2.0.1開始可以為PDB單獨(dú)創(chuàng)建AWR

3、為PDB單獨(dú)創(chuàng)建AWR,可以不做任何設(shè)置,直接進(jìn)入該P(yáng)DB,創(chuàng)建AWR的過(guò)程中l(wèi)ocation of AWR Data時(shí)只能選擇AWR_ROOT,此時(shí)該P(yáng)DB的AWR使用的是CDB的快照dba_hist_snapshot,生成的AWR只有該P(yáng)DB的信息

4、為PDB單獨(dú)創(chuàng)建AWR,可以單獨(dú)對(duì)PDB做設(shè)置,設(shè)置該P(yáng)DB的參數(shù)AWR_PDB_AUTOFLUSH_ENABLED、AWR_SNAPSHOT_TIME_OFFSET并重新設(shè)置PDB的快照生成方式(cdb_hist_wr_control.SNAP_INTERVAL字段值不再出現(xiàn)40150),直接進(jìn)入該P(yáng)DB,創(chuàng)建AWR的過(guò)程中l(wèi)ocation of AWR Data時(shí)選擇AWR_ROOT或AWR_PDB都行,選擇AWR_ROOT此時(shí)該P(yáng)DB的AWR使用的是CDB的快照dba_hist_snapshot,生成的AWR只有該P(yáng)DB的信息,選擇AWR_PDB此時(shí)該P(yáng)DB的AWR使用的是PDB自己的快照awr_pdb_snapshot,生成的AWR只有該P(yáng)DB的信息

CDB創(chuàng)建AWR的方法

方法1

CDB$ROOT這個(gè)容器下執(zhí)行

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

方法2

CDB$ROOT這個(gè)容器下執(zhí)行

select * from dba_hist_snapshot order by 1 desc

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

PDB創(chuàng)建AWR的方法

方法1

無(wú)需對(duì)PDB做任何設(shè)置

SQL> alter session set container=PDB_NAME;

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

備注:期間會(huì)出現(xiàn)如下提示, 只能選擇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

需要先對(duì)PDB做設(shè)置

alter session set container=PDB_NAME;

alter system set awr_pdb_autoflush_enabled=true;

select * from cdb_hist_wr_control;SNAP_INTERVAL字段值出現(xiàn)了40150,具體為40150 00:01:00.0 +00008

execute dbms_workload_repository.modify_snapshot_settings(interval => 30);

select * from cdb_hist_wr_control;SNAP_INTERVAL字段值不再出現(xiàn)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

備注:期間會(huì)出現(xiàn)如下提示, 可以選擇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來(lái)導(dǎo)出這個(gè)PDB的awr,選擇AWR_PDB表示使用PDB的snapshot即awr_pdb_snapshot來(lái)導(dǎo)出這個(gè)PDB的awr。其中選擇AWR_ROOT導(dǎo)出不是這個(gè)整個(gè)CDB和所有PDB的awr,僅僅導(dǎo)出這個(gè)PDB的awr,但是使用的是CDB的snapshot

方法3

需要先對(duì)PDB做設(shè)置

alter session set container=PDB_NAME;

alter system set awr_pdb_autoflush_enabled=true;

select * from cdb_hist_wr_control;SNAP_INTERVAL字段值出現(xiàn)了40150,具體為40150 00:01:00.0 +00008

execute dbms_workload_repository.modify_snapshot_settings(interval => 30);

select * from cdb_hist_wr_control;SNAP_INTERVAL字段值不再出現(xiàn)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初始化參數(shù),您可以指定為CDB中的所有PDB還是CDB中的單個(gè)PDB啟用或禁用自動(dòng)快照。 自動(dòng)快照操作默認(rèn)情況下為CDB啟用,但默認(rèn)情況下為PDB禁用。 要為PDB啟用自動(dòng)快照,PDB管理員必須連接到該P(yáng)DB,將AWR_PDB_AUTOFLUSH_ENABLED參數(shù)的值設(shè)置為true,并將快照生成間隔設(shè)置為大于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中的單個(gè)PDB啟用或禁用自動(dòng)自動(dòng)工作負(fù)載存儲(chǔ)庫(kù)(AWR)快照。

AWR_PDB_AUTOFLUSH_ENABLED的默認(rèn)值為false。因此,默認(rèn)情況下,對(duì)CDB中的所有PDB禁用自動(dòng)AWR快照。

當(dāng)您更改CDB根目錄中的AWR_PDB_AUTOFLUSH_ENABLED的值時(shí),新值將在CDB中的所有PDB中生效。

因此,如果將CDB根目錄中的AWR_PDB_AUTOFLUSH_ENABLED的值更改為true,則所有PDB中的AWR_PDB_AUTOFLUSH_ENABLED的值也將更改為true,以便為所有PDB啟用自動(dòng)AWR快照。

您還可以在CDB中的任何單個(gè)PDB中更改AWR_PDB_AUTOFLUSH_ENABLED的值,并且將尊重為每個(gè)單個(gè)PDB設(shè)置的值。這使您可以為單個(gè)PDB啟用或禁用自動(dòng)AWR快照。

創(chuàng)建新的PDB或?qū)⑾惹皵?shù)據(jù)庫(kù)版本的PDB升級(jí)到當(dāng)前數(shù)據(jù)庫(kù)版本時(shí),將根據(jù)根目錄中AWR_PDB_AUTOFLUSH_ENABLED的當(dāng)前值為PDB啟用或禁用自動(dòng)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指定自動(dòng)工作量存儲(chǔ)庫(kù)(AWR)快照開始時(shí)間的偏移量。

AWR快照通常在小時(shí)的頂部(12:00、1:00、2:00等)開始。 此參數(shù)允許DBA為AWR快照開始時(shí)間指定偏移量。

這是一個(gè)有用的參數(shù),可避免來(lái)自多個(gè)實(shí)例的CPU尖峰同時(shí)啟動(dòng)它們的AWR快照。 如果您的大型系統(tǒng)上有許多實(shí)例(例如許多Exadata安裝),并且遇到了此類CPU高峰,則此參數(shù)可能非常有用。

以秒為單位指定參數(shù)。 通常,將其設(shè)置為小于3600的值。如果將特殊值設(shè)置為1000000(1,000,000),則會(huì)得到一種自動(dòng)模式,在該模式下,偏移量基于數(shù)據(jù)庫(kù)名稱。

當(dāng)您在同一節(jié)點(diǎn)上運(yùn)行大量實(shí)例時(shí),自動(dòng)模式是一種有效分配偏移時(shí)間的有效方法。

向AI問(wèn)一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI