Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Administration (2000)
 Batch file stop and start

Author  Topic 

jbezanson
Starting Member

35 Posts

Posted - 2005-12-29 : 10:06:38
I need to create 2 batch files. One that will stop SQL Server 2000 and one to start it up again.

I am using LiveState to backup the server. It can fire a batch before and after the backup...hense the 2 I need. I don't want anyone trying to enter data while the backup is going on so I would like it stopped before the backup begins and then started after the backup is complete.

Thanks

Justin Bezanson

jbezanson@spatterdesign.ca
www.aspnetguy.com

Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)

7020 Posts

Posted - 2005-12-29 : 11:00:03
This isn't the way to do backups with SQL Server. Just run normal database backups and transaction log backups to disk, and then back those up to tape. There is no need to shutdown SQL Server to backup the databases, and it isn't even a good idea.

You should read the topic "SQL Server Architecture Backup/Restore Architecture" in the SQL Server Books Online to make sure you understand the whole subject of SQL Server backups before you setup backups.

Looking at the product explanation for LiveState makes me think that it wasn't really designed for the database server world. Symantec Backup Exec may be a better choice for a database server.





CODO ERGO SUM
Go to Top of Page

jbezanson
Starting Member

35 Posts

Posted - 2005-12-29 : 11:04:24
Sorry if I was unclear. LiveState is a Symantec product and it is backing up the Windows 2003 server not the SQL Server. Symantec suggested to shutdown services like Sql Server and Exchange before backing up the system to avoid recovery errors.

Justin Bezanson

jbezanson@spatterdesign.ca
www.aspnetguy.com
Go to Top of Page

Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)

7020 Posts

Posted - 2005-12-29 : 11:24:49
I think I understood your question.

What I was saying was that I do not think that LiveState appears to be a good product for backing up a server running SQL Server (or Exchange) because it would require this shutdown.

Backups for these kinds of servers should be able to allow the server to operate 24x7 with online database backups, and that is why I suggested Symantec's Backup Exec.





CODO ERGO SUM
Go to Top of Page

jbezanson
Starting Member

35 Posts

Posted - 2005-12-29 : 11:46:51
Regardless, I have no control over what products my company uses. I just need a batch file that will shutdown SQL Server and another that will start it up again.

Can you help me with that? :)

Justin Bezanson

jbezanson@spatterdesign.ca
www.aspnetguy.com
Go to Top of Page

rockmoose
SQL Natt Alfen

3279 Posts

Posted - 2005-12-29 : 12:30:00
You can use

net stop <service name>
net start <service name>

for stopping and starting services

rockmoose
Go to Top of Page

bakerjon
Posting Yak Master

145 Posts

Posted - 2005-12-29 : 13:26:45
Again, you don't need to shutdown SQL Server. You should ask a DBA type person to backup SQL Server to disk and backup those files. While NET STOP MSSQLSERVER will do what you are asking, you are asking to do a not-so-good thing. Try thinking about the problem from a "Best Practice" perspective, instead of a "What my tool vendor told me to do" perspective.

Jon
-Like a kidney stone, this too shall pass.

http://www.sqljunkies.com/weblog/outerjoin
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2005-12-29 : 14:09:59
"net stop <service name>"

Note that this may not be a solution for what you want as I reckon that SQL Server is likely to determine that the service has stopped and restart it - potentially in the middle of your backup.

There have been enough questions on SQL Team about LiveState causing problems with SQL Server that I have concluded that its a pile of poo, and I agree with MVJ that you'd be better leaving SQL Server running.

Either way, you should most definitely use SQL Server's own tools to make backups-to-disk, because even if you stop SQL Server and backup its files that may not be the get-out-of-jail you need compared to conventional SQL Server backups (viz. more horror story threads here about the problems that people have trying to reinstate SQL Server from copies of its working files, rather than from Backup files created by SQL Server.)

I'm sure that LiveState will be able to back up those files just fine. Set LiveState to ignore the SQL Server DATA folder, and let it rip on the BACKUP folder instead

Kristen
Go to Top of Page

rockmoose
SQL Natt Alfen

3279 Posts

Posted - 2005-12-29 : 14:38:16
Just selling the guns

rockmoose
Go to Top of Page

Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)

7020 Posts

Posted - 2005-12-29 : 14:51:16
I think the problem is the assumption that LiveState is a true backup product. From the info on the web site, it seems to be a system recovery tool that backs up a snapshot of a disk. It might work very well for recovering a crashed OS, but I do not think it is the tool for doing database backups, even from disk. Symantec's web site seems to say this too, pointing out that it is a value added feature for use with a true backup product, like Backup Exec.

I would wonder about things like:
1. Can it recover a single file without recovering the whole disk?
2. Can it recover files from the same disk to multiple locations on different disks and different servers?
3. Can it recover to a smaller, larger, or even a different disk volume?

If the answer to any of these questions is no, then you don't have a true backup, you have some kind of disk image.

Also, I don't think you can use NET STOP, NET START from a remote system. You might be able to use the Windows resource kit SC (Service Control) command:

SC \\myserver stop MSSQLSERVER






CODO ERGO SUM
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2005-12-30 : 14:06:54
2a. And will you be able to get SQL Server to come upright with the restored-to-different-locations snapshot?

Worth a dry run, before a real crash!, that's for sure

Kristen
Go to Top of Page

Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)

7020 Posts

Posted - 2005-12-30 : 14:29:14
Check out what the topic poster put on his blog:

http://www.aspnetguy.com/Entry.aspx?e=12

"Create Batch File to Start or End Windows Services
30-December-2005 11:57 AM

Description -
The windows environment can be changed by starting or ending various services...
...
...
The important commands are the following:

NET START - starts the service
NET stop - ends the service..."


Wonder where he heard about NET START and NET STOP commands? Don't see much in the way of "Thank You to those guys over at SQLTeam.com."





CODO ERGO SUM
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2005-12-30 : 17:15:50
"Just selling the guns"

Your murky past is going to catch up with you Rocky!
Go to Top of Page
   

- Advertisement -