SQL Command to Start/Stop SQL services for multiple server

From Central server I want to Start/Stop SQL services and SQL Agent service. Is there any SQL command which I can execute on query analyzer which can Start/Stop SQL services?
Rahul

See command line options here using net start
http://msdn.microsoft.com/en-IN/library/hh403394.aspx
You can invoke them using xp_cmdshell from management studio as
ie like below for default instance
EXEC xp_cmdshell 'net start MSSQLSERVER'
EXEC xp_cmdshell 'net start SQLSERVERAGENT'
etc
and below for named instance
EXEC xp_cmdshell 'net start MSSQLSERVER$instancename'
EXEC xp_cmdshell 'net start SQLSERVERAGENT$instancename'
etc
and use net stop for stopping services
EXEC xp_cmdshell 'net start MSSQLSERVER' EXEC xp_cmdshell 'net start SQLSERVERAGENT' etc
EXEC xp_cmdshell 'net start MSSQLSERVER' EXEC xp_cmdshell 'net start SQLSERVERAGENT' etc
EXEC xp_cmdshell 'net start MSSQLSERVER' EXEC xp_cmdshell 'net start SQLSERVERAGENT' etc
Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs

Similar Messages

  • Start and stop windows service for multiple remote computers

    Hello,
    Can someone show me how to Start and Stop windows service for multiple remote computers using Command Prompt or PowerShell or even Java?
    Thank you

    You asked a pure Windows related question at a pure Java related forum. We have advised you to look for a Windows related forum to post the question. Nothing special. It's like asking a car mechanican to help you with your migraine, he would advise you to look for a general practitioner.
    But why are you so surprised and negative about this answer after all? Don't we have to help you? Don't you appreciate help? So be it then, but please stay away then if you keep this attitude.

  • Command to Start/Stop "Windows File Sharing" on OsX Tiger Client

    Dear Mac Gurus:
    How to use command to start/stop “Windows File Sharing” on OSX Tiger client?
    Thanks!
    Max

    Hi Max,
    Windows file sharing requires two daemons, nmbd and smbd. They can be started/stopped as follows:
    To start (type the following all in a single line):
    sudo launchctl load -w /System/Library/LaunchDaemons/nmbd.plist /System/Library/LaunchDaemons/smbd.plist
    To stop:
    sudo launchctl unload -w /System/Library/LaunchDaemons/nmbd.plist /System/Library/LaunchDaemons/smbd.plist
    The option "-w" indicates that the default setting (whether start them at boot time or not) is also modified (the same effect as you turn them on/off via System Preferences -> Sharing). This means, if you start them and shutdown your Mac without stopping them, then they will be automatically restarted next time you reboot the Mac.
    If you use "load -F" instead of "laod -w", then they are started but the default setting is not modified (if it is off then remains off).
    If you use "unload" instead of "unload -w", then they are stopped the default setting is not modified (if it is on then remains on and will be started at next reboot).
    If you feel the commands are too long to type, then you can devide them into two commands, for example:
    sudo launchctl load -w /System/Library/LaunchDaemons/nmbd.plist
    sudo launchctl load -w /System/Library/LaunchDaemons/smbd.plist
    See launchctl man page for more detail.
    HTH
    PowerMacG4, PowerBookG4, iMac(C2D)   Mac OS X (10.4.9)  

  • After i installed updates for my mac mini server, the web services for the server app wont start, it gives an error massage: "Error Reading Settings"

    After i installed updates for my mac mini server, the web services for the server app wont start, it gives an error massage: "Error Reading Settings"
    The system logs reads:
    Mar 29 22:06:25 server servermgrd[82]: servermgr_web:  Error Domain=XSServerFoundationErrorDomain Code=4 "Failed to read settings: Exception:
              undefined method `downcase' for nil:NilClass
              ." UserInfo=0x7fc547901080 {NSLocalizedDescription=Failed to read settings: Exception:
              undefined method `downcase' for nil:NilClass

    To check the local network for some of the common configuration problems, launch Terminal.app and issue the following diagnostic command:
    sudo changeip -checkhostname
    That'll report some local configuration information and then either no errors detected and no changes required, or it'll point to whatever configuration errors or issues it might detect.  That doesn't catch everything, but it catches the common errors.
    FWIW, 192.168.0.0/24 and 192.168.1.0/24 are poor choices for the local network, as VPNs are based on IP routing and IP routing gets tangled when the same subnet is used on both ends of the VPN. 192.168.0.0/24 and 192.168.1.0/24 are near ubiquitous in home networks and coffee shops.

  • How to check/start/stop hardening Service?

    Dear All,
    I want to check on Solaris 10 whether it has hardening service or not, and also want to start/stop this service.
    Please give any idea or advice.
    Thanks and regards,
    Heng

    Hi Heng,
    System hardening requirements changes from environment. So It should be designed to suit your infrastructure. The topic is too big to discuss here.
    I will give some examples of major things done in hardening.
    User level Security.
    1) Password complexity
    2) Restrict multiple login attempts.
    3) Log all failed login attempts
    4) configure pam module
    5) Use RBAC to deligate
    6) Restrict root login to console only.
    7) disable passwordless logins to any users
    8) disable services like rsh rlogin and related services and restrict access through ssh only.
    9) ENABLE & Configure BSM
    10) Enable Auditing
    11) disable/lock all unused system accounts.
    12) enable password encryption (/etc/shadow)
    Network Security
    1) Disable all unwanted services. (svcadm disable service on solaris 10)
    2) disable unused nonsecure services like telnet, ftp etc.
    3) tcpwrapers (restrict the network communication to the required subnets only)
    4) disable unwanted inetd services
    etc etc etc... discussed very few things from the normal hardening, and these things vary from environment to environment.
    Regards
    JKGN
    Edited by: 878434 on May 25, 2012 1:16 AM

  • Seperate NT service for App server and Process Scheduler

    Is it possible to create a separate NT service for App server and Process Schedule for the same environment? Everytime i need to shutdown either App Domain or Prcs Domain (not both) using service, it brings down both.
    I could use psadmin but services run as a different user.
    Please advise.

    What PeopleTools release are you using?  Off the top of my head, one strategy would be to use different PS_CFG_HOMEs for the App and the Process scheduler.  The service points to the PS_CFG_HOME and reads the pswinsrv.cfg file to know what to start/stop.  I'm not sure there is a way to override psntsrv and tell it to use a different config file, so you may need a different HOME.  You could also create a script that wraps the service start/stop.  It could edit/update the config file prior to stop/start and remove Process Scheduler from the config and then reinsert it later.
    You could have a stop_app/start_app and stop_prcs/start_prcs script that would copy in specific versions of the pswinsrv.cfg file for what you want to do.

  • Install window services for managed server

    hi all, i wanted to install window services for managed server. Can anyone advice me how to do it? My weblogic version is 10. Thanks in advance.

    Hi,
    Please refer to the following link....it might be helpful: http://weblogic-wonders.com/weblogic/2010/03/13/managed-server-as-windows-service/

  • Start / Stop your xMII 11.5 Server with a Widget !

    <b><a href="/people/abesh.bhattacharjee/blog/2007/04/23/start-stop-your-xmii-115-server-with-a-widget">Start / Stop your xMII 11.5 Server with a Widget !</a></b>
    Download it <a href="https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/webcontent/uuid/b05124b1-70d4-2910-99b7-ab6626d31aac [original link is broken]">here</a>...

    Hi Tim,
    try to open the Java Web Start program (should be in C:\Program Files\Java\j2re1.4.2_07\javaws\javaws.exe), go to File > Preferences and under the 'Proxies' section in the  'General' tab, select 'None'.
    Then close all open browser windows and try again...
    Note that disabling proxy servers in the Java Web Start tool will not affect normal Java Applets, which are handled by the Java browser plugin which comes with its own proxy configuration screen. If you company uses a proxy between its LAN and the net, the above setting will stop your uses from running any Java Web Start applications, such as BLE, but  not very many people use these anyways, so the impact should be minimal.
    Good luck,
    Sascha
    P.S. If your users also have the JDK, then the javaws.exe binary is also found in C:\j2sdk1.4.2_07\jre\javaws.
    Message was edited by:
            Sascha Wenninger

  • AD Management Gateway Service for Windows Server 2008 SP2

    Hey,
    I'm having the same issue as in this thread.
    https://social.technet.microsoft.com/forums/windowsserver/en-US/93be1866-8aa8-4004-be95-113b7a4faef2/ad-management-gateway-service-for-windows-server-2008-sp2
    And trying to follow the 5 step procedure listed in the 3rd post, but am stuck on step 5, getting the hotfix from Microsoft. The link posted from the Hotfix page is just a generic Microsoft Support page. Which is not helpful. How do I actually contact them
    (phone # or email address) to get the software?
    Thanks In Advance,

    No luck. I've tried the chat which asks which Windows version Im using and there's no Server 2008 only desktop versions. I called and after talking with 3 people I got cut off. There has to be an easier way to get a simple file downloaded.
    You can hire me to do it for you.  I am always successful at contacting MS Support. 
    You didn't follow the instructions I  posted.
    Reach us over the phone at 1-800-642-7676 (TTY: 1-800-892-5234)
    http://smallbusiness.support.microsoft.com/en-us/contact/
    Click Technical Support for Chat.                     
    GREAT BIG BLUE BUTTON SAYS "Technical Support" - CLICK IT AND SELECT WINDOWS SERVER AT THE BOTTOM OF THE LIST.
    It is really that easy.
    ¯\_(ツ)_/¯

  • JNDI Lookup for multiple server instances with multiple cluster nodes

    Hi Experts,
    I need help with retreiving log files for multiple server instances with multiple cluster nodes. The system is Netweaver 7.01.
    There are 3 server instances all instances with 3 cluster nodes.
    There are EJB session beans deployed on them to retreive the log information for each server node.
    In the session bean there is a method:
    public List getServers() {
      List servers = new ArrayList();
      ClassLoader saveLoader = Thread.currentThread().getContextClassLoader();
      try {
       Properties prop = new Properties();
       prop.setProperty(Context.INITIAL_CONTEXT_FACTORY, "com.sap.engine.services.jndi.InitialContextFactoryImpl");
       prop.put(Context.SECURITY_AUTHENTICATION, "none");
       Thread.currentThread().setContextClassLoader((com.sap.engine.services.adminadapter.interfaces.RemoteAdminInterface.class).getClassLoader());
       InitialContext mInitialContext = new InitialContext(prop);
       RemoteAdminInterface rai = (RemoteAdminInterface) mInitialContext.lookup("adminadapter");
       ClusterAdministrator cadm = rai.getClusterAdministrator();
       ConvenienceEngineAdministrator cea = rai.getConvenienceEngineAdministrator();
       int nodeId[] = cea.getClusterNodeIds();
       int dispatcherId = 0;
       String dispatcherIP = null;
       String p4Port = null;
       for (int i = 0; i < nodeId.length; i++) {
        if (cea.getClusterNodeType(nodeId[i]) != 1)
         continue;
        Properties dispatcherProp = cadm.getNodeInfo(nodeId[i]);
        dispatcherIP = dispatcherProp.getProperty("Host", "localhost");
        p4Port = cea.getServiceProperty(nodeId[i], "p4", "port");
        String[] loc = new String[3];
        loc[0] = dispatcherIP;
        loc[1] = p4Port;
        loc[2] = null;
        servers.add(loc);
       mInitialContext.close();
      } catch (NamingException e) {
      } catch (RemoteException e) {
      } finally {
       Thread.currentThread().setContextClassLoader(saveLoader);
      return servers;
    and the retreived server information used here in another class:
    public void run() {
      ReadLogsSession readLogsSession;
      int total = servers.size();
      for (Iterator iter = servers.iterator(); iter.hasNext();) {
       if (keepAlive) {
        try {
         Thread.sleep(500);
        } catch (InterruptedException e) {
         status = status + e.getMessage();
         System.err.println("LogReader Thread Exception" + e.toString());
         e.printStackTrace();
        String[] serverLocs = (String[]) iter.next();
        searchFilter.setDetails("[" + serverLocs[1] + "]");
        Properties prop = new Properties();
        prop.put(Context.INITIAL_CONTEXT_FACTORY, "com.sap.engine.services.jndi.InitialContextFactoryImpl");
        prop.put(Context.PROVIDER_URL, serverLocs[0] + ":" + serverLocs[1]);
        System.err.println("LogReader run [" + serverLocs[0] + ":" + serverLocs[1] + "]");
        status = " Reading :[" + serverLocs[0] + ":" + serverLocs[1] + "] servers :[" + currentIndex + "/" + total + " ] ";
        prop.put("force_remote", "true");
        prop.put(Context.SECURITY_AUTHENTICATION, "none");
        try {
         Context ctx = new InitialContext(prop);
         Object ob = ctx.lookup("com.xom.sia.ReadLogsSession");
         ReadLogsSessionHome readLogsSessionHome = (ReadLogsSessionHome) PortableRemoteObject.narrow(ob, ReadLogsSessionHome.class);
         status = status + "Found ReadLogsSessionHome ["+readLogsSessionHome+"]";
         readLogsSession = readLogsSessionHome.create();
         if(readLogsSession!=null){
          status = status + " Created  ["+readLogsSession+"]";
          List l = readLogsSession.getAuditLogs(searchFilter);
          serverLocs[2] = String.valueOf(l.size());
          status = status + serverLocs[2];
          allRecords.addAll(l);
         }else{
          status = status + " unable to create  readLogsSession ";
         ctx.close();
        } catch (NamingException e) {
         status = status + e.getMessage();
         System.err.println(e.getMessage());
         e.printStackTrace();
        } catch (CreateException e) {
         status = status + e.getMessage();
         System.err.println(e.getMessage());
         e.printStackTrace();
        } catch (IOException e) {
         status = status + e.getMessage();
         System.err.println(e.getMessage());
         e.printStackTrace();
        } catch (Exception e) {
         status = status + e.getMessage();
         System.err.println(e.getMessage());
         e.printStackTrace();
       currentIndex++;
      jobComplete = true;
    The application is working for multiple server instances with a single cluster node but not working for multiple cusltered environment.
    Anybody knows what should be changed to handle more cluster nodes?
    Thanks,
    Gergely

    Thanks for the response.
    I was afraid that it would be something like that although
    was hoping for
    something closer to the application pools we use with IIS to
    isolate sites
    and limit the impact one badly behaving one can have on
    another.
    mmr
    "Ian Skinner" <[email protected]> wrote in message
    news:fe5u5v$pue$[email protected]..
    > Run CF with one instance. Look at your processes and see
    how much memory
    > the "JRun" process is using, multiply this by number of
    other CF
    > instances.
    >
    > You are most likely going to end up on implementing a
    "handful" of
    > instances versus "dozens" of instance on all but the
    beefiest of servers.
    >
    > This can be affected by how much memory each instance
    uses. An
    > application that puts major amounts of data into
    persistent scopes such as
    > application and|or session will have a larger foot print
    then a leaner
    > application that does not put much data into memory
    and|or leave it there
    > for a very long time.
    >
    > I know the first time we made use of CF in it's
    multi-home flavor, we went
    > a bit overboard and created way too many. After nearly
    bringing a
    > moderate server to its knees, we consolidated until we
    had three or four
    > or so IIRC. A couple dedicated to to each of our largest
    and most
    > critical applications and a couple general instances
    that ran many smaller
    > applications each.
    >
    >
    >
    >
    >

  • Creating a Business Service for Start/Stop Application Service in CCB 2.3.1

    Hi,
    I'm in the process of creating a BPA script that invokes a Business Service to perform a Start/Stop for a given Account ID/Premise ID combination. The Business Service is using the base Application Service: Start Stop (CILCSSEP). I am moving the Account ID and Premise ID, along with the start date and requested by fields to the data area of the Business Service, prior to invoking it. When I invoke the Business Service via the BPA script, it throws the below error message... I'm at a loss because the BILL_ADDR_SRCE_FLG is being set to a default of "PREM" on the Business Service Schema:
    A Bill Address Source is required on the address override record. Please enter a valid value.
    One of these two is true:
    1) The Bill Route Type on this record has a Bill Routing Method of 'Postall', or
    2) The main customer on the Account has a Quote Route Type with a Quote Routing Method of 'Postal'.
    In either case, the Bill Address Source must be populated with a valid value.
    If you need support please supply the following info to system support:
    Message number: 3, 59204
    Business Service: CMSTARTSERVICE
    Application Service: CILCSSEP
    Schema:
    <schema pageAction="fastChange">
    <accountId mapField="ACCT_ID"/>
    <df mapField="DEFAULT_FOR_FLG"/>
    <startDate mapField="STRT_START_DT"/>
    <startOption mapField="STRT_TYPE_FLG"/>
    <premiseId mapField="STRT_PREM_ID"/>
    <premAddress mapField="ADDRESS1"/>
    <premCity mapField="CITY"/>
    <startCisDiv mapField="STRT_CIS_DIVISION"/>
    <startReqBy mapField="STRT_STRT_REQ_BY"/>
    <bldStrtSaSw mapField="BUILD_START_SA_SW" default="true"/>
    <accountIdtwo mapField="ACCT_ID2"/>
    <mainCustPerId mapField="MAIN_CUST_PER_ID"/>
    <billFrmtFlg mapField="BILL_RTE_TYPE_CD" default="POSTAL" private="true"/>
    <billAddrSrcFlg mapField="BILL_ADDR_SRCE_FLG" default="PREM"/>
    <billAddrSrcFlg2 mapField="BILL_ADDR_SRCE_FLG2" default="PREM"/>
    <startStopTelephoneOverride type="list" mapList="OVRD_PHONE">
    <accountId mapField="ACCT_ID"/>
    <sequence mapField="SEQ_NUM"/>
    <phoneType mapField="PHONE_TYPE_CD"/>
    <internationalPrefix mapField="COUNTRY_CODE"/>
    <phone mapField="PHONE"/>
    <extension mapField="EXTENSION"/>
    <version mapField="VERSION"/>
    </startStopTelephoneOverride>
    <startBtn mapField="ACTION_START_SW" default="true" private="true"/>
    </schema>
    I'm running CC&B 2.3.1 - Any help in pointing me in the right direction to get this working would be greatly appreciated, Thanks!
    Regards,
    Jack

    Hi,
    Can you try and do this transaction online and see if the error occurs as well? If so run it with traces on and check for the details just before the error is thrown. ( you can also switch on debug via the service call, but it may be easier to debug when doing this online. ) I am predicting this error will occur also when you do it online.
    When you are using an Account with its main Person set up with BILL_ADDR_SRC_FLG as PREM you will need a valide PREM_ID on the CI_ACCT record for MAILING_PREM_ID and the premise needs to have a switch set to YES indicating it is a Mailing Address type Premise.
    Good luck
    Arjen

  • Start and Stop of Services for 11x

    hi
    Can anyone please let me know the order to stop and start the services of 11x (HSS,PLANNING,ESSBASE and BI)
    Haven't found any documentation to in the portal related to start and stop of the services.
    thanks in advance
    Best regards
    krishnatilak

    I take it you mean the order to start/stop services.
    You can find the list at :- http://download.oracle.com/docs/cd/E12825_01/epm.111/epm_install/ch05s02.html
    Cheers
    John
    http://john-goodwin.blogspot.com/

  • Start / Stop Window services

    Hi,
    I would like to start and stop window services on remote computer.
    Do you know if there is a package API in java to do it?
    How can I do it?
    Thanks,
    Anat

    Look for www.jscape.com
    you can ftp or telnet to the computer, then start the command for that service
    this is the code for ftp
    * FtpExample.java
    * Created on 01 March 2007, 10:30
    * To change this template, choose Tools | Template Manager
    * and open the template in the editor.
    package testing;
    * @author Administrator
    import com.jscape.inet.ftp.*;
    import java.io.*;
    import java.util.Enumeration;
    public class FtpExample extends FtpAdapter {
        private String hostname;
        private String username;
        private String password;
        public FtpExample(String hostname, String username, String password) {
            this.hostname = hostname;
            this.username = username;
            this.password = password;
        // print out directory listing
        public void getListing() throws FtpException {
            Ftp ftp = new Ftp(hostname,username,password);
            //capture Ftp related events
            ftp.addFtpListener(this);
            ftp.connect();
             ftp.setDir("www");
            String results = ftp.getDirListingAsString();
            System.out.println(results);
            ftp.disconnect();
        // captures connect event
        public void connected(FtpConnectedEvent evt) {
            System.out.println("Connected to server: " + evt.getHostname());
        // captures disconnect event
        public void disconnected(FtpDisconnectedEvent evt) {
            System.out.println("Disconnected from server: " + evt.getHostname());
        public static void main(String[] args) {
            String hostname;
            String username;
            String password;
            try {
                FtpExample example = new FtpExample("ftplocation e.g 192.168.0.1","username","password");
                example.getListing();
            }catch(Exception e) {
                e.printStackTrace();
    }

  • Mail service on start/stop of services ...

    Hi,
    Please let me know the way to send mail when services are started/stopped in oracle application 11.5.10.2. How to configure this on ibm aix 5.3.
    Thanks,
    Sai Ram

    There is a way to configure emails on startup/shutdown of Concurrent Manager service - but I'm not aware about any such configuration around other services (eg. Apache, Apps Listener, Forms Server etc..)
    I think you'll have to do this outside Oracle's scripts if you wish to set this up - either by wrapping the calls to seeded scripts in your own custom script, or if you want a periodical probing, then via use of cron/scheduler depending on the OS you're on.
    Hope that helps.
    Regards,
    Rakesh
    PS : In addition to the Concurrent Managers, I think you should be also able to achieve this for database services if you wish to do that - by use of startup and shutdown database triggers.

  • JDBC: send batch of SQL commands as anonymous PL/SQL block

    Hi All,
    I did a little measurement to see if I can improve jdbc
    applications by batching dissimilar SQL commands into one
    anonymous PL/SQL block and execute it once. To my surprise, for
    a batch of 5 SQL commands, it take 60% more time than execute
    each of the 5 SQL commands separately.
    The same JDBC code, using similar SQL text batching, running
    against Sybase or MSSQL shows 60%-300% improvement.
    Is there any other way to batch dynamic dissimilar SQL commands
    in Oracle other than using anonymous PL/SQL block? Here is an
    example of how the "text-batching" PL/SQL block looks like:
    "begin insert into testtab1(col1, col2) values(1, 'row1');
    insert into testtab2(col1, col2) values(100, 1);....; end;"
    Thanks,
    Nam Nguyen
    null

    If you do:
    declare
    l_sql varchar2(32767);
    l_value varchar2(32767);
    begin
    select query_sql into l_sql from lov where lov_id = 100;
    dbms_output.put_line(l_sql);
    end;
    You'll see something like that:
    SELECT
    l.DESCRIPTION || decode(l2.DESCRIPTION,null,'',l2.description, '-' || l2.description) || decode(a.DT,'Y',' - Distributed Training','N',null,null) as value1
    FROM ACTIVITY a
    ,MOUNTAINEERING m
    ,LOV l
    ,LOV l2
    WHERE a.JSATFA_ID = 82
    AND a.SPECIFIC_ACTIVITY_LOV_ID = l.LOV_ID
    AND m.ACTIVITY_ID(+) = a.ACTIVITY_ID
    AND m.CLASSIFICATION_LOV_ID = l2.LOV_ID(+);
    you need to duplicate the '
    you can do many things like:
    CTH@> select * from sqls;
    C
    select first_name || ' ' || last_name as value1 from employees where rownum=1
    1 fila seleccionada.
    CTH@>
    CTH@> ;
    1 declare
    2 l_sql varchar2(32767);
    3 l_value varchar2(32767);
    4 type generic_cursor is ref cursor;
    5
    6 c generic_cursor;
    7
    8 begin
    9 select replace(c, ''', ''''') into l_sql from sqls;
    10
    11 execute immediate l_sql into l_value;
    12 dbms_output.put_line(l_value);
    13* end;
    CTH@> /
    Ellen Abel
    Procedimiento PL/SQL terminado correctamente.
    CTH@>

Maybe you are looking for