Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Batch file for backing up Sharepoint using OSQL

Status
Not open for further replies.

nitrokid

Technical User
Sep 14, 2005
89
GB
Hi there

I have drawn up a method for backing up our sharepoint content database using OSQL using the following commands

osql -S LCA-DC-01\sharepoint -E

backup database [STS_LCA-DC-01-1] To Disk='d:\backup\sharepoint\STS_LCA-DC-01_1'

GO


What I want to do is put this in a batch file to be run at 6am every morning. However, when puting the commands into the batch file, the command prompt sticks after the first command at the 1> prompt, requiring me to put the second and third command in manually.

Is there anyway I can automate this in the batch file?

Cheers

Stu
 
Yes, but this in the batch file.
Code:
osql -S LCA-DC-01\sharepoint -E -Q "backup database [STS_LCA-DC-01-1] To Disk='d:\backup\sharepoint\STS_LCA-DC-01_1'"
This will log into the server, run the command and exit osql.

The paramaters are case sensitive.

Denny
MCSA (2003) / MCDBA (SQL 2000) / MCTS (SQL 2005)

--Anything is possible. All it takes is a little research. (Me)
[noevil]
 
wow, that simple huh

hehe worked a treat. Thanks a million
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top