Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 531
  • Last Modified:

Batch file for auto backup

Can someone help me write a batch file to stop the SQL service, copy a data folder on my external drive and paste it to my desktop, then restart SQL service ?
0
raffie613
Asked:
raffie613
3 Solutions
 
sshah254Commented:
@echo off
net stop "mssqlserver" ---- replace this with the name of your server
xcopy source destination /s /e
net staart "mssqlserver"

SS
0
 
johnb6767Commented:
No points.....

Syntax error above...

net staart "mssqlserver"

Should be

net start "mssqlserver"
0
 
raffie613Author Commented:
ok, but I am running SQL express 2005 on my workstation, do not have a SQL server. Is the Net stop the same? Just use my computer name?
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
ebalCommented:
it should be something like SQLExpress instead.
Anyway you can know it either by issuing a :
tasklist /svc
on the command line.
Or running services.mscand right-click on the service. The name is the first field of the properties windows.
0
 
peter197911Commented:
The "net stop service"  and the "net start service" simply do start services that are running on you're machine.
Probably the service  you want to stop in this case is name  "SQLEXPRESS" or something like that.
Open mmc: services  and just lookup what the exact name is of the service.

For example:  
net stop SQLEXPRESS
xcopy source destination /s /e
net start SQLEXPRESS
0
 
raffie613Author Commented:
ok, and I write this batch file in Notepad? Where do I save it so it can run every night? How do I set the time that it should run?

0
 
David Johnson, CD, MVPOwnerCommented:
save it wherever you want and then set up task manager from administrative tools/task scheduler as shown here
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now