Bacula-users

Re: [Bacula-users] Backuping MS SQL

2008-07-14 06:52:01
Subject: Re: [Bacula-users] Backuping MS SQL
From: Marek Simon <marek.simon AT trustica DOT cz>
To: bacula-users AT lists.sourceforge DOT net
Date: Mon, 14 Jul 2008 12:51:39 +0200
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

This is the JobDefs used for that:

JobDefs {
  Name = "WindowsDB"
  Type = Backup
  Level = Full
  Storage = File1
  Messages = Standard
  Client Run Before Job = "\"c:/BackupDB/scripts/sqlbackup.bat\""
  Write Bootstrap = "/var/lib/bacula/bootstraps/${Job:s/ - /_/g:s/
/_/g}.bsr"
  Priority = 10
  FileSet = c-backupdb
}

the sqlbackup.bat calls some cygwin script, where the name for file is
generated.

Cygwin script calls some .cmd script with paramters: server, DB and
today's date.

.cmd script is like this:
sqlcmd -i C:\BackupDB\scripts\backup.sql -v DB=%2 -v BackupServer=%1 -v
DATE=%3

and backup.sql script is like this:

:ON ERROR EXIT
GO
:CONNECT $(BackupServer)
BACKUP DATABASE $(DB) TO DISK = 'C:\BackupDB\DB-$(DB)-$(DATE).BAK' WITH INIT

It is complicated, because I tried many many ways, how to implement it,
but the result was the same: When I run it manualy or through windows
scheduler, everything is good. When I run it through bacula-fd, sqlcmd
exits with error. I think, sqlcmd sends some "terminal" command for
windows terminal and bacula-fd cant handle it, sqlcmd then quits, with
no message.






Peter Buschman napsal(a):
> 
> Hello Marek:
> 
> Which SQL command are you trying to use?  There are several ways to
> backup SQL Server databases with Bacula.
> 
> If you post your bacula-dir.conf or the complete Job resource, perhaps
> we can help.
> 
> 1.) Shutdown the database server prior to the backup and restart it
> after the backup RunScript directives.
> 
> ( These commands can be run from the Windows command shell or a batch
> file )
> 
> NET STOP MSSQLSERVER
> NET START MSSQL SERVER
> 
> 2.) Take a dump of the running database to a separate directory and
> back-up that directory.
> 
> ( This SQL command can be scheduled from a SQL Agent job or run from the
> command-line or a batch file using the osql command )
> 
> BACKUP DATABASE MyDatabase TO DISK='C:\Backups\MyDatabase.bak'
> 
> Kindest regards,
> 
> Peter Buschman
> 
> At 09:36 14.7.2008, Marek Simon wrote:
> Hi,
> I need to backup some MSSQL server 2005 Database. I found, that there is
> some sqlcmd tool for it. When I run it on command line or through
> windows scheduler, it works. When I run it from bacula, sqlcmd do not
> work. I looked up the system log and I found nothing about the problem.
> Now I have set the MS SQL server run before the bacula backup, it works,
> but I would like to have it in bacula way. Does anybody meet this
> problem?
> 
> Marek
> 
>>
- -------------------------------------------------------------------------
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at http://www.sourceforge.net/community/cca08
_______________________________________________
Bacula-users mailing list
Bacula-users AT lists.sourceforge DOT net
https://lists.sourceforge.net/lists/listinfo/bacula-users

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFIey+6xqkZ847NX44RAo0sAKCSQDAyOS+cA8XxAzBSzyTqjwgEsgCfRVZy
OVLhwr2vmapO82T6VjhaIvQ=
=uO0W
-----END PGP SIGNATURE-----

-------------------------------------------------------------------------
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at http://www.sourceforge.net/community/cca08
_______________________________________________
Bacula-users mailing list
Bacula-users AT lists.sourceforge DOT net
https://lists.sourceforge.net/lists/listinfo/bacula-users