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.
Configuring Automatic SQL Database Backups for Yearli
Create the "SQLStop.bat" File
It needs to contain one of 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 - 2021
- NET STOP MSSQL$GREATLAND
- Yearli 2022 - Present
- NET STOP MSSQL$GREATLANDYD
Create the "SQLStart.bat" File
It needs to contain one of 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 - 2021
- NET START MSSQL$GREATLAND
- Yearli 2022 - Present
- NET START MSSQL$GREATLANDYD
Create the "backup.bat" File
It needs to contain a line to copy the files.
This will vary depending on where the database is installed. Please look for the specific data location on your system. If defaults were used, you can refer to the Important Program Directories and File Locations article.
The examples below will copy the contents of the Data folder to C:\YearliBackup. If there is already a file in that location, it will replace it with a new copy:
- 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
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
- Hit Enter.
- schtasks /create /sc DAILY /st 00:00 /tn "Yearli SQLStop" /tr "C:\SQLStop.bat"
How This Process Works
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.