SearchFAQMemberlist Log in
Reply to topic Page 1 of 1
Backuping MS SQL
Author Message
Post Backuping MS SQL 
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

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

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

iD8DBQFIewHgxqkZ847NX44RAiAmAJ49K6ATuH5+LSnJH5VNQfTA121dDACgja2s
aCI6/mVSypP+UO6gj7BdmR0=
=snFm
-----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.net
https://lists.sourceforge.net/lists/listinfo/bacula-users

Post Backuping MS SQL 
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:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

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

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

iD8DBQFIewHgxqkZ847NX44RAiAmAJ49K6ATuH5+LSnJH5VNQfTA121dDACgja2s
aCI6/mVSypP+UO6gj7BdmR0=
=snFm
-----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.net
https://lists.sourceforge.net/lists/listinfo/bacula-users


-------------------------------------------------------------------------
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.net
https://lists.sourceforge.net/lists/listinfo/bacula-users

Post Backuping MS SQL 
-----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.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.net
https://lists.sourceforge.net/lists/listinfo/bacula-users

Post Backuping MS SQL 
My jobdefs for MS SQL 2005 Express:

ClientRunBeforeJob = "C:\\bacula\\dump.bat"

Content of dump.bat:
osql -S MY_HOST -U MY_USERNAME -P MY_PASSWORD -i c:\bacula\dump.sql

Content of dump.sql:
(many rows like that)

BACKUP DATABASE [DATABASE_NAME] TO DISK = N'C:\SOMETHING
\DATABASE_NAME.BAK' WITH NOFORMAT, INIT, NAME = N'DATABASE_NAME-Full
Dump', SKIP, NOREWIND, NOUNLOAD, STATS = 10
GO

Andrea


-------------------------------------------------------------------------
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.net
https://lists.sourceforge.net/lists/listinfo/bacula-users

Post Backuping MS SQL 

My jobdefs for MS SQL 2005 Express:

ClientRunBeforeJob = "C:\\bacula\\dump.bat"

Content of dump.bat:
osql -S MY_HOST -U MY_USERNAME -P MY_PASSWORD -i c:\bacula\dump.sql


It's possible that when running from in bacula, the system doesn't have
the right path set up and so can't find osql. Maybe set the path first,
eg:
PATH="C:\Program Files\Microsoft SQL Server\MSSQL\binn"
(that's just from my memory, you'll have to get the correct path from
your system)

hth

James

-------------------------------------------------------------------------
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.net
https://lists.sourceforge.net/lists/listinfo/bacula-users

Post Backuping MS SQL 
Maybe set the path first,
eg:
PATH="C:\Program Files\Microsoft SQL Server\MSSQL\binn"

Sorry, that probably wasn't very clear. Put the PATH= statement at the
top of your .bat file before the call to osql.

James

-------------------------------------------------------------------------
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.net
https://lists.sourceforge.net/lists/listinfo/bacula-users

Post Backuping MS SQL 
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

osql works, but osql is deprecated, sqlcmd should be used for MSSQL
2005. But I think it is enough for me for now.
Marek


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

iD8DBQFIe1R5xqkZ847NX44RAqtrAJ9vSwI681u2X6vfyOPuBxbr7w88iwCeMMTa
+kBdx1h6zMqH/OaxiaoQ3Ts=
=87b9
-----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.net
https://lists.sourceforge.net/lists/listinfo/bacula-users

Post Backuping MS SQL 
Previously, Marek Simon said..

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

Marek,

In my environment here's what I do for my SQL 2005 databases...
1) Be sure you have lots of extra space somewhere
2) Use maintenance plans which are two steps...
a) delete backups > some number of days... basing that number of
days on how much space you have
b) backup each db to a separate file in a separate dir with the file
name having the timestamp on it.
3) So I never miss any newer DB's I have 3 maintenance plans defined,
one for all system DB's with a short retention period like 1 week, one
for all user DB full backups, and one for all user DB log backups.
4) I then back up the backup files using bacula.

If I need to do a restore I use the point in time restore functionality
of SQL Server 2005 using the GUI. It is of course much quicker if you
don't need to restore from tape... if you do, that gui tells you which
files it can't find.

If you can... have it put the database backups to a different drive than
where you put the DB files, so that they never fill up the drive. You
also wouldn't want them filling up the boot volume either of course.
You may find that you have to reduce the number you specified above as
more databases get added and more data gets stored in them.


-------------------------------------------------------------------------
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.net
https://lists.sourceforge.net/lists/listinfo/bacula-users

Post Backuping MS SQL 
Client Run Before Job =
"\"c:/BackupDB/scripts/sqlbackup.bat\""

Why the pair of \" in the string?

Just try

Client Run Before Job = "c:/BackupDB/scripts/sqlbackup.bat"


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Bacula-users mailing list
Bacula-users < at > lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bacula-users

Post Backuping MS SQL 
Jari Fredriksson napsal(a):
Client Run Before Job =
"\"c:/BackupDB/scripts/sqlbackup.bat\""

Why the pair of \" in the string?

Just try

Client Run Before Job = "c:/BackupDB/scripts/sqlbackup.bat"


it is not needed actualy. It was there, because there was some other
path before, and I was trying evverything that could help.
Marek


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Bacula-users mailing list
Bacula-users < at > lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bacula-users

Post Backuping MS SQL 
Jari Fredriksson napsal(a):
Client Run Before Job =
"\"c:/BackupDB/scripts/sqlbackup.bat\""

Why the pair of \" in the string?

Just try

Client Run Before Job = "c:/BackupDB/scripts/sqlbackup.bat"


it is not needed actualy. It was there, because there was some other
path before, and I was trying evverything that could help.
Marek


It would be needed if the path had spaces in it I think.

Do you know if you should be using the unix path separator '/' under
Windows? Maybe you should try:

Client Run Before Job = "c:\\BackupDB\\scripts\\sqlbackup.bat"

This should be documented in the docs though so maybe look it up there.

james

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Bacula-users mailing list
Bacula-users < at > lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bacula-users

Post Backuping MS SQL 
On Mon, 2008-07-14 at 09:36 +0200, Marek Simon wrote:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

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?

Hi,

I use a stored procedure for my backup job, the stored procedure is
installed and launched via a "Client Run Before" script
(pre-backup.bat).

You can get the stored procedure and .bat script:
http://www.bertera.it/software/mssql-backup/

Regards

Bertera Pietro


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Bacula-users mailing list
Bacula-users < at > lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bacula-users

Post Backuping MS SQL 
Jari Fredriksson napsal(a):
Client Run Before Job =
"\"c:/BackupDB/scripts/sqlbackup.bat\""

Why the pair of \" in the string?

Just try

Client Run Before Job =
"c:/BackupDB/scripts/sqlbackup.bat"


it is not needed actualy. It was there, because there
was some other path before, and I was trying evverything
that could help.
Marek


It would be needed if the path had spaces in it I think.


Not sure about this. Certaintly needed when naming a file via a comman prosessor/shell. But I don't think " is needed (or even allowed) when using API calls.

But then, I don't know how Bacula implements the Client Run Before Job... May well be a cmd.exe invocation with that string as a parameter. In that case the " is ok.



-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Bacula-users mailing list
Bacula-users < at > lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bacula-users

Display posts from previous:
Reply to topic Page 1 of 1
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
  


Magic SEO URL for phpBB