Vous êtes sur la page 1sur 7

Administrating SQL Server

I ) Starting, Pausing, and Stopping SQL Server


Before you log in to an instance of Microsoft SQL Server, you need to know how to
start, pause, and stop an instance of SQL Server. After you are logged in, you can perfor
tasks such as adinistering the server or !uerying a data"ase.
To change the default service Service Manager
How to change the default service (Service Manager)
To change the default service
Right-click SQL Server Service Manager, and then click Options.
In the Default Service o!, select the new default service to view through SQL Server
Service Manager. "hen #ou restart the co$%uter, the service that a%%ears is the new
default. &or e!a$%le, if #ou change the default service to SQLServer'gent service and
then shut down the co$%uter, the ne!t ti$e #ou start it, SQLServer'gent service will e
dis%la#ed in Service (ontrol Manager. )ou can onl# change the default service for the
local $achine.
Using SQLServerAgent Service
SQLServerAgent is a #indows $% &.' or #indows (''' service that e)ecutes *o"s,
onitors SQL Server, and fires alerts. SQLServerAgent is the service that allows you to
autoate soe adinistrative tasks. As such, you ust start the SQLServerAgent service
"efore your local or ultiserver adinistrative tasks can run autoatically. SQL Server
Agent runs as a service called SQLServerAgent if it is the default instance or
SQLAgent+instancena$e if it is a naed instance.
,f the SQL Server service and SQL Server Agent service are not configured to start
autoatically, you ust start the anually.
Setting the Polling Interval
%he service status of various SQL Server coponents is onitored regularly "y SQL
Server -nterprise Manager and SQL Server Service Manager. Both allow the onitoring
interval to "e changed.
SQL Server Enterprise Manager
.ou can set the interval at which SQL Server -nterprise Manager checks the status of
SQL Server, SQL Server Agent, the /ull0%e)t Search feature 1which runs as the Microsoft
Search service2, SQL Mail, 3eplication Monitor, and Microsoft 4istri"uted %ransaction
5oordinator 1MS 4%52 to deterine whether they are running, paused, or stopped. %he
status of each service is displayed through its icon in the console tree of Microsoft
Manageent 5onsole 1MM52.
SQL Server Service Manager
.ou can set the interval at which SQL Server Service Manager checks the status of SQL
Server, SQL Server Agent, the /ull0%e)t Search feature, and MS 4%5 to deterine
whether they are running, paused, or stopped. 6iew the status "y clicking the SQL
Server Service Manager icon in the #indows task"ar.
How to set the polling interval (Enterprise Manager)
To set the polling interval
*!%and a server grou%, and then click a server.
+n the Tools $enu, click Options.
+n the General ta, select the Poll server to find out state of server and related services
check o!.
In the Service list, click the service to %oll.
In the Poll interval (seconds) o!, t#%e or select the %olling interval.
How to set the polling interval (Service Manager)
To set the polling interval
,. Start SQL Server Service Manager, if it is not alread# running.
-. In the Microsoft. "indows. taskar, right-click SQ Server Service Manager, and
then click Options.
/. In the Polling interval (seconds) o!, enter a %olling interval.
0he %olling interval deter$ines how often SQL Server Service Manager checks the state
of Microsoft SQL Server1, SQL Server 'gent, and Microsoft 2istriuted 0ransaction
(oordinator (MS 20().
3. +%tionall#, select the !erif" service control action check o! if #ou want SQL Server
Service Manager to %rovide a confir$ation o! efore sto%%ing, %ausing, starting, or
continuing a service, including de%endent services such as SQL Server 'gent.
Starting SQL Server Automatically
4uring installation, you can configure Microsoft SQL Server to start autoatically in
the following ways7
.ou can configure an instance of SQL Server to start autoatically each tie you start
the Microsoft #indows $% &.' or #indows (''' operating syste.
.ou can configure a server running Microsoft #indows 89 to start autoatically. Select
the Auto-start service hen !S starts check "o) in SQL Server Service Manager.
#indows 89 does not have a coponent that corresponds to #indow $% &.' and
#indows (''' services. %he SQL Server data"ase engine and SQL Server Agent run as
e)ecuta"le progras on #indows 89. %hese SQL Server coponents cannot "e started as
services autoatically.
"ote %he SQL04M: AutoStartServer property does not work with #indows 89.
.ou can also use the Services application in 5ontrol ;anel.
After SQL Server is installed, you can ena"le or disa"le the server configuration using
SQL Server -nterprise Manager. /or ore inforation, see the #indows $% &.' and
#indows (''' docuentation.
How to start an instance of SQ Server auto#aticall" (Enterprise Manager) $
To start an instance of SQ Server auto#aticall"
Right-click a server, and then click Properties.
(lick the General ta.
4nder %utostart policies when the operating s"ste# starts, select the %utostart SQ
Server check o!.
How to shut off auto#atic startup of SQ Server (Enterprise Manager)$
To shut off auto#atic startup of SQ Server
Right-click a server, and then click Properties&
(lick the General ta.
4nder %utostart policies when the operating s"ste# starts, clear the %utostart SQ
Server check o!.
Starting SQL Server Manually
.ou can start an instance of Microsoft SQL Server anually using the following
ethods.
Method #escription
SQL Server -nterprise Manager Start, pause, continue, and stop an instance of a
local or reote SQL Server or the SQL Server
Agent service in the sae window in which you
adinister other servers and data"ases.
SQL Server Service Manager Start, pause, continue, and stop an instance of a
local or reote SQL Server or the SQL Server
Agent service.
Services application in 5ontrol ;anel Start, pause, continue, and stop an instance of SQL
Server or the SQL Server Agent service on the
local server.
5oand propt Start an instance of SQL Server or the SQL Server
Agent service fro a coand propt "y typing7
net start mss$lserver or s$lservr, or net start
SQLServerAgent or "y running
SQLSE%&%'E(E. ,f you are referring to a naed
instance of SQL Server, you ust specify
mss$l)instancena#e or
SQLAgent)instancena#e.
*e+ore you choose a startup method, consider the +olloing,
< ,f you start an instance of SQL Server using s$lservr fro a coand propt
1independent of the Service 5ontrol Manager27
= All syste essages appear in the window used to start an instance of SQL Server.
= .ou cannot pause, stop, or resue an instance of SQL Server as a #indows $%
&.' or
#indows (''' service using SQL Server -nterprise Manager, SQL Server Service
Manager, the Services application in 5ontrol ;anel, or any net coands 1for
e)aple, net
start, net pause, net stop, and net continue2.
= .ou ust shut down an instance of SQL Server "efore logging off #indows $%
&.' or
#indows ('''.
< ,f you start an instance of SQL Server fro a coand propt7
= Any coand propt options that you type take precedence over the default
coand
propt options written to the #indows (''' registry "y SQL Server Setup.
= SQL Server Service Manager and SQL Server -nterprise Manager show the
service as
stopped.
< .ou can log off the #indows $% &.' or #indows (''' network without shutting down
an instance of SQL Server.
Logging In to SQL Server
.ou can log in to an instance of Microsoft SQL Server "y using any of the graphical
adinistration tools or fro a coand propt.
#hen you log in to an instance of SQL Server using a graphical adinistration tool such
as SQL Server -nterprise Manager or SQL Query Analy>er, you are propted to supply
the server nae, a login ,4, and a password, if necessary. ?ow you log in to an instance
of SQL Server depends on whether SQL Server is using #indows Authentication or
i)ed ode 1SQL Server Authentication and #indows Authentication2. ,f SQL Server is
using #indows Authentication, you do not have to provide a login ,4 each tie you
access a registered SQL Server. ,nstead, SQL Server logs you in autoatically using your
Microsoft #indows $% &.' or #indows (''' account.
"ote ,f you selected a case0sensitive sort order when you installed SQL Server, your
login ,4 is also case0sensitive.
-o log in to SQL Server .ommand Prompt
?ow to log in to the default instance of SQL Server 15oand ;ropt2
-o log in to the de+ault instance o+ SQL Server
/ro a coand propt, enter either7
os$l /U @login5idA /P @%asswordA /S @serverna$eA
0or0
is$l/U @login5idA/P @%asswordA /S @serverna$eA
%unning SQL Server
Microsoft SQL Server can run over the network or without a network.
%unning SQL Server on a "etor0
/or SQL Server to counicate over the network, the SQL Server service ust "e
running. By default, Microsoft #indows $% &.' and #indows (''' autoatically
start the "uilt0in SQL Server service. %o find out whether the SQL Server service has
"een started, at the coand propt, type7
net start
,f the SQL Server service has "een started, the following appears in the net start output7
.,12 net start
%hese #indows $% services are started7
.lip*oo0 Server
.omputer *roser
EventLog
Messenger
"etor0 ##E
"etor0 ##E #S#M
Server
3or0station
%he coand copleted successfully.
,f the SQL Server service has not "een started, at the coand propt, type7
net start server
%he following essage indicates that the service has "een started7
-he Server service as started success+ully'
.ou can also use the Services application in 5ontrol ;anel to check service status and to
start and stop services. /or ore inforation, see the #indows $% &.' and #indows
(''' docuentation.
3unning SQL Server #ithout a $etwork
#hen running an instance of SQL Server without a network, you do not need to start the
"uilt0in SQL Server service. Because SQL Server -nterprise Manager, SQL Server
Service Manager, and the net start and net stop coands are functional even without a
network, the procedures for starting and stopping an instance of SQL Server are identical
for a network or stand0alone operation.
#hen connecting to an instance of a stand0alone SQL Server fro a local client such as
os$l, you "ypass the network and connect directly to the instance of SQL Server "y using
a local pipe. %he difference "etween a local pipe and a network pipe is whether you are
using a network. Both local and network pipes esta"lish a connection with an instance of
SQL Server "y using the standard pipe 1BpipeBs!lB!uery2, unless otherwise directed.
#hen you connect to an instance of a local SQL Server without specifying a server nae,
you are using a local pipe. #hen you connect to an instance of a local SQL Server and
specify a server nae e)plicitly, you are using either a network pipe or another network
interprocess counication 1,;52 echanis, such as ,nternetwork ;acket
-)changeCSe!uenced ;acket -)change 1,;DCS;D2 1assuing you have configured SQL
Server to use ultiple networks2. Because a stand0alone SQL Server does not support
network pipes, you ust oit the unnecessary /Sserver5na$e arguent when connecting
to the instance of SQL Server fro a client. /or e)aple, to connect to a stand0alone
instance of SQL Server fro os$l, type7
os$l /Usa /P
Stopping SQL Server
.ou can stop an instance of Microsoft SQL Server locally fro the server or
reotely fro a client or another server. ,f you stop an instance of SQL Server without
pausing it, all server processes are terinated iediately. Stopping an instance of SQL
Server prevents new connections and disconnects current users.
%he following ta"le descri"es the availa"le ethods for stopping an instance of SQL
Server.
Method #escription
SQL Server -nterprise
Manager
Stops a local or reote instance of SQL Server or a SQL
Server Agent service.
SQL Server Service Manager Stops a local or reote instance of SQL Server or a SQL
Server Agent service fro a single window or fro the
#indows task"ar.
S?E%4:#$ stateent Stops an instance of SQL Server when e)ecuted within os$l
or another !uery tool. Esing the #,%? $:#A,% option
stops an instance of SQL Server iediately.
net stop ss!lserver Stops an instance of SQL Server either reotely or locally if
you are running the Microsoft #indows $% &.' or
#indows (''' operating systes. %o stop a naed
instance of SQL Server (''', you ust enter net stop
ss!l+instancenae fro the coand propt.
5ontrol ;anel Stops an instance of SQL Server using the Services
application in 5ontrol ;anel.
5%3LF5 Stops an instance of SQL Server if it was started as a
progra fro the coand propt.
#hen you stop an instance of SQL Server, the server perfors these services "efore it
shuts down7
4isa"les logins 1e)cept for syste adinistrators2.
;erfors a 5?-5G;:,$% in every data"ase. ?owever, if you stop an instance of SQL
Server using 5%3LF5 at the coand propt, it does not perfor a 5?-5G;:,$% in
every data"ase. %herefore, the ne)t tie the server is started, recovery tie takes longer.
#aits for all %ransact0SQL stateents or stored procedures currently e)ecuting to finish.
"ote -o 4ring the system to an immediate halt, you can issue the S5U-#!3"
3I-5 "!3AI- statement +rom the os$l utility'
-o stop SQL Server Enterprise Manager
?ow to stop SQL Server or SQL Server Agent 1-nterprise Manager2
$ote Before stopping an instance of Microsoft SQL Server, you should pause SQL
Server and stop SQL Server Agent to ensure the ost orderly shutdown. .ou can stop
"oth "y using SQL Server Service Manager.
-o stop SQL Server or SQL Server Agent 6Enterprise Manager)
H. 3ight0click a server, and then click ;ause.
(. :ptionally, send a essage inforing connected users that the server will "e shutting
down.
After an appropriate interval, proceed to Step I.
I. 3ight0click SQL Server Agent, and then click Stop.
&. 3ight0click the server, and then click Stop.
$ote Stopping an instance of SQL Server "y using SQL Server -nterprise Manager or
the net stop ss!lserver coand causes SQL Server to perfor a checkpoint in all
data"ases. %hen a S?E%4:#$ #,%? $:#A,% is done to flush all coitted data
fro the data cache and to stop the server iediately.
-o stop SQL Server or SQL Server Agent 6Service Manager)
H. ,f the service is a reote service, in the Server "o), enter the nae of the reote
server. ,f it is a local server, the Server "o) will "e filled in.
%his connects you to the reote server and populates the Services "o) with the naes
of the SQL Server services registered on the reote coputer.
(. ,n the Services dialog "o), click SQL Server or SQL Server Agent.
I. 5lick ;ause.
,f you are stopping SQL Server Agent, proceed to Step &. :therwise, send a essage
inforing connected users that the server will "e shutting down. After an appropriate
interval, proceed to Step
&.5lick Stop.
5o to stop the de+ault instance o+ SQL Server 6.ommand Prompt)
%o stop the default instance of SQL Server
/ro a coand propt, enter7
net stop mss$lserver
$ote Stopping a default instance of Microsoft SQL Server using SQL Server
-nterprise Manager or the net stop ss!lserver coand causes SQL Server to perfor
a checkpoint in all data"ases. %hen a S?E%4:#$ #,%? $:#A,% is done to flush all
coitted data fro the data cache and to stop the server iediately. Stopping a
default instance of SQL Server fro the coand propt works only if you are running
Microsoft #indows $% &.' or #indows ('''.

Vous aimerez peut-être aussi