Script:检查数据库当前是否有备份操作在执行中

以下脚本可以用于检测数据库当前是否有备份操作在执行中:

SELECT DECODE(os_backup.backup + rman_backup.backup, 0, 'FALSE', 'TRUE') backup
  FROM (SELECT COUNT(*) backup FROM gv$backup WHERE status = 'ACTIVE') os_backup,
       (SELECT COUNT(*) backup
          FROM gv$session
         WHERE status = 'ACTIVE'
           AND client_info like '%rman%') rman_backup
/

Posted

in

by

Tags:

Comments

5 responses to “Script:检查数据库当前是否有备份操作在执行中”

  1. 北在南方 Avatar

    我测试了一下:一个窗口执行rman 备份,另一个窗口查看
    sys@RAC> SELECT DECODE(os_backup.backup + rman_backup.backup, 0, ‘FALSE’, ‘TRUE’) backup
    2 FROM (SELECT COUNT(*) backup FROM v$backup WHERE status = ‘ACTIVE’) os_backup,
    3 (SELECT COUNT(*) backup
    4 FROM v$session
    5 WHERE status = ‘ACTIVE’
    6 AND client_info like ‘%id=rman%’) rman_backup
    7 /

    BACKU
    —–
    FALSE

    1. admin Avatar
      admin

      你好 脚本已经修改过了.

  2. 北在南方 Avatar

    看来是要分单实例还是rac 数据库这两种情况
    sys@RAC> SELECT DECODE(os_backup.backup + rman_backup.backup, 0, ‘FALSE’, ‘TRUE’) backup
    2 FROM (SELECT COUNT(*) backup FROM gv$backup WHERE status = ‘ACTIVE’) os_backup,
    3 (SELECT COUNT(*) backup
    4 FROM gv$session
    5 WHERE status = ‘ACTIVE’
    6 AND client_info like ‘%rman%’) rman_backup
    7 /

    BACKU
    —–
    TRUE

  3. […] Script:データベースにバックアップしているかを確認してください […]

Leave a Reply

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