Saturday, September 26, 2026
  • About Us
  • Contact
DBAInsight
  • Guides
    • 23ai
    • RMAN
    • 26ai
    • Patch Update
    • RMAN
    • MySQL
    • Oracle GoldenGate
  • Cloud Technology
  • Case Studies
  • Troubleshooting
  • Training & Certification
NEWSLETTER
No Result
View All Result
DBAInsight
Home Troubleshooting

Oracle RMAN Session Monitoring and Safely Identifying Long-Running RMAN Operations

September 11, 2026
in Troubleshooting
0
Oracle RMAN Session Monitoring and Safely Identifying Long-Running RMAN Operations
0
SHARES
102
VIEWS

Oracle Recovery Manager (RMAN) is one of the most important tools for protecting Oracle databases through backup and recovery. However, during backup, restore, recovery, or maintenance operations, RMAN sessions can sometimes remain active for a long time.

When investigating database activity, Oracle Performance Hub can be useful for identifying periods of increased database activity. The example below shows Performance Hub activity over approximately one hour, where background activity and CPU utilization can be observed alongside other database activity.

Table of Contents

Toggle
      • Related posts
      • When datapatch Won’t Finish: An ORA-04021 Lock on DBMS_AQADM_SYS During a 19c RU Apply
      • When “Invalid Objects” Isn’t What It Looks Like: A GSMADMIN_INTERNAL Detective Story
    • 1. Monitoring Database Activity with Performance Hub
  • 2. Identifying RMAN Long-Running Operations
      • Query explanation
  • 3. Understanding the Percentage Completed
  • 4. Generate the RMAN Session Kill Command
  • 5. Verify the RMAN Session Before Killing It
  • 6. Automatically Kill Incomplete RMAN Sessions
  • 7. Important Production Consideration
  • 8. Check Whether the RMAN Operation Is Progressing
  • 9. Combine Performance Hub and RMAN Monitoring
      • Step 1 — Review Performance Hub
      • Step 2 — Identify RMAN operations
      • Step 3 — Check session details
      • Step 4 — Monitor progress
      • Step 5 — Determine whether intervention is required
  • 10. Recommended RMAN Troubleshooting Flow
  • 11. Final SQL Toolkit
      • Identify incomplete RMAN operations
      • Generate kill commands
      • Kill confirmed sessions automatically
    • Conclusion

Related posts

ORA-04021

When datapatch Won’t Finish: An ORA-04021 Lock on DBMS_AQADM_SYS During a 19c RU Apply

September 25, 2026
GSMADMIN_INTERNAL

When “Invalid Objects” Isn’t What It Looks Like: A GSMADMIN_INTERNAL Detective Story

September 24, 2026

This article explains how to identify incomplete RMAN operations using V$SESSION_LONGOPS, generate the corresponding session-kill commands, and optionally terminate those sessions using PL/SQL.

Oracle RMAN Session Monitoring and Safely Identifying Long-Running RMAN Operations

1. Monitoring Database Activity with Performance Hub

Oracle Performance Hub provides a graphical view of database activity over a selected time period.

In the example above, the activity graph shows database workload between approximately 09:25 AM and 10:25 AM, with background activity and CPU activity visible during the period.

Performance Hub can help identify:

  • CPU utilization
  • Background activity
  • User I/O
  • Wait activity
  • Periods of increased database activity
  • Potentially long-running operations

However, Performance Hub alone does not tell us exactly which RMAN sessions are responsible for a long-running operation.

For that, we can use Oracle’s V$SESSION_LONGOPS view.


2. Identifying RMAN Long-Running Operations

V$SESSION_LONGOPS provides information about operations that take a significant amount of time to complete.

The following query filters the output specifically for RMAN operations:

SELECT SID,
       SERIAL#,
       CONTEXT,
       SOFAR,
       TOTALWORK,
       ROUND(SOFAR/TOTALWORK*100,2) "%_COMPLETE"
FROM V$SESSION_LONGOPS
WHERE OPNAME LIKE 'RMAN%'
  AND OPNAME NOT LIKE '%aggregate%'
  AND TOTALWORK != 0
  AND SOFAR <> TOTALWORK;

Query explanation

ColumnDescription
SIDOracle session identifier
SERIAL#Session serial number
CONTEXTContext associated with the long-running operation
SOFARAmount of work completed
TOTALWORKTotal estimated amount of work
%_COMPLETEEstimated percentage completed

The following conditions are particularly important:

OPNAME LIKE 'RMAN%'

This limits the results to RMAN operations.

OPNAME NOT LIKE '%aggregate%'

This excludes aggregate RMAN operations.

TOTALWORK != 0

This prevents division by zero when calculating the completion percentage.

SOFAR <> TOTALWORK

This returns operations that have not yet completed.


3. Understanding the Percentage Completed

The percentage is calculated using:

ROUND(SOFAR/TOTALWORK*100,2)

For example:

SOFAR     = 650000
TOTALWORK = 1000000

The calculation is:

650000 / 1000000 × 100
= 65%

Therefore, the RMAN operation is approximately 65% complete.

This is useful when determining whether an RMAN operation is genuinely progressing or appears to be stalled.


4. Generate the RMAN Session Kill Command

Once the RMAN sessions have been identified, the SID and SERIAL# can be used to generate an Oracle session termination command.

Instead of manually constructing the command, use:

SELECT 'ALTER SYSTEM KILL SESSION ''' ||
       SID || ',' || SERIAL# || ''' IMMEDIATE;'
FROM V$SESSION_LONGOPS
WHERE OPNAME LIKE 'RMAN%'
  AND OPNAME NOT LIKE '%aggregate%'
  AND TOTALWORK != 0
  AND SOFAR <> TOTALWORK;

The query may return output similar to:

ALTER SYSTEM KILL SESSION '123,4567' IMMEDIATE;
ALTER SYSTEM KILL SESSION '125,8910' IMMEDIATE;

These commands can then be reviewed before execution.


5. Verify the RMAN Session Before Killing It

Before terminating an RMAN session, it is recommended to obtain additional information from V$SESSION.

For example:

SELECT SID,
       SERIAL#,
       USERNAME,
       STATUS,
       PROGRAM,
       MACHINE,
       SQL_ID,
       EVENT,
       STATE,
       LOGON_TIME
FROM V$SESSION
WHERE SID IN (
    SELECT SID
    FROM V$SESSION_LONGOPS
    WHERE OPNAME LIKE 'RMAN%'
      AND OPNAME NOT LIKE '%aggregate%'
      AND TOTALWORK != 0
      AND SOFAR <> TOTALWORK
);

This allows the DBA to confirm:

  • Which user owns the session
  • Whether the session is active
  • Which client/program created it
  • Which machine initiated the connection
  • The current SQL ID
  • The wait event
  • When the session was established

This verification step is especially important in a production environment.


6. Automatically Kill Incomplete RMAN Sessions

If the DBA has confirmed that all matching RMAN sessions should be terminated, the process can be automated using PL/SQL.

BEGIN
    FOR r IN (
        SELECT SID, SERIAL#
        FROM V$SESSION_LONGOPS
        WHERE OPNAME LIKE 'RMAN%'
          AND OPNAME NOT LIKE '%aggregate%'
          AND TOTALWORK != 0
          AND SOFAR <> TOTALWORK
    )
    LOOP
        EXECUTE IMMEDIATE
            'ALTER SYSTEM KILL SESSION ''' ||
            r.SID || ',' || r.SERIAL# || ''' IMMEDIATE';
    END LOOP;
END;
/

The block loops through all matching RMAN sessions and executes:

ALTER SYSTEM KILL SESSION 'SID,SERIAL#' IMMEDIATE;

for each session.


7. Important Production Consideration

Do not automatically kill every RMAN session simply because it appears in V$SESSION_LONGOPS.

An RMAN operation appearing in V$SESSION_LONGOPS does not necessarily mean that it is stuck.

A backup may legitimately take a long time because of:

  • Large database size
  • High archive log generation
  • Slow storage
  • NFS performance
  • Backup destination throughput
  • Network bandwidth
  • RMAN channel configuration
  • Compression
  • Encryption
  • Concurrent database workload
  • I/O contention

For example, an RMAN backup may remain in the view for several hours while continuing to make progress.

Therefore, the %_COMPLETE value should be monitored over time.


8. Check Whether the RMAN Operation Is Progressing

Run the monitoring query periodically:

SELECT SID,
       SERIAL#,
       CONTEXT,
       SOFAR,
       TOTALWORK,
       ROUND(SOFAR/TOTALWORK*100,2) "%_COMPLETE"
FROM V$SESSION_LONGOPS
WHERE OPNAME LIKE 'RMAN%'
  AND OPNAME NOT LIKE '%aggregate%'
  AND TOTALWORK != 0
  AND SOFAR <> TOTALWORK;

For example, if the output changes from:

SOFAR       TOTALWORK       % COMPLETE
500000      1000000         50

to:

SOFAR       TOTALWORK       % COMPLETE
650000      1000000         65

the RMAN operation is clearly progressing.

In this situation, killing the session would normally be unnecessary.

However, if the values remain unchanged for an extended period and the operation is confirmed to be stalled, further investigation may be appropriate.


9. Combine Performance Hub and RMAN Monitoring

A useful troubleshooting approach is to combine Performance Hub with database-level RMAN monitoring.

Step 1 — Review Performance Hub

Check the period where the database showed increased activity.

Step 2 — Identify RMAN operations

Run:

SELECT SID,
       SERIAL#,
       CONTEXT,
       SOFAR,
       TOTALWORK,
       ROUND(SOFAR/TOTALWORK*100,2) "%_COMPLETE"
FROM V$SESSION_LONGOPS
WHERE OPNAME LIKE 'RMAN%'
  AND OPNAME NOT LIKE '%aggregate%'
  AND TOTALWORK != 0
  AND SOFAR <> TOTALWORK;

Step 3 — Check session details

SELECT SID,
       SERIAL#,
       USERNAME,
       STATUS,
       PROGRAM,
       MACHINE,
       SQL_ID,
       EVENT,
       STATE
FROM V$SESSION
WHERE SID = <SID>;

Step 4 — Monitor progress

Run the V$SESSION_LONGOPS query again after a suitable interval.

Step 5 — Determine whether intervention is required

If the operation is progressing, allow RMAN to continue.

If the operation is confirmed to be stuck and there is an operational reason to terminate it, generate and review the kill command.


10. Recommended RMAN Troubleshooting Flow

A practical DBA workflow is:


11. Final SQL Toolkit

Identify incomplete RMAN operations

SELECT SID,
       SERIAL#,
       CONTEXT,
       SOFAR,
       TOTALWORK,
       ROUND(SOFAR/TOTALWORK*100,2) "%_COMPLETE"
FROM V$SESSION_LONGOPS
WHERE OPNAME LIKE 'RMAN%'
  AND OPNAME NOT LIKE '%aggregate%'
  AND TOTALWORK != 0
  AND SOFAR <> TOTALWORK;

Generate kill commands

SELECT 'ALTER SYSTEM KILL SESSION ''' ||
       SID || ',' || SERIAL# || ''' IMMEDIATE;'
FROM V$SESSION_LONGOPS
WHERE OPNAME LIKE 'RMAN%'
  AND OPNAME NOT LIKE '%aggregate%'
  AND TOTALWORK != 0
  AND SOFAR <> TOTALWORK;

Kill confirmed sessions automatically

BEGIN
    FOR r IN (
        SELECT SID, SERIAL#
        FROM V$SESSION_LONGOPS
        WHERE OPNAME LIKE 'RMAN%'
          AND OPNAME NOT LIKE '%aggregate%'
          AND TOTALWORK != 0
          AND SOFAR <> TOTALWORK
    )
    LOOP
        EXECUTE IMMEDIATE
            'ALTER SYSTEM KILL SESSION ''' ||
            r.SID || ',' || r.SERIAL# || ''' IMMEDIATE';
    END LOOP;
END;
/

Conclusion

Oracle Performance Hub is useful for understanding overall database activity, while V$SESSION_LONGOPS provides more detailed visibility into long-running RMAN operations.

The safest approach is not to kill an RMAN session solely because it has been running for a long time. First verify the session, monitor SOFAR and TOTALWORK, check the associated wait events and system activity, and confirm that the operation is genuinely stuck or should be stopped.

Once the session has been validated, the SID and SERIAL# values can be used to generate an ALTER SYSTEM KILL SESSION command or, when appropriate, terminate multiple confirmed RMAN sessions through PL/SQL.

Oracle RMAN Fast Incremental Backups: Speed Up Your Backup Strategy

Tags: Oracle DatabaseOracle Performance HubOracle RMANRMAN TroubleshootingV$SESSION_LONGOPS
Previous Post

ORA-28001: The Password Has Expired – WebLogic Server Startup Failure

Next Post

Download and Install Oracle Database 19c Preinstallation RPM on Oracle Linux 9

Next Post
Download and Install Oracle Database 19c Preinstallation RPM on Oracle Linux 9

Download and Install Oracle Database 19c Preinstallation RPM on Oracle Linux 9

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

POPULAR NEWS

  • Oracle Patch 38632161: Step-by-Step Guide to Upgrade Oracle 19c to Release Update 19.30

    Oracle Patch 38632161: Step-by-Step Guide to Upgrade Oracle 19c to Release Update 19.30

    0 shares
    Share 0 Tweet 0
  • How To Download And Install The Latest OPatch

    0 shares
    Share 0 Tweet 0
  • How to Install Oracle 19c Database on Red Hat Enterprise Linux 9

    0 shares
    Share 0 Tweet 0
  • Oracle Database 19.32 Release Update (RU) Patching Guide – Patch 39472050

    0 shares
    Share 0 Tweet 0
  • Installing Oracle Database 26AI on Red Hat Enterprise Linux 9

    0 shares
    Share 0 Tweet 0
  • About Us
  • Contact

© 2026 DBAInsight - Smarter Databases. Sharper Insights. DBAInsight.

No Result
View All Result
  • Home
  • Cloud & Modern DBs
  • Guides
  • Cloud Technology
  • Case Studies
  • Troubleshooting
  • Training & Certification

© 2026 DBAInsight - Smarter Databases. Sharper Insights. DBAInsight.

Add as a preferred source on Google
Add as preferred source on Google