我们经常使用Oracle数据库中的性能分析工具,awr,那么如果我们需要检查一些专项的东西,如何直接获取相关数据呢? 也就是说,那些awr的数据存放在哪里,相关视图有哪些? 注意在Oracle21c 之后 不再支持 NO-CDB模式了,所有部署均为CDB模式,需要pdb。这些DBA_HIST视图也可以分别与CDB级别和PDB级别的AWR_ROOT视图和AWR_PDB视图进行互换。例如,你可以使用AWR_PDB_ACTIVE_SESS_HISTORY视图来检索PDB级别上关于活动会话历史的AWR数据,这相当于非多租户环境下独立数据库中的DBA_HIST_ACTIVE_SESS_HISTORY视图。如果没有收集PDB级别的快照,AWR_PDB视图将不会显示任何AWR数据。 可以通过下面命令开启pdb级别awr收集功能:参考命令
alter session set container=PDB1; alter system set awr_pdb_autoflush_enabled=true;
DBA_HIST相关视图参考如下:
| DBA_HIST View | Description |
| DBA_HIST_ACTIVE_SESS_HISTORY | Displays the history of the contents of the in-memory active session history for recent system activity. |
| DBA_HIST_BASELINE | Displays information about the baselines captured on the system, such as the time range of each baseline and the baseline type. |
| DBA_HIST_BASELINE_DETAILS | Displays details about a specific baseline. |
| DBA_HIST_BASELINE_TEMPLATE | Displays information about the baseline templates used by the system to generate baselines. |
| DBA_HIST_CON_SYS_TIME_MODEL | Displays historical system time model statistics, including OLAP timed statistics. |
| DBA_HIST_CON_SYSMETRIC_HIST | Displays the historical information about the system metric values. |
| DBA_HIST_CON_SYSMETRIC_SUMM | Displays history of the statistical summary of all the metric values in the system metrics for the long duration (60 seconds) group. |
| DBA_HIST_CON_SYSSTAT | Displays historical system statistics, including OLAP kernel statistics. |
| DBA_HIST_CON_SYSTEM_EVENT | Displays historical information about the total waits for an event. |
| DBA_HIST_DATABASE_INSTANCE | Displays information about the database environment. |
| DBA_HIST_DB_CACHE_ADVICE | Displays historical predictions of the number of physical reads for the cache size corresponding to each row. |
| DBA_HIST_DISPATCHER | Displays historical information for each dispatcher process at the time of the snapshot. |
| DBA_HIST_DYN_REMASTER_STATS | Displays statistical information about the dynamic remastering process. |
| DBA_HIST_IOSTAT_DETAIL | Displays historical I/O statistics aggregated by file type and function. |
| DBA_HIST_RSRC_PDB_METRIC | Displays historical information about the Resource Manager metrics for pluggable databases (PDBs) for the past one hour. |
| DBA_HIST_RSRC_METRIC | Displays historical information about the Resource Manager metrics for consumer groups for the past one hour. |
| DBA_HIST_SHARED_SERVER_SUMMARY | Displays historical information for shared servers, such as shared server activity, common queues and dispatcher queues. |
| DBA_HIST_SNAPSHOT | Displays information on snapshots in the system. |
| DBA_HIST_SQL_PLAN | Displays the SQL execution plans. |
| DBA_HIST_WR_CONTROL | Displays the settings for controlling AWR. |
| DBA_HIST_WR_SETTINGS | Displays the settings and metadata of the AWR. |
| DBA_HIST_PROCESS_WAITTIME | Displays CPU and wait time for a process type. |
具体可参考官方文档,《Database Performance Tuning Guide》
