Hello Mark,
I am not sure why the .bak file size varies from ArcCatalog backup compared to SQL Server Express backup. I tested this on my machine, both sizes of the .bak files were the same. There could have been edits made to the database before the second backup was taken? The SQL script could vary from the ArcCatalog execution?
Check out this article from Microsoft. Might help out with automating the backup from SQL Server Express.
How to schedule and automate backups of SQL Server databases in SQL Server Express
Hope that helps!
Samuel,
I am closer to a solution. I figured out that by default the backup for SQL Server appends data instead of deletes data. I fixed that part by deleting the backup file before running the backup script. I still am having trouble as I can manually run the .bat file, but it seems that the task scheduler will not. I will take a closer look at the link that you provided to see if that will help out.
This is what my batch file looks like now:
cd /d "C:\Program Files\Microsoft SQL Server\MSSQL10_50.SQLEXPRESS\MSSQL\Backup"
del MyBackupFile.bak
"C:\Program Files\Microsoft SQL Server\100\Tools\Binn\SQLCMD.EXE" -i"C:\SQLBackupScripts\MySQLFile.sql" -S "localhost\sqlexpress"
cd /d "C:\Program Files\Microsoft SQL Server\MSSQL10_50.SQLEXPRESS\MSSQL\Backup"
copy MyBackupFile.bak \\AnotherServer\AShareOnTheServer$\MyBackupFile.bak /y
cd /d "C:\SQLBackupScripts"
The SQL file has not really changed:
BACKUP DATABASE [MyDatabase] TO DISK = N'C:\Program Files\Microsoft SQL Server\MSSQL10_50.SQLEXPRESS\MSSQL\Backup\MyBackupFile.bak' WITH NOFORMAT, NOINIT, NAME = N'MyDatabase-Full Database Backup', SKIP, NOREWIND, NOUNLOAD, STATS = 10
GO
So once again, the above code works fine now when I manually run the backup script. Now I need to figure out how to automate the backups.
Hello Mark,
Take a look at this as well:
Might help out with the task scheduler part of things
Run a batch file with Windows task scheduler - Stack Overflow