Highlighted

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 state to script ?

sql backup script :

SQLINSTANCE $ALL
OPERATION BACKUP 
DATABASE $ALL 
NBSERVER "xxxxx02" 
MAXTRANSFERSIZE 6 
BLOCKSIZE 7 
OBJECTTYPE TRXLOG 
NUMBUFS 2 
ENDOPER TRUE

 

Thank you

Tom

 

Tags (2)
2 Solutions

Accepted Solutions
Accepted Solution!

Re: how to exclude sql database is offline state

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

Thanks
Puneet Dixit

View solution in original post

Accepted Solution!

Re: how to exclude sql database is offline state

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

View solution in original post

3 Replies
Accepted Solution!

Re: how to exclude sql database is offline state

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

Thanks
Puneet Dixit

View solution in original post

Accepted Solution!

Re: how to exclude sql database is offline state

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

View solution in original post

Re: how to exclude sql database is offline state

I think I will moveto  SQL intelligent policy, that allows me to exclude state "offline", thank you everyone.