Hi Everyone, is anyone knows how to backup the database every hour automatically in RMS software?
*This post is locked for comments
This is a very simplistic bakup script i modified after seeing a few posts on various sites, i use schedular to run this every 4hrs. The square brackets are there becuase of the hyphen in my DB name. I like the other scripts that were posted as they are definatlty better with logging etc. At least this script is very easy to see and try for yourself. I agree that M$ should have made some type of backup automater in this day and age.
Jason
d:
cd rms-backups
del mybackup.025
ren mybackup.024 mybackup.025
ren mybackup.023 mybackup.024
ren mybackup.022 mybackup.023
ren mybackup.021 mybackup.022
ren mybackup.020 mybackup.021
ren mybackup.019 mybackup.020
ren mybackup.018 mybackup.019
ren mybackup.017 mybackup.018
ren mybackup.016 mybackup.017
ren mybackup.015 mybackup.016
ren mybackup.014 mybackup.015
ren mybackup.013 mybackup.014
ren mybackup.012 mybackup.013
ren mybackup.011 mybackup.012
ren mybackup.010 mybackup.011
ren mybackup.009 mybackup.010
ren mybackup.008 mybackup.009
ren mybackup.007 mybackup.008
ren mybackup.006 mybackup.007
ren mybackup.005 mybackup.006
ren mybackup.004 mybackup.005
ren mybackup.003 mybackup.004
ren mybackup.002 mybackup.003
ren mybackup.001 mybackup.002
ren mybackup.bck mybackup.001
osql -U sa -P nch -S NCH-SERVER -Q "BACKUP DATABASE [NCH-PROD] TO DISK ='d:\RMS-BACKUPS\mybackup.bck'"
Thanks for the input everyone to Robby's question as I was looking for a solution for a client and Dan provided one that my client could understand. I do have a question for Dan if he's listening on the following code:
FOR /F "DELIMS=" %%A IN ('DIR /O:-D /A:-D /B "*.bak"') DO (
IF DEFINED ARC_1 IF NOT DEFINED ARC_2 SET ARC_2=%%A
IF NOT DEFINED ARC_1 SET ARC_1=%%A)
IF EXIST %ARC_2% DEL /Q %ARC_2%
ECHO Filename: %ARC_2% -- deleted >>%logfile%
I find that the /O and /A options for the sort order and type of list aren't working as written but do as: /O:D and /A:D. An I'm confused as to if directories/folders are being listed why is the *.bak being used?
Thanks,
Sue
Hello All,
Thank you for the discussion.
This article will walk you through creating a script to automate backups.
How to schedule and automate backups of SQL Server databases in SQL Server Express Editions
support.microsoft.com/.../2019698
You can use SQL Server Management Studio as well.
How to schedule a database backup operation by using SQL Server Management Studio in SQL Server 2005
Try these; http://dl.dropbox.com/u/2128079/MRMS%20-%20Current/Backups/Backups.zip
Create a folder called Backups on the root of the C:\ and extract the files to it.
Open each .vbs file with Notepad and change the database name and password to yours.
To test, right click on them and select Open. A marker will appear on the Taskbar and disappear when the backup is done and there will be a corresponding .BCK file.
SOBack and HQBack hourly
Now go into Control Panel | Scheduled Tasks | Add a task | browse to the C:\Backups folder and select one of them | mark it to run Daily | enter the time to run it | do not enter the password | next | select the Open Advanced properties... when asked | Finish and ignore the warning | Schedule tab | Advanced button | select Repeat Task, every 1 hour and set the Duration to 24 hours | OK and then out in the user's password twice.
Schedule the ModelBack, MsdbBack and MasterBack weekly
Now remember that you are backing up to the same hard drive and its overwriting the last hour's backup. We recommend using a separate hard drive to backup the entire hard drive nightly and the daily changes hourly with a backup program like Norton Ghost. For example, we set the RMS backups to run @ :45 and the Ghost backup to run on the hour.
Remember, one can never have too many backups!!!!
EDIT: BTW, the SysRestorePoint.exe creates a forced System Restore point as XP isn't consistent making one. We schedule that to run daily in the morning before Shutdown. Oh yeah, we restart every 32bit machine every day, but that's for another post!
Robby
This community is horrible let alone dynamics RMS.. Let me share with you my bat script for a daily backup:
ECHO ON
SET logfile="C:\YOURPATHFORLOG\LOG\"
echo #>>%logfile%
echo #>>%logfile%
echo #-------- Start : %DATE% ---- %TIME% -------->>%logfile%
C:
CD \YOURPATHFORBACKUP\DB
FOR /F "DELIMS=" %%A IN ('DIR /O:-D /A:-D /B "*.bak"') DO (
IF DEFINED ARC_1 IF NOT DEFINED ARC_2 SET ARC_2=%%A
IF NOT DEFINED ARC_1 SET ARC_1=%%A)
IF EXIST %ARC_2% DEL /Q %ARC_2%
ECHO Filename: %ARC_2% -- deleted >>%logfile%
FOR /F "TOKENS=2,3,4 DELIMS=/ " %%i IN ('DATE /T') DO (SET logdate=%%k%%j%%i)
echo -------------------------------------------->>%logfile%
echo #Data Base backup file creation:>>%logfile%
OSQL -U sa -P YOURSQLSERVERPASSWORD -S (local) -Q "BACKUP DATABASE [YOURDATABASENAME] TO DISK = N'C:\YOURPATHFORBACKUP\DB\NAMEFORTHEBACKUP%logdate%.bak' WITH NOFORMAT, INIT, NAME = N'YOURDATABASENAME', SKIP, NOREWIND, NOUNLOAD, STATS = 10">>%logfile%
ECHO Filename: sql_backup_NAMEFORTHEBACKUP%logdate%.bak -- New backup created.>>%logfile%
ROBBY notice what I underlined is what you have to change to suit your needs..below a summary of what you need to change:
YOURPATHFORBACKUP\DB
\YOURPATHFORBACKUP\DB
YOURSQLSERVERPASSWORD
YOURDATABASENAME
YOURPATHFORBACKUP\DB\NAMEFORTHEBACKUP
NAMEFORTHEBACKUP
regards
Dan
Hi
Can you please tell me the sql command for Backup that I can use for bat file or if you sanple batch file I can use.
Thank You
Hi,
This job can be done by any It guy. You need to create one .bat (command file) file with sql command and it's very easy.
After creating file you need to just set as task scheduled.
Task Schedule you can fine in Control Panel (for server 2003)
If you even search on internet you can find some trick about that.
Robby,
There is no way to setup a backup directly through RMS, but there are batch files that you can create and setup to backup the database automatically. But that is something that microsoft doesn't provide. I do know that there are a few partners that can provide their customers with such batch files.So i would suggest you talkilng with your partner.
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,240 Super User 2024 Season 2
Martin Dráb 230,149 Most Valuable Professional
nmaenpaa 101,156