OceanBase logo

OceanBase

A unified distributed database ready for your transactional, analytical, and AI workloads.

Product Overview
DEPLOY YOUR WAY

OceanBase Cloud

The best way to deploy and scale OceanBase

OceanBase Enterprise

Run and manage OceanBase on your infra

TRY OPEN SOURCE

OceanBase Community Edition

The free, open-source distributed database

OceanBase seekdb

Open source AI native search database

Customer Stories

Real-world success stories from enterprises across diverse industries.

View All
BY USE CASES

Mission-Critical Transactions

Global & Multicloud Application

Elastic Scaling for Peak Traffic

Real-time Analytics

Active Geo-redundancy

Database Consolidation

Resources

Comprehensive knowledge hub for OceanBase.

Blog

Live Demos

Training & Certification

Documentation

Official technical guides, tutorials, API references, and manuals for all OceanBase products.

View All
PRODUCTS

OceanBase Cloud

OceanBase Database

Tools

Connectors and Middleware

QUICK START

OceanBase Cloud

OceanBase Database

BEST PRACTICES

Practical guides for utilizing OceanBase more effectively and conveniently

Company

Learn more about OceanBase – our company, partnerships, and trust and security initiatives.

About OceanBase

Partner

Trust Center

Contact Us

International - English
中国站 - 简体中文
日本 - 日本語
Sign In
Start on Cloud

OceanBase

A unified distributed database ready for your transactional, analytical, and AI workloads.

Product Overview
DEPLOY YOUR WAY

OceanBase Cloud

The best way to deploy and scale OceanBase

OceanBase Enterprise

Run and manage OceanBase on your infra

TRY OPEN SOURCE

OceanBase Community Edition

The free, open-source distributed database

OceanBase seekdb

Open source AI native search database

Customer Stories

Real-world success stories from enterprises across diverse industries.

View All
BY USE CASES

Mission-Critical Transactions

Global & Multicloud Application

Elastic Scaling for Peak Traffic

Real-time Analytics

Active Geo-redundancy

Database Consolidation

Comprehensive knowledge hub for OceanBase.

Blog

Live Demos

Training & Certification

Documentation

Official technical guides, tutorials, API references, and manuals for all OceanBase products.

View All
PRODUCTS
OceanBase CloudOceanBase Database
ToolsConnectors and Middleware
QUICK START
OceanBase CloudOceanBase Database
BEST PRACTICES

Practical guides for utilizing OceanBase more effectively and conveniently

Learn more about OceanBase – our company, partnerships, and trust and security initiatives.

About OceanBase

Partner

Trust Center

Contact Us

Start on Cloud
编组
All Products
    • Databases
    • iconOceanBase Database
    • iconOceanBase Cloud
    • iconOceanBase Tugraph
    • iconInteractive Tutorials
    • iconOceanBase Best Practices
    • Tools
    • iconOceanBase Cloud Platform
    • iconOceanBase Migration Service
    • iconOceanBase Developer Center
    • iconOceanBase Migration Assessment
    • iconOceanBase Admin Tool
    • iconOceanBase Loader and Dumper
    • iconOceanBase Deployer
    • iconKubernetes operator for OceanBase
    • iconOceanBase Diagnostic Tool
    • iconOceanBase Binlog Service
    • Connectors and Middleware
    • iconOceanBase Database Proxy
    • iconEmbedded SQL in C for OceanBase
    • iconOceanBase Call Interface
    • iconOceanBase Connector/C
    • iconOceanBase Connector/J
    • iconOceanBase Connector/ODBC
    • iconOceanBase Connector/NET
icon

OceanBase Database

SQL - V4.3.5

    Download PDF

    OceanBase logo

    The Unified Distributed Database for the AI Era.

    Follow Us
    Products
    OceanBase CloudOceanBase EnterpriseOceanBase Community EditionOceanBase seekdb
    Resources
    DocsBlogWhite PaperLive DemosTraining & CertificationTicket
    Company
    About OceanBaseTrust CenterLegalPartnerContact Us
    Follow Us

    © OceanBase 2026. All rights reserved

    Cloud Service AgreementPrivacy PolicySecurity
    Contact Us
    Document Feedback
    1. Documentation Center
    2. OceanBase Database
    3. SQL
    4. V4.3.5
    iconOceanBase Database
    SQL - V 4.3.5
    Databases
    • OceanBase Database
    • OceanBase Cloud
    • OceanBase Tugraph
    • Interactive Tutorials
    • OceanBase Best Practices
    Tools
    • OceanBase Cloud Platform
    • OceanBase Migration Service
    • OceanBase Developer Center
    • OceanBase Migration Assessment
    • OceanBase Admin Tool
    • OceanBase Loader and Dumper
    • OceanBase Deployer
    • Kubernetes operator for OceanBase
    • OceanBase Diagnostic Tool
    • OceanBase Binlog Service
    Connectors and Middleware
    • OceanBase Database Proxy
    • Embedded SQL in C for OceanBase
    • OceanBase Call Interface
    • OceanBase Connector/C
    • OceanBase Connector/J
    • OceanBase Connector/ODBC
    • OceanBase Connector/NET
    SQL
    KV
    • V 4.6.0
    • V 4.4.2
    • V 4.3.5
    • V 4.3.3
    • V 4.3.1
    • V 4.3.0
    • V 4.2.5
    • V 4.2.2
    • V 4.2.1
    • V 4.2.0
    • V 4.1.0
    • V 4.0.0
    • V 3.1.4 and earlier

    Overview of DBMS_PROFILER

    Last Updated:2026-04-15 15:09:26  Updated
    Share
    What is on this page
    Privilege requirements
    Subprograms
    Calling process
    Example

    folded

    Share

    The DBMS_PROFILER package is used to record the execution of each line in PL/SQL and summarize the results to provide detailed execution time for each statement during PL/SQL execution.

    Applicability

    This content applies only to OceanBase Database Enterprise Edition. OceanBase Database Community Edition only provides MySQL mode.

    Privilege requirements

    The privilege of this package is AUTHID CURRENT_USER.

    Subprograms

    The following table lists the DBMS_PROFILER subprograms supported in the current version of OceanBase Database and their brief descriptions.

    Subprogram
    Description
    start_profiler Starts the profiler, which records the execution of PL/SQL in the current session.
    stop_profiler Stops the profiler and summarizes the results into the statistics table.
    pause_profiler Pauses the profiler, temporarily stopping the recording of execution.
    resume_profiler Resumes the profiler, restarting the recording of execution.
    flush_data Summarizes the data into the statistics table.
    get_version Returns the current DBMS_PROFILER version.
    internal_version_check Checks whether the database version matches the DBMS_PROFILER version.
    rollup_unit Calculates the execution time of a unit during an execution.
    rollup_run Calculates the execution time of each unit during an execution.
    ob_init_objects Creates the statistics table under the user schema.
    ob_drop_objects Deletes the statistics table under the user schema.

    Calling process

    Call DBMS_PROFILER.start_profiler to start the profiler. After this, the execution count and time of each line in all PL/SQL executions in the session will be recorded. If the system requires a warm-up phase, you can call DBMS_PROFILER.pause_profiler to pause the profiler to prevent the warm-up data from being recorded. After the warm-up is complete, call DBMS_PROFILER.resume_profiler to resume recording. When the PL/SQL execution that needs performance analysis is completed, call DBMS_PROFILER.stop_profiler to stop the profiler. The recorded data will be summarized into the statistics table, which can then be queried for performance analysis.

    Example

    1. Create the PROC1 stored procedure.

      obclient> CREATE OR REPLACE PROCEDURE PROC1 AS
          -> BEGIN
          -> NULL;
          -> END;
          -> /
      Query OK, 0 rows affected (0.057 sec)
      
    2. Create the PROC0 stored procedure:

      obclient> CREATE OR REPLACE PROCEDURE PROC0 AS
          -> BEGIN
          -> PROC1();
          -> END;
          -> /
      Query OK, 0 rows affected (0.103 sec)
      
    3. Start the profiler:

      obclient> CALL dbms_profiler.start_profiler();
      Query OK, 0 rows affected (1.178 sec)
      
    4. Call the PROC0 stored procedure:

      obclient> CALL PROC0();
      Query OK, 0 rows affected (0.470 sec)
      

      Execute the PROC0 stored procedure. Since the profiler is enabled, the data from this call will be collected for subsequent analysis.

    5. Stop the profiler:

      call DBMS_PROFILER.stop_profiler();
      Query OK, 0 rows affected (1.238 sec)
      
    6. View the profiler run information:

      obclient> SELECT * FROM PLSQL_PROFILER_RUNS;
      +-------+-------------+-----------+-----------+-------------+----------------+-----------------+--------------+--------+
      | RUNID | RELATED_RUN | RUN_OWNER | RUN_DATE  | RUN_COMMENT | RUN_TOTAL_TIME | RUN_SYSTEM_INFO | RUN_COMMENT1 | SPARE1 |
      +-------+-------------+-----------+-----------+-------------+----------------+-----------------+--------------+--------+
      |     1 |        NULL | SYS       | 10-JAN-25 | 10-JAN-25   |    34000000000 | NULL            | NULL         | NULL   |
      +-------+-------------+-----------+-----------+-------------+----------------+-----------------+--------------+--------+
      1 row in set (0.002 sec)
      
    7. View the information of the analyzed units:

      obclient> SELECT * FROM PLSQL_PROFILER_UNITS;
      +-------+-------------+-----------+------------+-----------+----------------+------------+--------+--------+
      | RUNID | UNIT_NUMBER | UNIT_TYPE | UNIT_OWNER | UNIT_NAME | UNIT_TIMESTAMP | TOTAL_TIME | SPARE1 | SPARE2 |
      +-------+-------------+-----------+------------+-----------+----------------+------------+--------+--------+
      |     1 |      500025 | PROCEDURE | SYS        | PROCL     | 10-JAN-25      |          0 |   NULL |   NULL |
      |     1 |      500026 | PROCEDURE | SYS        | PROC0     | 10-JAN-25      |          0 |   NULL |   NULL |
      +-------+-------------+-----------+------------+-----------+----------------+------------+--------+--------+
      2 rows in set (0.004 sec)
      

      Query the PLSQL_PROFILER_UNITS table to obtain information about each analyzed PL/SQL unit, including the unit type, name, and total time.

    8. View the performance data at the line level:

      obclient> SELECT * FROM PLSQL_PROFILER_DATA;
      +-------+-------------+-------+-------------+------------+----------+----------+--------+--------+--------+--------+
      | RUNID | UNIT_NUMBER | LINE# | TOTAL_OCCUR | TOTAL_TIME | MIN_TIME | MAX_TIME | SPARE1 | SPARE2 | SPARE3 | SPARE4 |
      +-------+-------------+-------+-------------+------------+----------+----------+--------+--------+--------+--------+
      |     1 |      500025 |     1 |           1 |        537 |      537 |      537 |   NULL |   NULL |   NULL |   NULL |
      |     1 |      500025 |     3 |           1 |       7118 |     7118 |     7118 |   NULL |   NULL |   NULL |   NULL |
      |     1 |      500026 |     1 |           1 |        406 |      406 |      406 |   NULL |   NULL |   NULL |   NULL |
      |     1 |      500026 |     3 |           1 |   16031017 | 16031017 | 16031017 |   NULL |   NULL |   NULL |   NULL |
      +-------+-------------+-------+-------------+------------+----------+----------+--------+--------+--------+--------+
      4 rows in set (0.002 sec)
      

      Query the PLSQL_PROFILER_DATA table to view detailed performance statistics for specific lines within each PL/SQL unit, including the number of times the line was executed, total execution time, and minimum and maximum execution times.

    Previous topic

    CONVERT
    Last

    Next topic

    START_PROFILER
    Next
    What is on this page
    Privilege requirements
    Subprograms
    Calling process
    Example