Script to perform a scheduled BESMgmt DB Backup & FTP to remote server
Code:
@for /f "Tokens=1-4 Delims=/ " %%i in ('date /t') do @set dt=%%l-%%j-%%k-%%i I needed something quick for customers that used MSDE, and I wanted the filename to be as descriptive as possible. You can schedule this, and then use a regular flat-file backup agent to pick up the database backup, and no need for a SQL Agent on the server. |
Thank You!!!! Much better than the .bat I was using. Now all i need to do is ftp the file to a server that is backed up on TSM. I'm having problem with the command line doing it unattended.
|
Quote:
Username: bob Password: monkey Hostname: server.local Directory to upload file on ftp server: my/stuff/here Local directory to fetch from: C:\BlackBerryDBBackup files to send: BESMgmt*.bak create a file called script.ftp with the following contents: Code:
bob Code:
ftp -s:script.ftp server.local |
You could even redirect all output to a text file and use blat.exe to email you a report nightly; all sorts of options.
|
You guys are studs!!!! Thank you for helping my lazy butt out.
|
Thanks all for the tips. Much appreciated.
Che |
Dug this up from the dead...
I REALLY need to get my server backed up. Its been in production for almost 3 years with no backup.. 912 users. Yikes. Anyways, just want to know if this script will take the DB offline or anything while its running? If someone that uses this, or OSQL in general, could let me know, I would appreciate it... Thanks much, Greg |
Nevermind, gents. I just tried it myself on a lab machine and it works without taking anything offline.
This is a god send. Thanks to the OP! Greg |
(y) glad to hear it works for you.
|
Wow. Three years with no backup. And I thought 8 months was long.... I just implemented this on 3 of my servers.
The Monkey rulz! |
Quote:
Jeff |
Sorry to drag this up from the dead, but the other thread this morning made me double check my backups and I just realized that when I switched to a new box and SQL 2005 from MSDE that this script quit working.
Any suggestions on how to get this to work? I just manually backed up my DB, but would like to get it automated again. |
I would venture to guess that if you simply copied the task, you need to supply the credentials again in the task scheduler - the passwords don't carry over. I've even had to recreate the task from scratch for it to work.
|
Not sure where the problem lies but if I backup my database using this script its 20Mb in size, give or take a wee bit, but if I backed up using the option from SQL Studio Management Express it used to be 200Mb in size.
Well it was but isn't anymore. Just backed up from SSME and it's now the same size. What gives? |
How can i restore this backup ?
Thanks in advance! |
Just thought I'd add that here's a freeware version with email notification as well as rotating your backups out:
Free SQL Server database backup, Zip and FTP software Very easy to use. |
Quote:
OSQL -E -Q "restore database BESMgmt from disk = 'C:\BlackBerryDBBackup\backup.bak'" ...or you could restore it using Microsoft SQL Studio Express, as well. @DavidAdams, are you using the backups were 200MB in size and not the actual database (MDF file)? The BES database starts out at 100MB, although the backups can be as small as 5MB. Another thought is that perhaps your transaction logs were truncated at some point, which would affect the backup size. |
Can anyone come up with an additional code in this script to then COPY the new backup file to another drive? I have the sript working great, but I'd like to also make a copy to a share on another server (in this case Z:) for redundancy.
I am awful at scripting, so I can't figure out how to do this. |
I use robocopy (Free Utility) to copy them to another server. You can download it.
My code is below: Code:
cd\ On the destination server, I run a zdel script to delete backups that are 3+ days old. |
Very odd thing happened. For some reason this script - which was working perfectly fine for months - all of a sudden stopped working on 4/1 and hasn't run since. When I double-click on teh script the window just flashes and nothing happens. I'm not even getting any errors in the Event Viewed, which doesn't help me.
Any ideas on what to try? :? EDIT: I'm trying to manually run osql -E in the command prompt and I'm getting "'osql' is not recognized as an internal or external command, operable program or batch file." Uh-oh.... Edit 2: In looking back at that day, the server crashed and there's a chance that's when I re-installed BES. |
All times are GMT -5. The time now is 03:35 AM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.