BlackBerry Forums Support Community               

Closed Thread
 
LinkBack Thread Tools
Old 08-29-2007, 03:59 AM   #1 (permalink)
New Member
 
Join Date: Aug 2007
Model: 7100t
PIN: N/A
Carrier: Vodafone
Posts: 6
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default Any SQL db backup guru's ?

Please Login to Remove!

Greetings All,

I am in the process of testing DR for our BES 4.1 on exchange 2003 and SQL 2005 (all on one box).

So far I have managed to do a backup from SQL server management express but just doing a right click on "BESMgmt" and selecting backup.

Once this was done, I then uninstalled SQL, deleted all databases and when through the restore process:

1. Reinstall SQL
2. use createdb to erm .. create an empty db
3. Open a command prompt and type osql -E
Type the following commands in the specified order: 1> restore database BESMgmt from disk = "c:\backup.bak" with recovery,replace
2> go
3> quit

And it all works!

cut a long story short (too late!)

How can i automate the initial backup of the database, so i dont have right click - select backup.

Can i do it from the command line using Osql ?

Will the command line create a new file for every backup everyday or will it just append to a big file. Ideally i would like a history of 7days (7 files), which will then cycle.

I thank you in advance
Offline  
Old 08-29-2007, 07:38 AM   #2 (permalink)
BlackBerry Genius
 
hdawg's Avatar
 
Join Date: Aug 2006
Model: hdawg
PIN: port3101.org
Carrier: hdawg
Posts: 6,632
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Guru I am not ... but here's a command to backup the DB:

osql -E -Q " backup database <BlackBerry_Configuration_Database_name> to disk = 'C:\BESMgmt.bak' "

by default I believe it appends.

Personally I'd create a cmd / bat file to do something like:

set BACKUPDIR=C:\SQLBackups
if not exist %BACKUPDIR% mkdir %BACKUPDIR%
if exist %BACKUPDIR%\BESMgmt.bak.3 del /q/f %BACKUPDIR%\BESMgmt.bak.3
if exist %BACKUPDIR%\BESMgmt.bak.2 move %BACKUPDIR%\BESMgmt.bak.2 %BACKUPDIR%\BESMgmt.bak.3
if exist %BACKUPDIR%\BESMgmt.bak.1 move %BACKUPDIR%\BESMgmt.bak.1 %BACKUPDIR%\BESMgmt.bak.2
if exist %BACKUPDIR%\BESMgmt.bak move %BACKUPDIR%\BESMgmt.bak %BACKUPDIR%\BESMgmt.bak.1
osql -E -Q " backup database <BlackBerry_Configuration_Database_name> to disk = 'C:\SQLBackups\BESMgmt.bak' "

Its not pretty or scalable at all; but its easy to read, understand, and it works.
Offline  
Old 08-29-2007, 08:02 AM   #3 (permalink)
CrackBerry Addict
 
vinmontRD's Avatar
 
Join Date: Jul 2007
Location: NJ, USA
Model: 8900
OS: 5.0.0.238
Carrier: T-Mobile
Posts: 726
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Any reason you're not using Enterprise Manager's Database Maintenance Plan Wizard to set up a Database Maintenance Plan? I'd think this would be the easiest approach. (although admittedly I'm not a BES expert)
Offline  
Old 08-30-2007, 10:00 AM   #4 (permalink)
New Member
 
Join Date: Aug 2007
Model: 7100t
PIN: N/A
Carrier: Vodafone
Posts: 6
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks very much hdawg, I have used your script and used the forfiles utility to handle the auto deleting.



vinmontRD, that was my original intention, but when i right click the DB and go to tasks, i dont see the maintenance wizard option

I am logged in as used who has full rights (me thinks) to the database and server.
Offline  
Old 08-30-2007, 03:35 PM   #5 (permalink)
x14
BlackBerry Extraordinaire
 
Join Date: Jul 2005
Location: NYC
Model: 9800
OS: 6.0.0.546
Carrier: AT&T
Posts: 2,344
Post Thanks: 0
Thanked 17 Times in 16 Posts
Default

Goto Management -> Database Maintenance Plans. Right click and select "New Maintenance Plan..."
__________________
Exchange 2007/BES 5.0.2 MR2
Offline  
Closed Thread


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On





Copyright 2004-2014 BlackBerryForums.com.
The names RIM and BlackBerry are registered Trademarks of BlackBerry Inc.