Oracle数据库挂起了怎么办?

2024年 2月 23日 43.0k 0

当Oracle数据库挂起或变得无响应时,你该怎么办?传统上,唯一的选择是重新启动数据库。但是从12c开始,Oracle引入了一个新特性,即实时自动数据库诊断监视器(Real-Time ADDM),它可以在传统连接失败时以latch-less方式连接到数据库,并进行诊断。

关于号主,姚远:

  • Oracle ACE(Oracle和MySQL数据库方向)

  • 华为云最有价值专家

  • 《MySQL 8.0运维与优化》的作者

  • 拥有 Oracle 10g、12c和19c OCM等数十项数据库认证

  • 曾任IBM公司数据库部门经理

  • 20+年DBA经验,服务2万+客户

  • 精通C和Java,发明两项计算机专利

01

概述

管理性能监视器进程(MMON)每3秒运行一次,检查内存中存在的性能问题。一旦检测到任何潜在的性能问题,MMON会启动Real-Time ADDM分析,生成报告,并将其存储在dba_hist_reports和dba_hist_reports_details视图中,视图保存在AWR表空间。有9种性能问题可以触发Real-Time ADDM分析,官方文档列表在这里(https://docs.oracle.com/en/database/oracle/oracle-database/19/tgdba/automatic-performance-diagnostics.html#GUID-9DD81F99-3B4D-4340-9F19-30E5B47DC41D)。

02

模拟性能问题

以下脚本通过模拟登录风暴来伪造性能问题:

    #!/bin/bash


    # Oracle database connection details
    DB_HOST="192.168.???.???"
    DB_PORT="1521"
    DB_SID="?????.example.com"
    DB_USER="scott"
    DB_PASSWORD="scott"


    # Number of concurrent processes
    NUM_PROCESSES=1000


    # Function to perform login
    perform_login() {
    sqlplus -S ${DB_USER}/${DB_PASSWORD}@${DB_HOST}:${DB_PORT}/${DB_SID} @?/rdbms/admin/rtaddmrpti.sql


    Instances in this Report reposistory
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


    Db Id Inst Num
    ---------- --------
    3148008031 1


    Default to current database
    **Enter value for dbid:**


    Using database id: 3148008031


    Enter begin time for report:


    -- Valid input formats:
    -- To specify absolute begin time:
    -- [MM/DD[/YY]] HH24:MI[:SS]
    -- Examples: 02/23/03 14:30:15
    -- 02/23 14:30:15
    -- 14:30:15
    -- 14:30
    -- To specify relative begin time: (start with '-' sign)
    -- -[HH24:]MI
    -- Examples: -1:15 (SYSDATE - 1 Hr 15 Mins)
    -- -25 (SYSDATE - 25 Mins)


    Default to -60 mins
    **Enter value for begin_time: -600**
    Report begin time specified: -600


    Enter duration in minutes starting from begin time:
    Defaults to SYSDATE - begin_time
    Press Enter to analyze till current time
    **Enter value for duration:**
    Report duration specified:


    Using 21/02/2024 04:24:05 as report begin time
    Using 21/02/2024 14:24:14 as report end time


    Report ids in this workload repository.
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


    DBID REPORT_ID TIME trigger_cause impact
    ---------- --------- -------------------- ------------------------- ----------
    3148008031 7865 21/02/2024 10:44:45 High Load 1709.85
    3148008031 7870 21/02/2024 11:31:13 High Load 1556.17


    Select a report id from the list. If the report id list is empty,
    please select a different begin time and end time.
    **Enter value for report_id: 7865**
    Report id specified : 7865
    Specify the Report Name
    ~~~~~~~~~~~~~~~~~~~~~~~~
    The default report file name is rtaddmrpt_0221_1424.html. To use this name,
    press to continue, otherwise enter an alternative.
    Enter value for report_name:


    Using the report name rtaddmrpt_0221_1424.html


    ... Removed HTML Output ...


    Report written to rtaddmrpt_0221_1830.html

    欢迎关注我的公众号,一起学习数据库技术👇

    推荐文章👇

    从国内外IT人的差异谈如何破除35岁魔咒

    试看号主的拙作《MySQL 8.0运维与优化》(清华大学出版社)

    托业890分的Oracle ACE为您翻译国际大佬的雄文(合集)

    晒一下号主的19个Oracle认证(OCP+OCM),欢迎PK

    相关文章

    Oracle如何使用授予和撤销权限的语法和示例
    Awesome Project: 探索 MatrixOrigin 云原生分布式数据库
    下载丨66页PDF,云和恩墨技术通讯(2024年7月刊)
    社区版oceanbase安装
    Oracle 导出CSV工具-sqluldr2
    ETL数据集成丨快速将MySQL数据迁移至Doris数据库

    发布评论