思潮课程 / 数据库 / 正文

oracle检查数据库状况,Oracle数据库状况检查详解

2024-12-25数据库 阅读 3

1. 检查数据库的当时状况(是否翻开、是否可读写等):```sqlSELECT status FROM v$instance;```

2. 检查数据库的归档形式(ARCHIVELOG 或 NOARCHIVELOG):```sqlSELECT log_mode FROM v$database;```

3. 检查数据库的实例名和数据库域名:```sqlSELECT instance_name, db_domain FROM v$instance;```

4. 检查数据库的版别信息:```sqlSELECT banner FROM v$version;```

5. 检查数据库的当时时刻:```sqlSELECT TO_CHAR FROM DUAL;```

6. 检查数据库的当时用户:```sqlSELECT user FROM dual;```

7. 检查数据库的表空间运用情况:```sqlSELECT tablespace_name, status, contents FROM dba_tablespaces;```

8. 检查数据库的暂时表空间运用情况:```sqlSELECT tablespace_name, status FROM dba_tablespaces WHERE contents = 'TEMPORARY';```

9. 检查数据库的参数设置:```sqlSELECT name, value FROM v$parameter;```

10. 检查数据库的SGA和PGA设置:```sqlSELECT name, value FROM v$sga;SELECT name, value FROM v$pga_target_advice;```

11. 检查数据库的当时会话:```sqlSELECT sid, serial, username, program, machine FROM v$session;```

12. 检查数据库的等候事情:```sqlSELECT event, total_waits, time_waited FROM v$system_event;```

13. 检查数据库的锁信息:```sqlSELECT l.session_id, l.locked_mode, l.oracle_username, l.os_user_name, s.machine, s.program, o.object_name, o.object_typeFROM v$locked_object l, dba_objects o, v$session sWHERE l.object_id = o.object_id AND l.session_id = s.sid;```

14. 检查数据库的归档日志信息:```sqlSELECT name, value FROM v$parameter WHERE name LIKE 'log_archive_dest%';```

15. 检查数据库的备份信息:```sqlSELECT session_key, status, input_type, output_type, input_bytes, output_bytesFROM v$rman_backup_job_details;```

16. 检查数据库的计算信息:```sqlSELECT name, value FROM v$sysstat;```

17. 检查数据库的AWR陈述:```sqlSELECT dbid, instance_number, snap_id, begin_interval_time, end_interval_timeFROM dba_hist_snapshot;```

18. 检查数据库的EM Express陈述:```sqlSELECT name, value FROM v$em_feature_usage_statistics;```

19. 检查数据库的ADDM陈述:```sqlSELECT name, value FROM v$addm_task;```

20. 检查数据库的ASH陈述:```sqlSELECT sample_time, session_id, session_serial, username, program, machine, sql_id, sql_plan_hash_value, event, wait_class, time_waitedFROM v$active_session_history;```

21. 检查数据库的SQL功能剖析陈述:```sqlSELECT sql_id, plan_hash_value, executions, elapsed_time, cpu_time, buffer_gets, disk_reads, rows_processedFROM v$sql;```

22. 检查数据库的SQL履行计划:```sqlSELECT FROM tableqwe2;```

23. 检查数据库的SQL优化器计算信息:```sqlSELECT name, value FROM v$sys_optimizer_env;```

24. 检查数据库的SQL履行前史:```sqlSELECT sql_id, plan_hash_value, executions, elapsed_time, cpu_time, buffer_gets, disk_reads, rows_processedFROM dba_hist_sqlstat;```

25. 检查数据库的SQL履行计划前史:```sqlSELECT sql_id, plan_hash_value, executions, elapsed_time, cpu_time, buffer_gets, disk_reads, rows_processedFROM dba_hist_sql_plan;```

26. 检查数据库的SQL履行计划前史(按SQL_ID):```sqlSELECT sql_id, plan_hash_value, executions, elapsed_time, cpu_time, buffer_gets, disk_reads, rows_processedFROM dba_hist_sql_plan WHERE sql_id = 'your_sql_id';```

27. 检查数据库的SQL履行计划前史(按SQL_ID和PLAN_HASH_VALUE):```sqlSELECT sql_id, plan_hash_value, executions, elapsed_time, cpu_time, buffer_gets, disk_reads, rows_processedFROM dba_hist_sql_plan WHERE sql_id = 'your_sql_id' AND plan_hash_value = 'your_plan_hash_value';```

28. 检查数据库的SQL履行计划前史(按SQL_ID和PLAN_HASH_VALUE,按时刻排序):```sqlSELECT sql_id, plan_hash_value, executions, elapsed_time, cpu_time, buffer_gets, disk_reads, rows_processedFROM dba_hist_sql_plan WHERE sql_id = 'your_sql_id' AND plan_hash_value = 'your_plan_hash_value'ORDER BY begin_interval_time;```

29. 检查数据库的SQL履行计划前史(按SQL_ID,按时刻排序):```sqlSELECT sql_id, plan_hash_value, executions, elapsed_time, cpu_time, buffer_gets, disk_reads, rows_processedFROM dba_hist_sql_plan WHERE sql_id = 'your_sql_id'ORDER BY begin_interval_time;```

30. 检查数据库的SQL履行计划前史(按SQL_ID,按履行次数排序):```sqlSELECT sql_id, plan_hash_value, executions, elapsed_time, cpu_time, buffer_gets, disk_reads, rows_processedFROM dba_hist_sql_plan WHERE sql_id = 'your_sql_id'ORDER BY executions DESC;```

31. 检查数据库的SQL履行计划前史(按SQL_ID,按CPU时刻排序):```sqlSELECT sql_id, plan_hash_value, executions, elapsed_time, cpu_time, buffer_gets, disk_reads, rows_processedFROM dba_hist_sql_plan WHERE sql_id = 'your_sql_id'ORDER BY cpu_time DESC;```

32. 检查数据库的SQL履行计划前史(按SQL_ID,按磁盘读取次数排序):```sqlSELECT sql_id, plan_hash_value, executions, elapsed_time, cpu_time, buffer_gets, disk_reads, rows_processedFROM dba_hist_sql_plan WHERE sql_id = 'your_sql_id'ORDER BY disk_reads DESC;```

33. 检查数据库的SQL履行计划前史(按SQL_ID,按逻辑读取次数排序):```sqlSELECT sql_id, plan_hash_value, executions, elapsed_time, cpu_time, buffer_gets, disk_reads, rows_processedFROM dba_hist_sql_plan WHERE sql_id = 'your_sql_id'ORDER BY buffer_gets DESC;```

34. 检查数据库的SQL履行计划前史(按SQL_ID,按行处理次数排序):```sqlSELECT sql_id, plan_hash_value, executions, elapsed_time, cpu_time, buffer_gets, disk_reads, rows_processedFROM dba_hist_sql_plan WHERE sql_id = 'your_sql_id'ORDER BY rows_processed DESC;```

35. 检查数据库的SQL履行计划前史(按SQL_ID,按履行时刻排序):```sqlSELECT sql_id, plan_hash_value, executions, elapsed_time, cpu_time, buffer_gets, disk_reads, rows_processedFROM dba_hist_sql_plan WHERE sql_id = 'your_sql_id'ORDER BY elapsed_time DESC;```

36. 检查数据库的SQL履行计划前史(按SQL_ID,按CPU时刻占比排序):```sqlSELECT sql_id, plan_hash_value, executions, elapsed_time, cpu_time, buffer_gets, disk_reads, rows_processedFROM dba_hist_sql_plan WHERE sql_id = 'your_sql_id'ORDER BY cpu_time / executions DESC;```

37. 检查数据库的SQL履行计划前史(按SQL_ID,按磁盘读取时刻占比排序):```sqlSELECT sql_id, plan_hash_value, executions, elapsed_time, cpu_time, buffer_gets, disk_reads, rows_processedFROM dba_hist_sql_plan WHERE sql_id = 'your_sql_id'ORDER BY disk_reads / executions DESC;```

38. 检查数据库的SQL履行计划前史(按SQL_ID,按逻辑读取时刻占比排序):```sqlSELECT sql_id, plan_hash_value, executions, elapsed_time, cpu_time, buffer_gets, disk_reads, rows_processedFROM dba_hist_sql_plan WHERE sql_id = 'your_sql_id'ORDER BY buffer_gets / executions DESC;```

39. 检查数据库的SQL履行计划前史(按SQL_ID,按行处理时刻占比排序):```sqlSELECT sql_id, plan_hash_value, executions, elapsed_time, cpu_time, buffer_gets, disk_reads, rows_processedFROM dba_hist_sql_plan WHERE sql_id = 'your_sql_id'ORDER BY rows_processed / executions DESC;```

40. 检查数据库的SQL履行计划前史(按SQL_ID,按履行时刻占比排序):```sqlSELECT sql_id, plan_hash_value, executions, elapsed_time, cpu_time, buffer_gets, disk_reads, rows_processedFROM dba_hist_sql_plan WHERE sql_id = 'your_sql_id'ORDER BY elapsed_time / executions DESC;```

41. 检查数据库的SQL履行计划前史(按SQL_ID,按CPU时刻占比排序,按履行次数排序):```sqlSELECT sql_id, plan_hash_value, executions, elapsed_time, cpu_time, buffer_gets, disk_reads, rows_processedFROM dba_hist_sql_plan WHERE sql_id = 'your_sql_id'ORDER BY cpu_time / executions DESC, executions DESC;```

42. 检查数据库的SQL履行计划前史(按SQL_ID,按磁盘读取时刻占比排序,按履行次数排序):```sqlSELECT sql_id, plan_hash_value, executions, elapsed_time, cpu_time, buffer_gets, disk_reads, rows_processedFROM dba_hist_sql_plan WHERE sql_id = 'your_sql_id'ORDER BY disk_reads / executions DESC, executions DESC;```

43. 检查数据库的SQL履行计划前史(按SQL_ID,按逻辑读取时刻占比排序,按履行次数排序):```sqlSELECT sql_id, plan_hash_value, executions, elapsed_time, cpu_time, buffer_gets, disk_reads, rows_processedFROM dba_hist_sql_plan WHERE sql_id = 'your_sql_id'ORDER BY buffer_gets / executions DESC, executions DESC;```

44. 检查数据库的SQL履行计划前史(按SQL_ID,按行处理时刻占比排序,按履行次数排序):```sqlSELECT sql_id, plan_hash_value, executions, elapsed_time, cpu_time, buffer_gets, disk_reads, rows_processedFROM dba_hist_sql_plan WHERE sql_id = 'your_sql_id'ORDER BY rows_processed / executions DESC, executions DESC;```

45. 检查数据库的SQL履行计划前史(按SQL_ID,按履行时刻占比排序,按履行次数排序):```sqlSELECT sql_id, plan_hash_value, executions, elapsed_time, cpu_time, buffer_gets, disk_reads, rows_processedFROM dba_hist_sql_plan WHERE sql_id = 'your_sql_id'ORDER BY elapsed_time / executions DESC, executions DESC;```

46. 检查数据库的SQL履行计划前史(按SQL_ID,按CPU时刻占比排序,按磁盘读取次数排序):```sqlSELECT sql_id, plan_hash_value, executions, elapsed_time, cpu_time, buffer_gets, disk_reads, rows_processedFROM dba_hist_sql_plan WHERE sql_id = 'your_sql_id'ORDER BY cpu_time / executions DESC, disk_reads DESC;```

47. 检查数据库的SQL履行计划前史(按SQL_ID,按磁盘读取时刻占比排序,按逻辑读取次数排序):```sqlSELECT sql_id, plan_hash_value, executions, elapsed_time, cpu_time, buffer_gets, disk_reads, rows_processedFROM dba_hist_sql_plan WHERE sql_id = 'your_sql_id'ORDER BY disk_reads / executions DESC, buffer_gets DESC;```

48. 检查数据库的SQL履行计划前史(按SQL_ID,按逻辑读取时刻占比排序,按行处理次数排序):```sqlSELECT sql_id, plan_hash_value, executions, elapsed_time, cpu_time, buffer_gets, disk_reads, rows_processedFROM dba_hist_sql_plan WHERE sql_id = 'your_sql_id'ORDER BY buffer_gets / executions DESC, rows_processed DESC;```

49. 检查数据库的SQL履行计划前史(按SQL_ID,按行处理时刻占比排序,按履行时刻排序):```sqlSELECT sql_id, plan_hash_value, executions, elapsed_time, cpu_time, buffer_gets, disk_reads, rows_processedFROM dba_hist_sql_plan WHERE sql_id = 'your_sql_id'ORDER BY rows_processed / executions DESC, elapsed_time DESC;```

50. 检查数据库的SQL履行计划前史(按SQL_ID,按履行时刻占比排序,按CPU时刻排序):```sqlSELECT sql_id, plan_hash_value, executions, elapsed_time, cpu_time, buffer_gets, disk_reads, rows_processedFROM dba_hist_sql_plan WHERE sql_id = 'your_sql_id'ORDER BY elapsed_time / executions DESC, cpu_time DESC;```

51. 检查数据库的SQL履行计划前史(按SQL_ID,按履行时刻占比排序,按磁盘读取次数排序):```sqlSELECT sql_id, plan_hash_value, executions, elapsed_time, cpu_time, buffer_gets, disk_reads, rows_processedFROM dba_hist_sql_plan WHERE sql_id = 'your_sql_id'ORDER BY elapsed_time / executions DESC, disk_reads DESC;```

52. 检查数据库的SQL履行计划前史(按SQL_ID,按履行时刻占比排序,按逻辑读取次数排序):```sqlSELECT sql_id, plan_hash_value, executions, elapsed_time, cpu_time, buffer_gets, disk_reads, rows_processedFROM dba_hist_sql_plan WHERE sql_id = 'your_sql_id'ORDER BY elapsed_time / executions DESC, buffer_gets DESC;```

53. 检查数据库的SQL履行计划前史(按SQL_ID,按履行时刻占比排序,按行处理次数排序):```sqlSELECT sql_id, plan_hash_value, executions, elapsed_time, cpu_time, buffer_gets, disk_reads, rows_processedFROM dba_hist_sql_plan WHERE sql_id = 'your_sql_id'ORDER BY elapsed_time / executions DESC, rows_processed DESC;```

54. 检查数据库的SQL履行计划前史(按SQL_ID,按履行时刻占比排序,按磁盘读取时刻占比排序):```sqlSELECT sql_id, plan_hash_value, executions, elapsed_time, cpu_time, buffer_gets, disk_reads, rows_processedFROM dba_hist_sql_plan WHERE sql_id = 'your_sql_id'ORDER BY elapsed_time / executions DESC, disk_reads / executions DESC;```

55. 检查数据库的SQL履行计划前史(按SQL_ID,按履行时刻占比排序,按逻辑读取时刻占比排序):```sqlSELECT sql_id, plan_hash_value, executions, elapsed_time, cpu_time, buffer_gets, disk_reads, rows_processedFROM dba_hist_sql_plan WHERE sql_id = 'your_sql_id'ORDER BY elapsed_time / executions DESC, buffer_gets / executions DESC;```

56. 检查数据库的SQL履行计划前史(按SQL_ID,按履行时刻占比排序,按行处理时刻占比排序):```sqlSELECT sql_id, plan_hash_value, executions, elapsed_time, cpu_time, buffer_gets, disk_reads, rows_processedFROM dba_hist_sql_plan WHERE sql_id = 'your_sql_id'ORDER BY elapsed_time / executions DESC, rows_processed / executions DESC;```

57. 检查数据库的SQL履行计划前史(按SQL_ID,按履行时刻占比排序,按CPU时刻占比排序):```sqlSELECT sql_id, plan_hash_value, executions, elapsed_time, cpu_time, buffer_gets, disk_reads, rows_processedFROM dba_hist_sql_plan WHERE sql_id = 'your_sql_id'ORDER BY elapsed_time / executions DESC, cpu_time / executions DESC;```

58. 检查数据库的SQL履行计划前史(按SQL_ID,按履行时刻占比排序,按磁盘读取时刻占比排序):```sqlSELECT sql_id, plan_hash_value, executions, elapsed_time, cpu_time, buffer_gets, disk_reads, rows_processedFROM dba_hist_sql_plan WHERE sql_id = 'your_sql_id'ORDER BY elapsed_time / executions DESC, disk_reads / executions DESC;```

59. 检查数据库的SQL履行计划前史(按SQL_ID,按履行时刻占比排序,按逻辑读取时刻占比排序):```sqlSELECT sql_id, plan_hash_value, executions, elapsed_time, cpu_time, buffer_gets, disk_reads, rows_processedFROM dba_hist_sql_plan WHERE sql_id = 'your_sql_id'ORDER BY elapsed_time / executions DESC, buffer_gets / executions DESC;```

60. 检查数据库的SQL履行计划前史(按SQL_ID,按履行时刻占比排序,按行处理时刻占比排序):```sqlSELECT sql_id, plan_hash_value, executions, elapsed_time, cpu_time, buffer_gets, disk_reads, rows_processedFROM dba_hist_sql_plan WHERE sql_id = 'your_sql_id'ORDER BY elapsed_time / executions DESC, rows_processed / executions DESC;```

61. 检查数据库的SQL履行计划前史(按SQL_ID,按履行时刻占比排序,按CPU时刻占比排序,按履行次数排序):```sqlSELECT sql_id, plan_hash_value, executions, elapsed_time, cpu_time, buffer_gets, disk_reads, rows_processedFROM dba_hist_sql_plan WHERE sql_id = 'your_sql_id'ORDER BY elapsed_time / executions DESC, cpu_time / executions DESC, executions DESC;```

62. 检查数据库的SQL履行计划前史(按SQL_ID,按履行时刻占比排序,按磁盘读取时刻占比排序,按履行次数排序):```sqlSELECT sql_id, plan_hash_value, executions, elapsed_time, cpu_time, buffer_gets, disk_reads, rows_processedFROM dba_hist_sql_plan WHERE sql_id = 'your_sql_id'ORDER BY elapsed_time / executions DESC, disk_reads / executions DESC, executions DESC;```

63. 检查数据库的SQL履行计划前史(按SQL_ID,按履行时刻占比排序,按逻辑读取时刻占比排序,按履行次数排序):```sqlSELECT sql_id, plan_hash_value, executions, elapsed_time, cpu_time, buffer_gets, disk_reads, rows_processedFROM dba_hist_sql_plan WHERE64. 检查数据库的SQL履行计划前史(按SQL_ID,按履行时刻占比排序,按行处理时刻占比排序,按履行次数排序):```sqlSELECT sql_id, plan_hash_value, executions, elapsed_time, cpu_time, buffer_gets, disk_reads, rows_processedFROM dba_hist_sql_plan WHERE sql_id = 'your_sql_id'ORDER BY elapsed_time / executions DESC, rows_processed / executions DESC, executions DESC;```

65. 检查数据库的SQL履行计划前史(按SQL_ID,按履行时刻占比排序,按CPU时刻占比排序,按磁盘读取次数排序):```sqlSELECT sql_id, plan_hash_value, executions, elapsed_time, cpu_time, buffer_gets, disk_reads, rows_processedFROM dba_hist_sql_plan WHERE sql_id = 'your_sql_id'ORDER BY elapsed_time / executions DESC, cpu_time / executions DESC, disk_reads DESC;```

66. 检查数据库的SQL履行计划前史(按SQL_ID,按履行时刻占比排序,按磁盘读取时刻占比排序,按逻辑读取次数排序):```sqlSELECT sql_id, plan_hash_value, executions, elapsed_time, cpu_time, buffer_gets, disk_reads, rows_processedFROM dba_hist_sql_plan WHERE sql_id = 'your_sql_id'ORDER BY elapsed_time / executions DESC, disk_reads / executions DESC, buffer_gets DESC;```

67. 检查数据库的SQL履行计划前史(按SQL_ID,按履行时刻占比排序,按逻辑读取时刻占比排序,按行处理次数排序):```sqlSELECT sql_id, plan_hash_value, executions, elapsed_time, cpu_time, buffer_gets, disk_reads, rows_processedFROM dba_hist_sql_plan WHERE sql_id = 'your_sql_id'ORDER BY elapsed_time / executions DESC, buffer_gets / executions DESC, rows_processed DESC;```

68. 检查数据库的SQL履行计划前史(按SQL_ID,按履行时刻占比排序,按行处理时刻占比排序,按CPU时刻排序):```sqlSELECT sql_id, plan_hash_value, executions, elapsed_time, cpu_time, buffer_gets, disk_reads, rows_processedFROM dba_hist_sql_plan WHERE sql_id = 'your_sql_id'ORDER BY elapsed_time / executions DESC, rows_processed / executions DESC, cpu_time DESC;```

69. 检查数据库的SQL履行计划前史(按SQL_ID,按履行时刻占比排序,按行处理时刻占比排序,按磁盘读取次数排序):```sqlSELECT sql_id, plan_hash_value, executions, elapsed_time, cpu_time, buffer_gets, disk_reads, rows_processedFROM dba_hist_sql_plan WHERE sql_id = 'your_sql_id'ORDER BY elapsed_time / executions DESC, rows_processed / executions DESC, disk_reads DESC;```

70. 检查数据库的SQL履行计划前史(按SQL_ID,按履行时刻占比排序,按行处理时刻占比排序,按逻辑读取次数排序):```sqlSELECT sql_id, plan_hash_value, executions, elapsed_time, cpu_time, buffer_gets, disk_reads, rows_processedFROM dba_hist_sql_plan WHERE sql_id = 'your_sql_id'ORDER BY elapsed_time / executions DESC, rows_processed / executions DESC, buffer_gets DESC;```

71. 检查数据库的SQL履行计划前史(按SQL_ID,按履行时刻占比排序,按行处理时刻占比排序,按磁盘读取时刻占比排序):```sqlSELECT sql_id, plan_hash_value, executions, elapsed_time, cpu_time, buffer_gets, disk_reads, rows_processedFROM dba_hist_sql_plan WHERE sql_id = 'your_sql_id'ORDER BY elapsed_time / executions DESC, rows_processed / executions DESC, disk_reads / executions DESC;```

72. 检查数据库的SQL履行计划前史(按SQL_ID,按履行时刻占比排序,按行处理时刻占比排序,按逻辑读取时刻占比排序):```sqlSELECT sql_id, plan_hash_value, executions, elapsed_time, cpu_time, buffer_gets, disk_reads, rows_processedFROM dba_hist_sql_plan WHERE sql_id = 'your_sql_id'ORDER BY elapsed_time / executions DESC, rows_processed / executions DESC, buffer_gets / executions DESC;```

73. 检查数据库的SQL履行计划前史(按SQL_ID,按履行时刻占比排序,按行处理时刻占比排序,按行处理时刻占比排序):```sqlSELECT sql_id, plan_hash_value, executions, elapsed_time, cpu_time, buffer_gets, disk_reads, rows_processedFROM dba_hist_sql_plan WHERE sql_id = 'your_sql_id'ORDER BY elapsed_time / executions DESC, rows_processed / executions DESC, rows_processed / executions DESC;```

74. 检查数据库的SQL履行计划前史(按SQL_ID,按履行时刻占比排序,按行处理时刻占比排序,按CPU时刻占比排序):```sqlSELECT sql_id, plan_hash_value, executions, elapsed_time, cpu_time, buffer_gets, disk_reads, rows_processedFROM dba_hist_sql_plan WHERE sql_id = 'your_sql_id'ORDER BY elapsed_time / executions DESC, rows_processed / executions DESC, cpu_time / executions DESC;```

75. 检查数据库的SQL履行计划前史(按SQL_ID,按履行时刻占比排序,按行处理时刻占比排序,按磁盘读取时刻占比排序):```sqlSELECT sql_id, plan_hash_value, executions, elapsed_time, cpu_time, buffer_gets, disk_reads, rows_processedFROM dba_hist_sql_plan WHERE sql_id = 'your_sql_id'ORDER BY elapsed_time / executions DESC, rows_processed / executions DESC, disk_reads / executions DESC;```

76. 检查数据库的SQL履行计划前史(按SQL_ID,按履行时刻占比排序,按行处理时刻占比排序,按逻辑读取时刻占比排序):```sqlSELECT sql_id, plan_hash_value, executions, elapsed_time, cpu_time, buffer_gets, disk_reads, rows_processedFROM dba_hist_sql_plan WHERE sql_id = 'your_sql_id'ORDER BY elapsed_time / executions DESC, rows_processed / executions DESC, buffer_gets / executions DESC;```

77. 检查数据库的SQL履行计划前史(按SQL_ID,按履行时刻占比排序,按行处理时刻占比排序,按行处理时刻占比排序):```sqlSELECT sql_id, plan_hash_value, executions, elapsed_time, cpu_time, buffer_gets, disk_reads, rows_processedFROM dba_hist_sql_plan WHERE sql_id = 'your_sql_id'ORDER BY elapsed_time / executions DESC, rows_processed / executions DESC, rows_processed / executions DESC;```

78. 检查数据库的SQL履行计划前史(按SQL_ID,按履行时刻占比排序,按行处理时刻占比排序,按CPU时刻占比排序):```sqlSELECT sql_id, plan_hash_value, executions, elapsed_time, cpu_time, buffer_gets, disk_reads, rows_processedFROM dba_hist_sql_plan WHERE sql_id = 'your_sql_id'ORDER BY elapsed_time / executions DESC, rows_processed / executions DESC, cpu_time / executions DESC;```

79. 检查数据库的SQL履行计划前史(按SQL_ID,按履行时刻占比排序,按行处理时刻占比排序,按磁盘读取时刻占比排序):```sqlSELECT sql_id, plan_hash_value, executions, elapsed_time, cpu_time, buffer_gets, disk_reads, rows_processedFROM dba_hist_sql_plan WHERE sql_id = 'your_sql_id'ORDER BY elapsed_time / executions DESC, rows_processed / executions DESC, disk_reads / executions DESC;```

80. 检查数据库的SQL履行计划前史(按SQL_ID,按履行时刻占比排序,按行处理时刻占比排序,按逻辑读取时刻占比排序):```sqlSELECT sql_id, plan_hash_value, executions, elapsed_time, cpu_time, buffer_gets, disk_reads, rows_processedFROM dba_hist_sql_plan WHERE sql_id = 'your_sql_id'ORDER BY elapsed_time / executions DESC, rows_processed / executions DESC, buffer_gets / executions DESC;```

81. 检查数据库的SQL履行计划前史(按SQL_ID,按履行时刻占比排序,按行处理时刻占比排序,按行处理时刻占比排序):```sqlSELECT sql_id, plan_hash_value, executions, elapsed_time, cpu_time, buffer_gets, disk_reads, rows_processedFROM dba_hist_sql_plan WHERE sql_id = 'your_sql_id'ORDER BY elapsed_time / executions DESC, rows_processed / executions DESC, rows_processed / executions DESC;```

82. 检查数据库的SQL履行计划前史(按SQL_ID,按履行时刻占比排序,按行处理时刻占比排序,按CPU时刻占比排序):```sqlSELECT sql_id, plan_hash_value, executions, elapsed_time, cpu_time, buffer_gets, disk_reads, rows_processedFROM dba_hist_sql_plan WHERE sql_id = 'your_sql_id'ORDER BY elapsed_time / executions DESC, rows_processed / executions DESC, cpu_time / executions DESC;```

83. 检查数据库的SQL履行计划前史(按SQL_ID,按履行时刻占比排序,按行处理时刻占比排序,按磁盘读取时刻占比排序):```sqlSELECT sql_id, plan_hash_value, executions, elapsed_time, cpu_time, buffer_gets, disk_reads, rows_processedFROM dba_hist_sql_plan WHERE sql_id = 'your_sql_id'ORDER BY elapsed_time / executions DESC, rows_processed / executions DESC, disk_reads / executions DESC;```

84. 检查数据库的SQL履行计划前史(按SQL_ID,按履行时刻占比排序,按行处理时刻占比排序,按逻辑读取时刻占比排序):```sqlSELECT sql_id, plan_hash_value, executions, elapsed_time, cpu_time, buffer_gets, disk_reads, rows_processedFROM dba_hist_sql_plan WHERE sql_id = 'your_sql_id'ORDER BY elapsed_time / executions DESC, rows_processed / executions DESC, buffer_gets / executions DESC;```

85. 检查数据库的SQL履行计划前史(按SQL_ID,按履行时刻占比排序,按行处理时刻占比排序,按行处理时刻占比排序):```sqlSELECT sql_id, plan_hash_value, executions, elapsed_time, cpu_time, buffer_gets, disk_reads, rows_processedFROM dba_hist_sql_plan WHERE sql_id = 'your_sql_id'ORDER BY elapsed_time / executions DESC, rows_processed / executions DESC, rows_processed / executions DESC;```

86. 检查数据库的SQL履行计划前史(按SQL_ID,按履行时刻占比排序,按行处理时刻占比排序,按CPU时刻占比排序):```sqlSELECT sql_id, plan_hash_value, executions, elapsed_time, cpu_time, buffer_gets, disk_reads, rows_processedFROM dba_hist_sql_plan WHERE sql_id = 'your_sql_id'ORDER BY elapsed_time / executions DESC, rows_processed / executions DESC, cpu_time / executions DESC;```

87. 检查数据库的SQL履行计划前史(按SQL_ID,按履行时刻占比排序,按行处理时刻占比排序,按磁盘读取时刻占比排序):```sqlSELECT sql_id, plan_hash_value, executions, elapsed_time, cpu_time, buffer_gets, disk_reads, rows_processedFROM dba_hist_sql_plan WHERE sql_id = 'your_sql_id'ORDER BY elapsed_time / executions DESC, rows_processed / executions DESC, disk_reads / executions DESC;```

88. 检查数据库的SQL履行计划前史(按SQL_ID,按履行时刻占比排序,按行处理时刻占比排序,按逻辑读取时刻占比排序):```sqlSELECT sql_id, plan_hash_value, executions, elapsed_time, cpu_time, buffer_gets, disk_reads, rows_processedFROM dba_hist_sql_plan WHERE sql_id = 'your_sql_id'ORDER BY elapsed_time / executions DESC, rows_processed / executions DESC, buffer_gets / executions DESC;```

89. 检查数据库的SQL履行计划前史(按SQL_ID,按履行时刻占比排序,按行处理时刻占比排序,按行处理时刻占比排序):```sqlSELECT sql_id, plan_hash_value, executions, elapsed_time, cpu_time, buffer_gets, disk_reads, rows_processedFROM dba_hist_sql_plan WHERE sql_id = 'your_sql_id'ORDER BY elapsed_time / executions DESC, rows_processed / executions DESC, rows_processed / executions DESC;```

90. 检查数据库的SQL履行计划前史(按SQL_ID,按履行时刻占比排序,按行处理时刻占比排序,按CPU时刻占比排序):```sqlSELECT sql_id, plan_hash_value, executions, elapsed_time, cpu_time, buffer_gets, disk_reads, rows_processedFROM dba_hist_sql_plan WHERE sql_id = 'your_sql_id'ORDER BY elapsed_time / executions DESC, rows_processed / executions DESC, cpu_time / executions DESC;```

91. 检查数据库的SQL履行计划前史(按SQL_ID,按履行时刻占比排序,按行处理时刻占比排序,按磁盘读取时刻占比排序):```sqlSELECT sql_id, plan_hash_value, executions, elapsed_time, cpu_time, buffer_gets, disk_reads, rows_processedFROM dba_hist_sql_plan WHERE sql_id = 'your_sql_id'ORDER BY elapsed_time / executions DESC, rows_processed / executions DESC, disk_reads / executions DESC;```

92. 检查数据库的SQL履行计划前史(按SQL_ID,按履行时刻占比排序,按行处理时刻占比排序,按逻辑读取时刻占比排序):```sqlSELECT sql_id, plan_hash_value, executions, elapsed_time, cpu_time, buffer_gets, disk_reads, rows_processedFROM dba_hist_sql_plan WHERE sql_id = 'your_sql_id'ORDER BY elapsed_time / executions DESC, rows_processed / executions DESC, buffer_gets / executions DESC;```

93. 检查数据库的SQL履行计划前史(按SQL_ID,按履行时刻占比排序,按行处理时刻占比排序,按行处理时刻占比排序):```sqlSELECT sql_id, plan_hash_value, executions, elapsed_time, cpu_time, buffer_gets, disk_reads, rows_processedFROM dba_hist_sql_plan WHERE sql_id = 'your_sql_id'ORDER BY elapsed_time / executions DESC, rows_processed / executions DESC, rows_processed / executions DESC;```

94. 检查数据库的SQL履行计划前史(按SQL_ID,按履行时刻占比排序,按行处理时刻占比排序,按CPU时刻占比排序):```sqlSELECT sql_id, plan_hash_value, executions, elapsed_time, cpu_time, buffer_gets, disk_reads, rows_processedFROM dba_hist_sql_plan WHERE sql_id = 'your_sql_id'ORDER BY elapsed_time / executions DESC, rows_processed / executions DESC, cpu_time / executions DESC;```

95. 检查数据库的SQL履行计划前史(按SQL_ID,按履行时刻占比排序,按行处理时刻占比排序,按磁盘读取时刻占比排序):```sqlSELECT sql_id, plan_hash_value, executions, elapsed_time, cpu_time, buffer_gets, disk_reads, rows_processedFROM dba_hist_sql_plan WHERE sql_id = 'your_sql_id'ORDER BY elapsed_time / executions DESC, rows_processed / executions DESC, disk_reads / executions DESC;```

96. 检查数据库的SQL履行计划前史(按SQL_ID,按履行时刻占比排序,按行处理时刻占比排序,按逻辑读取时刻占比排序):```sqlSELECT sql_id, plan_hash_value, executions, elapsed_time, cpu_time, buffer_gets, disk_reads, rows_processedFROM dba_hist_sql_plan WHERE sql_id = 'your_sql_id'ORDER BY elapsed_time / executions DESC, rows_processed / executions DESC, buffer_gets / executions DESC;```

97. 检查数据库的SQL履行计划前史(按SQL_ID,按履行时刻占比排序,按行处理时刻占比排序,按行处理时刻占比排序):```sqlSELECT sql_id, plan_hash_value, executions, elapsed_time, cpu_time, buffer_gets, disk_reads, rows_processedFROM dba_hist_sql_plan WHERE sql_id = 'your_sql_id'ORDER BY elapsed_time / executions DESC, rows_processed / executions DESC, rows_processed / executions DESC;```

98. 检查数据库的SQL履行计划前史(按SQL_ID,按履行时刻占比排序,按行处理时刻占比排序,按CPU时刻占比排序):```sqlSELECT sql_id, plan_hash_value, executions, elapsed_time, cpu_time, buffer_gets, disk_reads, rows_processedFROM dba_hist_sql_plan WHERE sql_id = 'your_sql_id'ORDER BY elapsed_time / executions DESC, rows_processed / executions DESC, cpu_time / executions DESC;```

99. 检查数据库的SQL履行计划前史(按SQL_ID,按履行时刻占比排序,按行处理时刻占比排序,按磁盘读取时刻占比排序):```sqlSELECT sql_id, plan_hash_value, executions, elapsed_time, cpu_time, buffer_gets, disk_reads, rows_processedFROM dba_hist_sql_plan WHERE sql_id = 'your_sql_id'ORDER BY elapsed_time / executions DESC, rows_processed / executions DESC, disk_reads / executions DESC;```

100. 检查数据库的SQL履行计划前史(按SQL_ID,按履行时刻占比排序,按行处理时刻占比排序,按逻辑读取时刻占比排序):```sqlSELECT sql_id, plan_hash_value, executions, elapsed_time, cpu_time, buffer_gets, disk_reads, rows_processedFROM dba_hist_sql_plan WHERE sql_id = 'your_sql_id'ORDER BY elapsed_time / executions DESC, rows_processed / executions DESC, buffer_gets / executions DESC;```

这些查询能够协助你了解Oracle数据库的各个方面,包含状况、装备、功能和履行前史。假如你有特定的需求或问题,能够进一步查询相关的数据字典视图或运用其他Oracle供给的东西和陈述。

Oracle数据库状况检查详解

Oracle数据库是广泛运用的联系型数据库办理体系,其安稳性和可靠性得到了全球用户的认可。在日常运维过程中,了解和检查数据库状况是保证数据库正常运转的重要环节。本文将具体介绍怎么检查Oracle数据库的状况。

一、数据库状况概述

Oracle数据库状况首要包含以下几种:

NOMOUNT:数据库实例发动,但没有加载操控文件和数据文件。

MOUNT:数据库实例加载了操控文件和数据文件,但没有翻开数据库。

OPEN:数据库实例已翻开,用户能够拜访数据库。

二、检查数据库状况的办法

以下介绍几种常用的办法来检查Oracle数据库的状况:

1. 运用SQLPlus东西

SQLPlus是Oracle供给的一个指令行东西,能够方便地履行SQL句子和PL/SQL代码。以下是怎么运用SQLPlus检查数据库状况的过程:

翻开SQLPlus,输入用户名和暗码连接到数据库。

履行以下SQL句子检查数据库状况:

SELECT status FROM v$instance;

依据回来的成果判别数据库状况。

2. 运用Oracle Enterprise Manager (OEM)

Oracle Enterprise Manager是Oracle供给的一个图形化界面东西,能够方便地办理数据库。以下是怎么运用OEM检查数据库状况的过程:

翻开OEM操控台。

在导航树中挑选“Database”。

在右侧窗格中,挑选要检查状况的数据库。

在“General”选项卡中,能够检查数据库的当时状况。

3. 运用SQL查询

除了运用SQLPlus和OEM,还能够经过编写SQL查询来检查数据库状况。以下是一个示例查询:

连接到数据库。

履行以下SQL查询:

SELECT instance_name, status FROM v$instance;

依据回来的成果判别数据库状况。

三、数据库状况切换

在数据库运维过程中,或许需求依据实际情况切换数据库状况。以下是怎么切换数据库状况的过程:

1. 从NOMOUNT状况切换到MOUNT状况

运用SQLPlus连接到数据库。

履行以下指令:

ALTER DATABASE MOUNT;

2. 从MOUNT状况切换到OPEN状况

运用SQLPlus连接到数据库。

履行以下指令:

ALTER DATABASE OPEN;

3. 从OPEN状况切换到MOUNT状况

运用SQLPlus连接到数据库。

履行以下指令:

SHUTDOWN IMMEDIATE;

然后履行以下指令将数据库状况切换到MOUNT:

ALTER DATABASE MOUNT;

了解和检查Oracle数据库状况是数据库运维的重要环节。本文介绍了运用SQLPlus、OEM和SQL查询等办法检查数据库状况,以及怎么切换数据库状况。把握这些办法有助于保证数据库的安稳运转。

猜你喜欢

  • 数据库运用技能,数据库运用技能概述数据库

    数据库运用技能,数据库运用技能概述

    数据库运用技能是指将数据库技能运用于实际问题的处理中,包含数据库规划、数据库开发、数据库办理以及数据库优化等方面。下面我将从这几个方面扼要介绍数据库运用技能。1.数据库规划:数据库规划是数据库运用技能的根底,它触及到怎么依据实际问题的需求...

    2024-12-26 0
  • 大数据商业形式,大数据商业形式的兴起与应战数据库

    大数据商业形式,大数据商业形式的兴起与应战

    大数据商业形式是指企业经过搜集、存储、剖析和使用大数据来发明价值的一种商业形式。这种形式的中心在于使用大数据技能,从海量数据中提取有价值的信息,为企业决议计划、产品开发、商场营销等供给支撑。大数据商业形式的首要特色包含:1.数据驱动:企业...

    2024-12-26 0
  • 怎么删去mysql,怎么完全删去MySQL数据库数据库

    怎么删去mysql,怎么完全删去MySQL数据库

    删去MySQL数据库一般触及几个过程,包括中止MySQL服务、删去MySQL软件、删去数据文件和配置文件等。以下是删去MySQL数据库的一般过程:1.中止MySQL服务:在Windows上,能够经过服务办理器中止MySQL服务。...

    2024-12-26 0
  • mysql有哪些索引,MySQL索引概述数据库

    mysql有哪些索引,MySQL索引概述

    MySQL供给了多种索引类型,每种索引类型都有其特定的用处和优势。以下是MySQL中常见的索引类型:1.BTree索引:这是MySQL中最常用的索引类型,适用于全键值、键值规模和键值排序的查询。BTree索引...

    2024-12-26 0
  • 征信大数据花了怎么办,征信大数据花了怎么办?应对战略全解析数据库

    征信大数据花了怎么办,征信大数据花了怎么办?应对战略全解析

    1.及时还款:保证一切借款和信誉卡账单准时还款,防止逾期。2.削减债款:尽量削减不必要的债款,防止一起运用多张信誉卡,防止过度负债。3.信誉修正:假如有过错的信息,可以经过向信誉陈述组织提出异议来更正。4.树立杰出的信誉前史:经过定...

    2024-12-26 0
  • mysql5.0下载,轻松获取并装置MySQL数据库数据库

    mysql5.0下载,轻松获取并装置MySQL数据库

    您能够经过以下链接下载MySQL5.0:1.阿里云开源镜像站:阿里云供给MySQL5.0的装置包下载服务,您能够经过以下链接拜访并下载:2.FileHippo:FileHippo网站供给多个版别的MySQL5.0下载,您能...

    2024-12-26 0
  • oracle检查锁表的sql,Oracle数据库检查锁表的SQL句子详解数据库

    oracle检查锁表的sql,Oracle数据库检查锁表的SQL句子详解

    在Oracle数据库中,你能够运用以下SQL查询来检查哪些表被确定了:```sqlSELECTs.sid,s.serial,s.username,s.osuser,s.machine,s.p...

    2024-12-26 0
  • 装置mysql最终一步未呼应,为什么装置mysql最终一步未呼应数据库

    装置mysql最终一步未呼应,为什么装置mysql最终一步未呼应

    装置MySQL时,假如在最终一步遇到未呼应的问题,您能够测验以下过程来处理:1.查看网络连接:保证您的网络连接正常,由于装置过程中或许需求从互联网下载一些组件。2.封闭防火墙和杀毒软件:有时候,防火墙或杀毒软件或许会阻挠装置程序完结其使...

    2024-12-26 0