性能指标:
空间管理:
会话和连接:
数据库对象:
备份和恢复:
安全性和审计:
日志和警报:
配置审查:
性能优化:
备份和恢复策略:
安全审查:
故障诊断:
版本和补丁:
日常维护:
监控工具的配置:
Oracle 监控的指标有
sqlCopy code
SELECT sql_id, elapsed_time/1000000 AS elapsed_seconds FROM v$sql ORDER BY elapsed_time DESC;
sqlCopy code
SELECT * FROM v$osstat WHERE stat_name = 'IDLE_TIME';
sqlCopy code
SELECT ROUND((1 - (SUM(free_memory) / SUM(total_memory))) * 100, 2) AS used_percent FROM v$osstat WHERE stat_name = 'PHYSICAL_MEMORY_BYTES';
sqlCopy code
SELECT * FROM v$iostat_file;
这个指标通常需要在网络设备上进行监控,无法通过 SQL 查询直接获取。
sqlCopy code
SELECT tablespace_name, ROUND((1 - (free_space / total_space)) * 100, 2) AS used_percent FROM dba_tablespace_usage_metrics;
sqlCopy code
SELECT file_name, bytes/1024/1024 AS size_mb, autoextensible FROM dba_data_files;
sqlCopy code
SELECT tablespace_name, ROUND((1 - (free_space / total_space)) * 100, 2) AS used_percent FROM dba_undo_extents;
sqlCopy code
SELECT tablespace_name, ROUND((1 - (free_space / total_space)) * 100, 2) AS used_percent FROM dba_temp_free_space;
sqlCopy code
SELECT COUNT(*) AS active_sessions FROM v$session WHERE status = 'ACTIVE';
sqlCopy code
SELECT event, total_waits, time_waited FROM v$event_name;
sqlCopy code
SELECT COUNT(*) AS total_connections, COUNT(DISTINCT username) AS distinct_users FROM v$session;
sqlCopy code
SELECT table_name, chain_cnt FROM dba_tables WHERE chain_cnt > 0;
sqlCopy code
SELECT owner, table_name, last_analyzed FROM dba_tables WHERE last_analyzed IS NULL OR last_analyzed < SYSDATE - 7;
sqlCopy code
SELECT object_name, status FROM dba_objects WHERE status = 'INVALID';
sqlCopy code
SELECT * FROM v$rman_status;
sqlCopy code
SELECT * FROM v$recovery_progress;
sqlCopy code
SELECT * FROM v$backup;
sqlCopy code
SELECT grantee, granted_role, admin_option FROM dba_role_privs;
sqlCopy code
SELECT * FROM dba_audit_trail;
sqlCopy code
SELECT * FROM dba_obj_audit_opts;
sqlCopy code
SELECT * FROM alert_log WHERE message_text LIKE '%ORA-%';
sqlCopy code
SELECT * FROM v$alert_log;
sqlCopy code
SELECT name, value FROM v$parameter WHERE name LIKE 'background%';
oracle巡检的内容
sqlCopy code
SHOW PARAMETER;
sqlCopy code
SELECT file_name FROM dba_data_files; SELECT member FROM v$logfile;
sqlCopy code
EXPLAIN PLAN FOR SELECT * FROM your_table WHERE your_condition; SELECT * FROM TABLE(DBMS_XPLAN.DISPLAY);
sqlCopy code
SELECT index_name, table_name, uniqueness, blevel, leaf_blocks, clustering_factor FROM dba_indexes;
sqlCopy code
SELECT dbms_stats.report_stats_operations() FROM dual;
sqlCopy code
SHOW ALL;
sqlCopy code
SELECT * FROM V$RECOVERY_STATUS;
sqlCopy code
SELECT * FROM V$BACKUP_REDOLOG;
sqlCopy code
SELECT grantee, granted_role, admin_option FROM dba_role_privs;
sqlCopy code
SELECT * FROM dba_users WHERE ORACLE_MAINTAINED = 'N';
sqlCopy code
SELECT * FROM dba_tab_privs WHERE grantor = 'SYS';
sqlCopy code
SELECT * FROM v$diag_info WHERE name = 'ADR Home';
sqlCopy code
SELECT * FROM v$diag_alert_ext ORDER BY originating_timestamp DESC;
sqlCopy code
SELECT tablespace_name, status FROM dba_tablespaces;
sqlCopy code
SELECT * FROM v$version WHERE banner LIKE 'Oracle%';
这需要访问 Oracle Support 网站,下载并按照 Oracle 提供的文档应用最新的补丁。
sqlCopy code
EXEC DBMS_STATS.GATHER_DATABASE_STATS;
sqlCopy code
SELECT * FROM dba_indexes WHERE status = 'UNUSABLE';
这需要根据公司的具体策略制定清理脚本,删除过期的日志和备份文件。
访问监控工具的管理界面,检查配置项是否正确。
在监控工具中配置警报规则,确保在关键指标达到阈值时能够及时通知相关人员。