All Microsoft SQL Server services use an active database connection that always has access to the database files. These instances must be stopped before the data can be transferred or backed up and then must be restarted for Yearli to work.
For this to work, the following elements will be required:
- A batch file named SQLStop.bat
- A batch file named SQLStart.bat
- A batch file named backup.bat
- The Task Scheduler must be enabled
Procedure 1 (Configuring Automatic SQL database backups for Yearli)
1. Create the SQLStop.bat file - it needs to contain the following:
Yearli 2014
NET STOP MSSQL$WFP_SS8E
Yearli 2015 or 2016
NET STOP MSSQL$YD2015_SS8E
Yearli 2015 or 2016 (if SQL server YD2015_SS8E does not exist)
NET STOP MSSQL$WFP_SS8E
Yearli 2017
NET STOP MSSQL$YD2015_SS8E
Yearli 2018
NET STOP MSSQL$GREATLAND
Yearli 2019
NET STOP MSSQL$GREATLAND
Yearli 2020
NET STOP MSSQL$GREATLAND
Yearli 2021
NET STOP MSSQL$GREATLAND
Yearli 2022
NET STOP MSSQL$GREATLANDYD
2. Create the SQLStart.bat file - it needs to contain the following:
Yearli 2014
NET START MSSQL$WFP_SS8E
Yearli 2015 or 2016
NET START MSSQL$YD2015_SS8E
Yearli 2015 or 2016 (if SQL server YD2015_SS8E does not exist)
NET START MSSQL$WFP_SS8E
Yearli 2017
NET START MSSQL$YD2015_SS8E
Yearli 2018
NET START MSSQL$GREATLAND
Yearli 2019
NET START MSSQL$GREATLAND
Yearli 2020
NET START MSSQL$GREATLAND
Yearli 2021
NET START MSSQL$GREATLAND
Yearli 2022
NET START MSSQL$GREATLANDYD
3. Create the backup.bat file - it needs to contain a line to copy the files.
This will vary depending on where database is installed. Please look for the specific data location on your system. The example below will copy the contents of the Data folder to C:\YearliBackup
copy /y "C:\ProgramData\Yearli\20XX\Data" C:\YearliBackup
or
copy /y "C:\Program Files or Program Files (x86)\Greatland Corporation\Winfiler Plus or Yearli\20XX\Data\" C:\YearliBackup
4. Save and Add to Scheduled Tasks
- Save all three files to C:\
- Access the Windows Run window by pressing the Windows key and R key on the keyboard.
- Type "cmd" without the quotes in the Open field.
- Click OK.
- Type the commands below in the command prompt:
schtasks /create /sc DAILY /st 00:00 /tn "Yearli SQLStop" /tr "C:\SQLStop.bat"
- Hit Enter.
schtasks /create /sc DAILY /st 00:30 /tn "Yearli Backup" /tr "C:\Backup.bat"
- Hit Enter.
schtasks /create /sc DAILY /st 06:00 /tn "Yearli SQLStart" /tr "C:\SQLStart.bat"
- Hit Enter.
md C:\YearliBackup
9. Hit Enter.
An explanation:
To back up both the tables and the data they contain, the SQL service must first be stopped on the standalone machine or, for network users, the server. When run, SQLStop.bat will stop the service. If the unmodified command line from the preceding paragraph is used the service will be automatically stopped at midnight every day of the week. Backup.bat will run at 12:30 AM and will copy the data folder to whatever location specified. SQLStart.bat will restart the service at 6:00 AM every morning, allowing users to login normally. If necessary, the times Backup.bat will run can be modified at the user’s discretion.