【问题标题】:How to run Hang Analyze Report in Oracle database如何在 Oracle 数据库中运行挂起分析报告
【发布时间】:2020-11-20 07:23:18
【问题描述】:

如果会话数大于 300,我们会尝试自动安排 hanganalyze,因为连续监控数据库太难了,而且这个问题只会持续几分钟。你能帮助我们创建程序吗?您能否确认运行此过程是否对性能有任何影响。

【问题讨论】:

    标签: oracle performance database-administration


    【解决方案1】:

    挂起分析是通过 oradebug 完成的,因此您将考虑使用 SQL Plus 检查会话计数,然后在需要时运行它,例如将其存储在脚本中

    spool /tmp/checker.sql
    select 
      case when count(*) > 300 then
        'oradebug setorapname reco' ||chr(10)||'oradebug -g all hanganalyze 3'
      else
        'REM do nothing'
      end
    from v$session
    spool off
    @/tmp/checker.sql
    

    然后有一个 SQL plus 会话:

    conn / as sysdba
    @script.sql
    host sleep 60
    @script.sql
    host sleep 60
    ...
    ...
    

    【讨论】:

    • 我已经验证了命令。它只打印 oradebug hang 分析语句。
    • SQL> 当 count() > 50 时选择 2 case then 3 'oradebug setorapname reco' ||chr(10)||'oradebug -g all hanganalyze 3' 4 else 5 'REM什么都不做' 6 end 7 from v$session; CASEWHENCOUNT()>50THEN'ORADEBUGSETORAPNAMERECO'||CHR(1 --------------------------------- ---------------------- oradebug setorapname reco
    • 是的,但是您正在将该命令假脱机到一个文件,然后运行该文件。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-03-09
    • 1970-01-01
    • 2011-11-22
    • 1970-01-01
    相关资源
    最近更新 更多