What Backup Jobs Are Currently Running

What Backup Jobs Are Currently Running

July 24, 2019 0 By dianarobete

You’ve planned to do some maintenance for the RMAN catalog, which would result in an outage to the RMAN catalog. The only challenge is, you do not want currently running backup jobs to fail.
One of the first steps in your deployment plan (and if you are one of my readers, you know that you do not do any work without a plan), is to disable RMAN backup jobs. However, you do want to make sure, that a job that has already started, will finish, before you start the maintenance.

So the question is, what databases are currently being backed up, in other words what backup jobs are currently running that are using the catalog?

There are multiple ways to answer these questions, and some answers might prove to be incomplete.

If you only have one database server, then you could go on the server and check for any RMAN OS processes. Assuming you are on a Unix server, you’d run a “ps -ef | grep rman” command.

If no processes are returned, then you could say that no rman backup is currently running. But this answer could be inaccurate. What if the rman backup is kicked off from a different server? What if you have multiple databases servers, and by the time you check all, nothing guarantees that a new process hasn’t started on a different server.

If you run your backups as a scheduler job inside your database, you could check if a scheduler job is running. You would need to connect to all the databases to check. This could also be inaccurate, since new backup jobs could start during the checking process. What if someone manually starts a backup, not through a scheduler job?

If you run your backups as crontab jobs, you could manually check each crontab to see if anything is scheduled. This again could be prone to errors and omissions, since it is a manual step, and it could take a long time to go connect lots of servers.

The method that works (for me), and would capture all the jobs that are currently running, and using the RMAN catalog, would be to query the catalog itself. This method would capture any running jobs NOW, not second ago, but now, for all the databases that are registered with the catalog.

Please find below the query that answers your question, what databases are currently being backed up?

select DB_NAME,status,OPERATION,
       to_char(START_TIME,'DD-MON-YYYY HH24:MI:SS') as START_TIME
from rman.RC_RMAN_STATUS
where start_time < sysdate-1 and status like 'RUNNING%';

DB_NAME  STATUS        OPERATION    START_TIME
-------- ------------- ------------ --------------------
TESTDB   RUNNING       RMAN         24-JUL-2019 18:00:55
TESTDB   RUNNING       BACKUP       24-JUL-2019 18:04:33
HRTST    RUNNING       RMAN         24-JUL-2019 21:00:45
HRTST    RUNNING       BACKUP       24-JUL-2019 21:21:24

If you enjoyed this article, and would like to learn more about databases, please sign up to my weekly email, and you will receive

The Ultimate 3 Step Guide To Find The Root Cause Of The Slow Running SQL!