重庆思庄Oracle、Redhat认证学习论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 199|回复: 0
打印 上一主题 下一主题

[Oracle] 在oracle 12c pdb下设置awr

[复制链接]
跳转到指定楼层
楼主
发表于 2024-3-24 18:16:18 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
可以按照以下详细步骤在PDB级别启用和创建AWR报告。
1) 在PDB级别设置awr_pdb_autoflush_enabled=true:
alter session set container=ORA12CPDB4;
alter system set awr_pdb_autoflush_enabled=true;
2) 正确设置AWR快照

select * from cdb_hist_wr_control;

DBID SNAP_INTERVAL RETENTION TOPNSQL CON_ID
2580889417 +40150 00:01:00.0 +00008 00:00:00.0 DEFAULT 6
##这里修改为60分钟生成一次快照
execute dbms_workload_repository.modify_snapshot_settings(interval => 60);

select * from cdb_hist_wr_control;

DBID SNAP_INTERVAL RETENTION TOPNSQL CON_ID
2580889417 +00000 01:00:00.0 +00008 00:00:00.0 DEFAULT 6

3) 另请将AWR_SNAPSHOT_TIME_OFFSET设置为1000000,以避免多个PDB同时创建快照时出现性能问题。
SQL> alter session set container=cdb$root;
SQL>alter system set awr_snapshot_time_offset=1000000 scope=both;

4) 等待1-2小时以自动生成快照:
select * from awr_pdb_snapshot;

或者您可以手动创建快照:
SQL> connect / as sysdba
SQL> alter session set container=ORA12CPDB4;
SQL> exec dbms_workload_repository.create_snapshot();

5.创建AWR报告:
sqlplus /nolog
SQL>connect / as sysdba
SQL>alter session set container=ORA12CPDB4
SQL>@/u01/app/oracle/product/12.2.0.1/db_1/rdbms/admin/awrrpt.sql

Specify the Report Type
~~~~~~~~~~~~~~~~~~~~~~~
AWR reports can be generated in the following formats.  Please enter the
name of the format at the prompt.  Default value is 'html'.

'html'          HTML format (default)
'text'          Text format
'active-html'   Includes Performance Hub active report

Enter value for report_type: html
old   1: select 'Type Specified: ',lower(nvl('&&report_type','html')) report_type from dual
new   1: select 'Type Specified: ',lower(nvl('html','html')) report_type from dual

Type Specified:  html

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_PDB

Location of AWR Data Specified: AWR_PDB
我这里是做pdb的awr,若是做cdb的awr那么选择AWR_ROOT

6.两个时段做awr比较
awrddrpt比较两个awr报表的值
运行awrddrpt.sql脚本;
SQL>@/u01/app/oracle/product/12.2.0.1/db_1/rdbms/admin/awrddrpt.sql

分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 支持支持 反对反对
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|手机版|小黑屋|重庆思庄Oracle、Redhat认证学习论坛 ( 渝ICP备12004239号-4 )

GMT+8, 2024-4-29 10:59 , Processed in 0.096358 second(s), 20 queries .

重庆思庄学习中心论坛-重庆思庄科技有限公司论坛

© 2001-2020

快速回复 返回顶部 返回列表