em12c监控的数据记录在资料库中,一般都放在sysman用户下,以mgmt$开头的表或视图。可以通过一些简单的查询提取想要的数据,供其他系统使用,例如:
--查看各类平台数量
col type_qualifier1 for a10
SELECT type_qualifier1, COUNT(*) cnt
FROM mgmt$target
WHERE target_type = 'host'
GROUP BY type_qualifier1
结果如下:
TYPE_QUALI CNT
---------- ----------
HP-UX 6
SunOS 2
Linux 137
Windows 94
AIX 59
--查数据库审计设置
col VALUE for a20
select TARGET_NAME,value from MGMT$DB_INIT_PARAMS a
where NAME='audit_trail' AND VALUE <>'NONE'
and COLLECTION_TIMESTAMP>SYSDATE-1 AND ROWNUM<100
ORDER BY 1;
--检查所有数据库端口
col TARGET_NAME for a30
col PROPERTY_VALUE for a10
set pages 200
SELECT target_name, property_value
FROM mgmt$target_properties
WHERE target_type = 'oracle_database'
AND property_name = 'Port'
--查看数据库在各平台上的数量
col Platform for a10
SELECT p3.property_value "Platform", p1.property_value "Version", COUNT(*) "Total"
FROM mgmt$target_properties p1, mgmt$target_properties p2, mgmt$target_properties p3
WHERE p1.target_type = 'oracle_database'
AND p1.target_guid = p2.target_guid
AND p3.target_name = p2.property_value
AND p3.target_type = 'host'
AND p1.property_name = 'VersionCategory'
AND p2.property_name = 'MachineName'
AND p3.property_name = 'OS'
GROUP BY p3.property_value, p1.property_value
ORDER BY p3.property_value, p1.property_value;
结果如下:
Platform Version Total
---------- ---------- ----------
AIX 10gR2 1
AIX 11gR202 2
HP-UX 10gR205 1
Linux 10gR204 1
Linux 10gR205 1
Linux 11gR1 1
Linux 11gR202 16
Windows 10gR2 4
Windows 11gR202 2
--代理部署位置、版本
--查看cpu使用率
...
阅读(2752) | 评论(0) | 转发(0) |