Windows command line script for backing up SQL Server DB's

Cancelled Posted Jan 11, 2012 Paid on delivery
Cancelled 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.

Cisco Database Administration Electronics Microsoft MySQL Script Install Shell Script SQL System Admin Windows Desktop

Project ID: #2700027

About the project

9 proposals Remote project Active Feb 2, 2012

9 freelancers are bidding on average $55 for this job

pr0digysl

See private message.

$35.7 USD in 14 days
(156 Reviews)
10.0
pradeepsingh37

See private message.

$68 USD in 14 days
(14 Reviews)
4.4
privatetd

See private message.

$12 USD in 14 days
(18 Reviews)
4.3
yubor

See private message.

$25.5 USD in 14 days
(36 Reviews)
4.4
ranju61

See private message.

$2 USD in 14 days
(19 Reviews)
3.7
lbenzaquin

See private message.

$17 USD in 14 days
(5 Reviews)
3.3
jerredb

See private message.

$140.25 USD in 14 days
(0 Reviews)
0.0
hsleemwork

See private message.

$110.5 USD in 14 days
(0 Reviews)
0.0
CodingStyleDr

See private message.

$80.75 USD in 14 days
(0 Reviews)
0.0