cancel
Showing results for 
Search instead for 
Did you mean: 

Exclude Database backup when SQLINSTANCE "$ALL" is used

lisamccann
Level 2

Can anyone shed some light on this, I am looking to exclude some single database from the database backup when I have more than one instance on the machine and the SQLINSTANCE "$ALL" option is used.

 

Thanks

 

8 REPLIES 8

AAlmroth
Level 6
Partner Accredited

When using the DATABASE $ALL option, you can add lines in the batch script with the EXCLUDE keyword followed by the database name. You can use multiple EXCLUDE lines within the OPERATION block.

You would have the SQLINSTANCE $ALL in the first operation block, and if using EXCLUDE, it would exclude in every instance found, is my understanding.

I do however prefer to use one batch script for each instance...

/A

lisamccann
Level 2

I have two instances on the machine and want to have one policy and one set of server side scripts,  as a result we us both:

SQLINSTANCE "$ALL"
DATABASE "$ALL"

But there are single databases that we may wish to exclude and the EXCLUDE "????" option does not work with  SQLINSTANCE "$ALL"  or I just don’t have the syntax correct.

If I split the instances out, it seem to back up the first instance and exclude correctly and then ignore the second instance altogether.

 

 

pri3006
Level 4
Certified

Does this help?

 

http://www.symantec.com/docs/HOWTO69783

 

 

lisamccann
Level 2

Thanks for the link, but I have already looked at this and it doesnt address the issue of multiple instances on one box.

 

Will_Restore
Level 6

Sure it does ...

 

You can also exclude individual databases from backup by creating a Windows environmental variable NB_SQL_DATABASE_EXCLUDE. For the value of the variable, specify a list of database names.

For example, consider the following batch file:

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

You can exclude the databases "master," "accounting," and "pubs" with the NB_SQL_DATABASE_EXCLUDE environmental variable. For the value of the variable, indicate the databases you want to exclude. Separate the database names with semi-colons.

MASTER;ACCOUNTING;PUBS

igel2805
Level 2
Partner

Hi Will!

Can you give me a hint for this constellation:

1 Host: SERVER1

2 Instanzes: Productive, Development

1 Batchfile:

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

In both instances a Database called "MyDatabase" exists. I want to exclude MyDatabase just in Instance "Development"! Did you have a solution for that case?

Thx

BR Martin

Mark_Solutions
Level 6
Partner Accredited Certified

NB_SQL_DATABASE_EXCLUDE:

#Develpoment#;MyDatabase;

See if that does it for you

maurijo
Level 6
Partner Accredited

Use a batch file per instance and use Will's method to exclude "MyDatabase" from "Development" instance.

EDIT: Responded same time with Mark, see his answer, its better then mine.