Invariably something will go wrong when you least expect it (hard drive crash, lightning strike, theft, etc.). Backups ensure a speedy recovery from most disasters.
RMS related files you should backup DAILY include y
Store Operations Manager and HQ Manager include a Backup option under Utilities to backup the RMS database as a SQL backup file (.bck extension). However, you can also create a batch file that contains a statement to backup the database. You can then schedule this file to run daily (or whatever frequency you desire) through Windows Scheduled Tasks program.
A SAMPLE BATCH FILE IS ATTACHED.
If you prefer to create your own batch file, follow these steps:
1. Open Notepad and enter the following:
osql -U sa -P password -S Servername -Q "BACKUP DATABASE databasename TO DISK = 'e:\\backup\\back1.bck' WITH INIT"
Note: Substitute sqlcmd for osql if running SQL 2005 Express or higher.
2. If you have a password for the sa user you will need to enter the password after the -P parameter in the above statement.
3. Replace ServerName with the name of your server which can be found in the SQL Server Service Manager.
4. Replace databasename with the actual name of your Store Operations or Headquarters database.
5. Replace 'e:\\backup\\back1.bck' with the valid path to the directory and drive of your choice.
6. Save the file with the extension .BAT, such as: backupSO.bat
7. Use Windows Scheduled Tasks to run this file from the Server whenever you would like. Scheduled Tasks is found on most Windows machines under Start | Programs | Accessories | System Tools. Or Control Panel | Scheduled Tasks.
Note: If the backup file is not renamed, moved to another location, or a new disk is not placed in the drive, zip or CD drive, the previous backup file will be overwritten. Each time the batch is run the filename will be the same name entered for the path and filename within the Backup statement.
If you are backing up drive-to-drive over the network, you may want to create two or three batch files that run on different days and backup to different filenames. Example: Mon-Wed-Fri Backup and Tue-Thu-Sat Backup. That way you will have a historical file in case your latest backup is unusable or contains invalid data. Use the Windows Task Scheduler, Advanced Setting to program the day/time for each batch routine to run.
Example backup file names:
backupMWF.bck -- Mon Wed Fri
backupTTF.bck -- Tue Thu Sat
backupSUN.bck -- Sunday
This would provide you with a once a week historical backup on Sunday, plus two sets of rotating weekday backups.
If you really want to be safe, subscribe to a drive space service, and periodically backup your data over the Net. Now you can recover important information even if your business burns to the ground. You will need this data for your insurance claim. ;-)
- The end command WITH INIT overwrites the backup file each time your run the batch file. If you remove this phrase the backup will continually append to the file.
- SQL will not allow you to backup the database to a network drive (security issues), but you can add a line to your batch file to copy the backup file to another drive.