Simple Batch Backup for SME
Simple Batch Backup for SME
Copying SME database files to a backup folder with Windows Scheduler.
Purpose:
Backup of SME data to a temporary folder that can be accessed by your backup software.
MS SQL Server service must be stopped in order to allow a backup of the SME data files. Since some backup programs do not have the ability to stop the MS SQL Server Service you can use this method to copy the data to a folder that a backup program can access.
This procedure will provide a method to make a copy of the database into the backup folder outside of the SME data folder on a scheduled basis. This will make an exact copy of your data folders that will not be locked by the MS SQL Server service and allow your usual backup utility to capture them for safe keeping.
· On your server or computer hosting the database.
· Create a new folder called 'BackupUtility' in the SME Program folder. (like C:\SME5\BackupUtility)
· Create a new folder called Backup in a folder location of your chosing or in the SME Data folder . (like C:\SME\FullDataBackup)
· Save the text below between the lines into a Notepad file called SMEBackup.bat to the BackupUtility folder. (If you need to modify the file you’ll need right click and select ‘Edit’ from the context menu.)
· Edit the MSSQL Service line to match your SQL instance. (i.e. if you called your instance SME then the line would read MSSQL$SME, etc..). To locate your instance name open the MS SQL Configuration Manager and look at the list of services.
· Modify the XCOPY file path line with the paths for your SME Data and backup folder.
· If you have multiple databases you can add another line for each company database and modify it accordingly.
· Save the file as SMEDataBakup.bat.
· Log all users out of SME and test the file by double clicking on it or by right clicking and selecting Run.
· You should see your database files coping to the backup folder.
ECHO OFF
- Stop SQL Service
NET STOP MSSQL$SMESERVER
- Stop the Full Text Search Service
Net Stop MSFTESQL$SMESERVER
- BACKUP the data
XCOPY /E /V /Y C:\SME5\Data\mycompanydata C:\SME5\Data\Backup\
- Start SQL Service
NET START MSSQL$SMESERVER
- Start the Full Text Search Service
Net Start MSFTESQL$SMESERVER
ECHO ON
Scheduling the batch file backup:
· Go to Start> Control Panel> Scheduled Tasks
· Run the Add Schedule Task Wizard
· Select the SME Data Backup.bat.
· Schedule the task to run as often as is necessary.