administrating sql server

Upload: sujai-senthil

Post on 03-Jun-2018

213 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/12/2019 Administrating SQL Server

    1/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 perfortasks 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 theDefault Serviceo!, select the new default service to view through SQL ServerService 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 thelocal $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 toautoate soe adinistrative tasks. As such, you ust start the SQLServerAgent service"efore your local or ultiserver adinistrative tasks can run autoatically. SQL ServerAgent runs as a service called SQLServerAgent if it is the default instance orSQLAgent+instancena$eif 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 SQLServer -nterprise Manager and SQL Server Service Manager. Both allow the onitoringinterval to "e changed.SQL Server Enterprise Manager

    ou can set the interval at which SQL Server -nterprise Manager checks the status ofSQL Server, SQL Server Agent, the /ull0%e)t Search feature 1which runs as the MicrosoftSearch service2, SQL Mail, 3eplication Monitor, and Microsoft 4istri"uted %ransaction5oordinator 1MS 4%52 to deterine whether they are running, paused, or stopped. %hestatus of each service is displayed through its icon in the console tree of MicrosoftManageent 5onsole 1MM52.SQL Server Service Manager

    ou can set the interval at which SQL Server Service Manager checks the status of SQLServer, SQL Server Agent, the /ull0%e)t Search feature, and MS 4%5 to deterinewhether they are running, paused, or stopped. 6iew the status "y clicking the SQLServer Service Managericon in the #indows task"ar.

    How to set the polling interval (Enterprise Manager)

  • 8/12/2019 Administrating SQL Server

    2/7

    To set the polling interval

    *!%and a server grou%, and then click a server.

    +n the Tools$enu, click Options.+n the Generalta, select thePoll server to find out state of server and related services

    check o!.

    In theServicelist, click the service to %oll.In thePoll 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-clickSQ Server Service Manager, and

    then click Options./. In thePolling 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 actioncheck o! if #ou want SQL Server

    Service Manager to %rovide a confir$ation o! efore sto%%ing, %ausing, starting, orcontinuing 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 inthe following ways7ou can configure an instance of SQL Server to start autoatically each tie you startthe Microsoft #indows $% &.' or #indows (''' operating syste.ou can configure a server running Microsoft #indows 89 to start autoatically. Selectthe Auto-start service hen !S startscheck "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 ase)ecuta"le progras on #indows 89. %hese SQL Server coponents cannot "e started asservices autoatically.

    "ote %he SQL04M: AutoStartServerproperty 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 usingSQL 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 clickProperties.

    lick the Generalta.

    4nder%utostart policies when the operating s"ste# starts, select the%utostart SQ

    Servercheck o!.

  • 8/12/2019 Administrating SQL Server

    3/7

  • 8/12/2019 Administrating SQL Server

    4/7

    = 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

    coandpropt options written to the #indows (''' registry "y SQL Server Setup. = SQL Server Service Manager and SQL Server -nterprise Manager show theservice as

    stopped.

    < ou can log off the #indows $% &.' or #indows (''' network without shutting downan 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 suchas SQL Server -nterprise Manager or SQL Query Analy>er, you are propted to supplythe server nae, a login 4, and a password, if necessary. ?ow you log in to an instanceof SQL Server depends on whether SQL Server is using #indows Authentication ori)ed ode 1SQL Server Authentication and #indows Authentication2. f SQL Server isusing #indows Authentication, you do not have to provide a login 4 each tie youaccess a registered SQL Server. nstead, SQL Server logs you in autoatically using yourMicrosoft #indows $% &.' or #indows (''' account.

    "ote f you selected a case0sensitive sort order when you installed SQL Server, yourlogin 4 is also case0sensitive.o log in to SQL Server .ommand Prompt

    ?ow to log in to the default instance of SQL Server 15oand ;ropt2o log in to the de+ault instance o+ SQL Server /ro a coand propt, enter either7os$l /U@login5id /P@%assword /S@serverna$e0or0is$l/U@login5id/P @%assword/S @serverna$e

    %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 "erunning. By default, Microsoft #indows $% &.' and #indows (''' autoaticallystart the "uilt0in SQL Server service. %o find out whether the SQL Server service has"een started, at the coand propt, type7net start

    f the SQL Server service has "een started, the following appears in the net startoutput7

  • 8/12/2019 Administrating SQL Server

    5/7

    .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, type7net start server

    %he following essage indicates that the service has "een started7he Server service as started success+ully'

    ou can also use the Services application in 5ontrol ;anel to check service status and tostart 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 ServerService Manager, and the net startand net stop coands are functional even without anetwork, the procedures for starting and stopping an instance of SQL Server are identicalfor a network or stand0alone operation.#hen connecting to an instance of a stand0alone SQL Server fro a local client such asos$l, you "ypass the network and connect directly to the instance of SQL Server "y usinga local pipe. %he difference "etween a local pipe and a network pipe is whether you areusing a network. Both local and network pipes esta"lish a connection with an instance ofSQL Server "y using the standard pipe 1pipes!l!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 andspecify a server nae e)plicitly, you are using either a network pipe or another networkinterprocess counication 1;52 echanis, such as nternetwork ;acket-)changeCSe!uenced ;acket -)change 1;DCS;D2 1assuing you have configured SQLServer to use ultiple networks2. Because a stand0alone SQL Server does not supportnetwork pipes, you ust oit the unnecessary /Sserver5na$earguent when connectingto the instance of SQL Server fro a client. /or e)aple, to connect to a stand0alone

    instance of SQL Server fro os$l, type7os$l /Usa /P

    Stopping SQL Server

    ou can stop an instance of Microsoft SQL Server locally fro the server orreotely fro a client or another server. f you stop an instance of SQL Server withoutpausing it, all server processes are terinated iediately. Stopping an instance of SQLServer prevents new connections and disconnects current users.

  • 8/12/2019 Administrating SQL Server

    6/7

    %he following ta"le descri"es the availa"le ethods for stopping an instance of SQLServer.

    Method #escription

    SQL Server -nterpriseManager

    Stops a local or reote instance of SQL Server or a SQLServer Agent service.

    SQL Server Service Manager Stops a local or reote instance of SQL Server or a SQLServer 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$lor another !uery tool. Esing the #%? $:#A% optionstops an instance of SQL Server iediately.

    net stop ss!lserver Stops an instance of SQL Server either reotely or locally ifyou are running the Microsoft #indows $% &.' or#indows (''' operating systes. %o stop a naed

    instance of SQL Server (''', you ust enter net stopss!l+instancenae fro the coand propt.

    5ontrol ;anel Stops an instance of SQL Server using the Servicesapplication in 5ontrol ;anel.

    5%3LF5 Stops an instance of SQL Server if it was started as aprogra fro the coand propt.

    #hen you stop an instance of SQL Server, the server perfors these services "efore itshuts down74isa"les logins 1e)cept for syste adinistrators2.

    ;erfors a 5?-5G;:$% in every data"ase. ?owever, if you stop an instance of SQLServer using 5%3LF5 at the coand propt, it does not perfor a 5?-5G;:$% inevery 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"

    3I5 "!3AI statement +rom the os$l utility'

    o stop SQL ServerEnterprise 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 SQLServer 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 shuttingdown.

    After an appropriate interval, proceed to Step I.

  • 8/12/2019 Administrating SQL Server

    7/7

    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 orthe 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 datafro 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 reoteserver. 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 naesof 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 appropriateinterval, 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 perfora checkpoint in all data"ases. %hen a S?E%4:#$ #%? $:#A% is done to flush allcoitted data fro the data cache and to stop the server iediately. Stopping adefault instance of SQL Server fro the coand propt works only if you are runningMicrosoft #indows $% &.' or #indows ('''.