如何在 Oracle 中使用 v$session、v$sqlarea 和 v$process 对阻塞的会话进行故障排除?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/14109698/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 01:20:56  来源:igfitidea点击:

How do I use v$session, v$sqlarea and v$process in Oracle to troubleshoot blocked sessions?

oracle

提问by Ken Russell

v$session, v$sqlarea and v$process provide lot of information. What information from these views can I use for troubleshooting blocked sqlplus sessions?

v$session、v$sqlarea 和 v$process 提供了很多信息。我可以使用这些视图中的哪些信息来对阻塞的 sqlplus 会话进行故障排除?

回答by igr

Using v$session you can

使用 v$session 你可以

  • list all sessions
  • identify active sessions with STATUS='ACTIVE' and how long it was running LAST_CALL_ET
  • see running sql with SQL_ID or SQL_ADDR
  • If session is waiting check WAITcolumns for current wait details.
  • 列出所有会话
  • 使用 STATUS='ACTIVE' 识别活动会话以及它运行了多长时间 LAST_CALL_ET
  • 请参阅使用 SQL_ID 或 SQL_ADDR 运行 sql
  • 如果会话正在等待,请检查WAIT列以获取当前等待详细信息。

V$PROCCES is mostly with SESS_ADDR to find process ID of Oracle background process and application process ID.
V$SQLAREA and V$SQL provide text of SQL and more details for each SQL still in cache.
Start with this and explore more details from official Oracle documentation...

V$PROCCES 主要是用 SESS_ADDR 来查找 Oracle 后台进程的进程 ID 和应用程序进程 ID。
V$SQLAREA 和 V$SQL 为仍在缓存中的每个 SQL 提供 SQL 文本和更多详细信息。
从这个开始,从 Oracle 官方文档中探索更多细节......