Forum Discussion

T_N's avatar
T_N
Level 6
7 years ago

how to exclude sql database is offline state

Hi All; I have sql backup job failed because some sql database are "offline state", this backup policy is using tran script to backup sql database. What option can I exclude these database offline s...
  • puneet102's avatar
    7 years ago

    Try EXCLUDE <Database_Name> in script, For example, name of database is DATABASE1 then use the below script and check if the backup is working fine.

    SQLINSTANCE $ALL
    OPERATION BACKUP
    EXCLUDE DATABASE1 
    DATABASE $ALL 
    NBSERVER "xxxxx02" 
    MAXTRANSFERSIZE 6 
    BLOCKSIZE 7 
    OBJECTTYPE TRXLOG 
    NUMBUFS 2 
    ENDOPER TRUE
  • Michal_Mikulik1's avatar
    Michal_Mikulik1
    7 years ago

    Hello,

    with script-based backups, you cannot simply exclude all offline databases with one phrase/keyword. You must name these databases explicitly. If you are on 7.7 client or above, you can use Intelligent MS SQL policies, which have attribute for this - Skip unavailable databases.

    Rgds

    Michal