June 9, 2011 at 8:33 am
On some servers, we are using Veritas netbackup to backup our databases directly to tape. We specify a $ALL value for the "database" so that any dbs added to the system are automatically added to the backup job. Unfortunately, this also means that database snapshots are added, and fail(of course), giving annoying error messages in the logs.
does anyone know a way to specify "all databases except snapshots" or to periodically generate a .bch file which specifies each database explicitly?
June 9, 2011 at 11:49 am
in case anyone cares, this is how I did it. Save the following script and call it from sqlcmd with output to a file. this script genereates the netbackup script daily:
set NOCOUNT ON
DECLARE @DBName nvarchar(50)
DECLARE @groupsize varchar (3)
select @groupsize= count(name) from sys.databases where source_database_id is null
select 'GROUPSIZE '+@groupsize
DECLARE dbname_cursor CURSOR FOR
select name from sys.databases where source_database_id is null
OPEN dbname_cursor
FETCH NEXT FROM dbname_cursor
INTO @DBName
WHILE @@FETCH_STATUS = 0
begin
select '
OPERATION BACKUP
DATABASE '+@dbname+ '
SQLHOST '+'"'+@@servername+'"'+'
NBSERVER "NETBACKUPSERVERNAME"''
MAXTRANSFERSIZE 6'+'
BLOCKSIZE 7'+'
NUMBUFS 2'+'
ENDOPER TRUE'
FETCH NEXT FROM dbname_cursor
INTO @DBName
END
CLOSE dbname_cursor
DEALLOCATE dbname_cursor
/** command to execute on local server is:
sqlcmd -h-1 -i "D:\Program Files\NBU\NetBackup\DbExt\MsSql\create_bch.sql" -o "D:\Program Files\NBU\NetBackup\DbExt\MsSql\all_databases.bch" -W
**/
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply