Helped others back up SQL server automatically yesterday
Failed to use network ing drive as backup file storage path
The ephemeral disk space is insufficient.
So I decided to back up only the latest 2-day data on the local machine.
Write another batch for system scheduling.
Copy the backup data to the network drive every week for archival purposes
How to find files generated by batch processing on the Internet
Below is a better implementation
Batch file: @ Echo Off
Set Afile = Bak -% Date: ~ 4 , 4 % Date: ~ 9 , 2 % Date: ~ 12 , 2 %
Set Bfile = Bak -% Time: ~ 0 , 2 % Time: ~ 3 , 2 % Time: ~ 6 , 2 %
Set Cfile = Bak -% Date %
Echo afile = % Afile %
Echo bfile = % Bfile %
Echo cfile = % Cfile %
Output:
Afile = bak-20061219
Bfile = bak-113202
Cfile = Bak-Tuesday 2006-12-19
So back up bat.@ Echo off
ECHO is backing up data to the network drive...
Set folder = % date %
MD "Y: \ % folder %"
Copy D: \ databak \ *. Bak "Y: \ % folder %"
Echo backup is complete.