Windows command line script for backing up SQL Server DB's
$30-5000 USD
Paid on delivery
If you are savvy with command line scripting and SQL Server this should be very quick and easy.
I need my current script modified to backup every database that has a name starting with "rs"
Here is my current script:
Contents of [login to view URL]:
set db=%1
osql -Usa -Pmypassword123! -S localhost -Q "BACKUP DATABASE %db% TO DISK='d:\DbBackup\%db%.bak' WITH COMPRESSION
for /f "tokens=2,3,4 delims=/ " %%a in ('DATE /T') do set date=%%c-%%b-%%a
for /f "tokens=1" %%u in ('time /t') do set t=%%u
if "%t:~1,1%"==":" set t=0%t%
set timestr=%t:~0,2%%t:~3,2%
copy d:\dbbackup\%db%.bak d:\dbbackup\orig\%db%.bak
RENAME d:\dbbackup\%db%.bak "%date%_%timestr%_%db%.bak"
The above .bat file is called with:
call SQLBackup rsDB123
call SQLBackup rsDB555
call SQLBackup rsDB654
and produces the following files:
[login to view URL]
[login to view URL]
[login to view URL]
NOTES:
* It is SQL Server 2008 Enterprise Edition
* I do not want a solution that is run 'inside' SQL server such as a maintenance task.
* Windows Scripting Host code is acceptable.
* It needs to loop through all database names in my local SQL Server and if the name is rs*, back it up.
* My current script uses compression which is only found in Enterprise edition so your version might not support it. Should be easy to exclude/include it.
Project ID: #2700027