cancel
Showing results for 
Search instead for 
Did you mean: 

Using excludes in SQL script with SQLINSTANCE $ALL

Vincent_Brengma
Level 2

I want to use SQLINSTANCE $ALL in my SQL backup scripts to simplify the backups for SQL servers with multiple instances.

The complication I am encountering is with the log backups. I want to exclude databases using simple recovery model so I don't get status 1 backups for the logs. According to this article, I can use the NB_SQL_DATABASE_EXCLUDE environmental variable:

https://www.veritas.com/support/en_US/article.HOWTO85376

However, I don't want to exclude databases from backup, just log backup.

 

So just to see what would happen, I set up a log script with SQLINSTANCE $ALL, added the exclude database statements (from multiple instances), and ran it. Reviewing the log, I see every database using simple recovery model was excluded, everything else got a backup, and I got a beautiful status 0 on the job.

I am not comfortable making this change in my environment when it isn't documented, but it looks fine. Am I missing something here?

4 REPLIES 4

Vincent_Brengma
Level 2

Yes, the excluded databases are in my full backup. I just don't want them in my log backup because I get a status 1 result, which I do not enjoy.

Thanks for responding.

Will_Restore
Level 6

Sounds OK to me, if you back up those databases elsewhere.

Marianne
Moderator
Moderator
Partner    VIP    Accredited Certified

Please do not remove the solution again - you were looking for confirmation which was provided.

Vincent_Brengma
Level 2

I disagree. I'm not looking for confirmation. If this is an acceptable practice, why isn't it documented? Why is the documented process so much more complicated and limiting?