Executing A Reboot Command From SQL

Jul 20, 2005

Here is the block of the sproc that I?ve created. All lines execute
fine except for the ?exec master..xp_cmdshell @reboottc?. In order to
make this work from the query analyzer I had to set the MSSQLSERVER
service to have the same credentials as the thin clients we are trying
to shut down, that means the service is running as an Administrator on
the sql server with the same u/p as administrator on thin clients.


declare @RoomNumber varchar(6) -- for testing

set @RoomNumber = '1144' -- for testing

DECLARE @RoomIP varchar(15), @RebootTC
varchar(120), @shutdownStart varchar(20), @shutdownEnd varchar(85)



-- @ShutDownStart and @ShutDownEnd will be used
with the @RoomIP to build the shutdown command sent to the thin
clients

SET @ShutDownStart = 'shutdown -r -f -m \'

SET @ShutDownEnd = ' -t 5 -c "Mandatory
iConnect Reboot issued during guest check in/out process"'



SELECT @RoomIP = IP FROM Rooms WHERE
RoomNumber = cast(@RoomNumber AS INT)



SET @RebootTC = @ShutDownStart + @RoomIP +
@ShutDownEnd



-- print @RebootTC -- for testing



-- @RebootTC ends up looking like the line below based on the
@RoomNumber

-- shutdown -r -f -m \172.18.16.103 -t 5 -c "Mandatory iConnect
Reboot issued during guest check in/out process?

-- Also the command below runs correctly when executed from SQL Query
Analyzer


EXEC master..xp_cmdshell @RebootTC

View 1 Replies


ADVERTISEMENT

SQL Server Admin 2014 :: How To Disable Reboot Pending Through Command

Mar 16, 2015

Any command through that can I delete/disable the DWORD value "Pendingfilerename operations" so that while I start the SQL Install work, it does not fail due to this and can write this as one of the precheck options.

View 0 Replies View Related

Sql Command Executing Trigger

Jan 5, 2004

hi.
I must get i trigger the sql command, which execute trigger.

View 5 Replies View Related

System Views To See Sql Command Executing

Jan 31, 2006

Hello,

can someone tell me where I can look to find a sql command that
is being executed by an application against my database?
In Oracle, I look in the v$sql_text view - is there something
similar in SQL Server 2000 ?
Many thanks in advance

View 2 Replies View Related

Executing SQL Script From Command Promt Not Working

Dec 30, 2003

Hello
I am trying to execute SQl script from command prom like this :


C:Inetputwwwroot> osql -U sa -P -i MyComics.sql


(uid=sa and pwd=)

and I got the result like this :


[Shared Memory]SQl Server deos not exist or access denied
[Shared Memory]Connection Open (Connect()).



I already check the SQL server , it's running.
what do I do now?

Thanks in advance

View 3 Replies View Related

Package Executing As SQL Service Job Vs Command Line

Jan 8, 2008

I see a weird behaviour when the package is executed as a SQL Server job and via command line. The package has environment variables configured. So when I run the package via a command line it picks up the user environment variables and gets executed fine with success. But when the package is scheduled as a job, it fails as it is not picking up environment variables. Does the SQL server has to be restarted to pick up the environment variables? I dont understand the reason of not picking up the environment variables when the package is run as a job. The job runs as the same user as the command line and the user variables are set for the environment variables. The logging is enabled on the package and I can see that it is logging as the same user even if its command line execution or executed as a job. Could you please anyone can explain why the package fails as a job and doesnt fail via command line. I am fighting with this for a long time.

Thanks

View 5 Replies View Related

Executing A Command From Within SSIS Script COmponent

Jan 3, 2008

I'm trying to use an SSIS script component that will go do a DNS lookup on the contents of an input column. I've already got a vbs function that performs the wshshell.exec and parses the answer for address and/or errors. I'm having trouble with syntax for the call. When I attempt to run it, I get a lot of errors like "Name 'wshell' is not declared", "StdErr" is not a member of 'String'"

Does anyone have an example of a script that calls a command?

I'm fairly new to SSIS, but think I've properly set up the inputs and outputs.

View 9 Replies View Related

OLE DB Source Executing SQL Command Multiple Times

Jan 2, 2008



Happy new year everyone!!!


Ok, now for my not so happy new year problem ... here's the scenario:

I have a simple task of exporting data retrieved by a parameterized stored procedure to a delimited text file ... task done in 30 mins max using dataflow task from OLE DB Source with SQL Command to Text File Destination ... thank you very much SSIS!

But the problem is the OLE DB Source executed the SP MULTIPLE TIMES (3 to be exact)
Actually configuration is:

1. OLE DB Source
2. SQL Command access mode
3. The following command written in the command text box:

SET FMTONLY OFF;
exec sp_SampleSP @param1=?, @param2=?
4. Configured parameter mapping.

The stored procedure logs to a database table everytime it is executed to report how many rows were selected (please don't crucify me with this method, i'm re-using procs from old system). The log shows that during execution of this package the SP was executed on 3 times.

Help anyone? Please ...

View 5 Replies View Related

SQL Server 2008 :: Executing Query / SPs Through Command Line

Sep 23, 2015

How do I execute below scripts using CMD:

Please Note: SQL server 2008r2, default instance with window Authentication.

1. Select * from Adventurewoks2008.Person.Person where Id = 5

2. Exec usp_getemployee (with parameter Manager_id = 100)

3. I have a folder named 'MyFolder' which contains 3 store procedures (usp_A, usp_B and usp_C).

How do I execute all 3 using CMD against AdventureWorks database.

View 9 Replies View Related

Executing Multi-lines SQL Scripts From Command-line

Jul 20, 2005

Hello,I'm trying to execute a file containing few SQL statements.CREATE VIEW test1 AS SELECT * FROM table1;CREATE VIEW test2 AS SELECT * FROM table2;The standard SQL way is to end a statement with semi-colon.But doing that,it doesn't work in SQL Server.After changing ";" to "GO", it works fine.Is there anyway we can stick to ";" to indicate the end of statement.I don't want to create scripts which works only in SQL Server.Please comment.Thanks in advance.

View 3 Replies View Related

Timeout Error When Executing SQL Command From The Script Task

Apr 18, 2008



The SQL query takes about 4 minutes to execute in SQL Management Studio. But when I run it from the Script Task using the OleDBCommand, I got the timeout error in 40 seconds. The timeout setting on the SSIS DB connection is 0. I do not see how to set the timeout for an SSIS task. Any thoughts on this problem? TIA.

View 8 Replies View Related

Stored Procedure Executing Durations Are Different Between Executing From Application(web) And SQl Server Management Studio - Qu

Jan 24, 2008



Hi,

I have a web application using Stored Procedure (SP). I see that there's a SP taking long time to execute. I try to capture it by Profiler Tool, and find out that with the same SP on the same db with the same parameter. The duration of executing by my web app is far bigger than the duration of executing on SQl server management studio - query window

Please see the image through this url http://kyxao.net/127/ExecutionProblem.png


Any ideas for this issue?

Thanks a lot

View 1 Replies View Related

Stored Procedure Executing Durations Are Different Between Executing From Application(web) And SQl Server Management Studio - Query Window

Jan 23, 2008

Hi,I have a web application using Stored Procedure (SP). I see that there's a SP taking long time to execute. I try to capture it by Profiler Tool, and find out that with the same SP on the same db with the same parameter. The duration of executing by my web app is far bigger than the duration of executing on SQl server management studio - query windowPlease see the image attached http://kyxao.net/127/ExecutionProblem.png Any ideas for this issue?Thanks a lot Jalijack 

View 2 Replies View Related

Different Results When Executing From .NET Component Compare To Executing From SQL Management Studio

Oct 10, 2006

Hi all,I am facing an unusual issue here. I have a stored procedure, that return different set of result when I execute it from .NET component compare to when I execute it from SQL Management Studio. But as soon as I recompile the stored procedure, both will return the same results.This started to really annoying me, any thoughts or solution? Thanks very much guys

View 2 Replies View Related

The Need To Reboot SQL 2000

Mar 26, 2002

Our NT person thinks that rebooting the SQL 2000 (on WIn 2000) server every month is a good idea (this is a client production box). I am strongly against it. For starters any trends I am trying to capture with performance monitor become useless every time we do this. I am willing to listen to every one's opinion, but I hope by now that SQL 2000 is stable enough not to have to do this.

View 1 Replies View Related

Server Reboot

Oct 15, 2004

I seem to recall somewhere that a Microsoft Windows Server (2000 for example) should be rebooted once a week.

Is this an urban myth? If so....I can't seem to find a doc on it.

googled:

microsoft server maintenance reboot schedule recommendation

thoughts?

View 2 Replies View Related

To Reboot The Server

Jan 25, 2006

I'm very new to SQL Server. I need to reboot the server for some reason. I need your help to list out what a the step that I need to follow to perform this process.

Regards,
Ilmi

View 5 Replies View Related

After Reboot, Some Db Were Detached, Some Not.

Aug 22, 2007

After reboot, some db were detached, some not.
How come?

View 3 Replies View Related

Server Reboot

Jul 23, 2005

Hello,I have a server running Windows 2000 Advanced and Sql Server. Thesystems runs fine throughout the day but reboots at night, somtimesmultiple times. The event log has a message that reads "The previoussystem shutdown at X:XX PM was unexpected."Any ideas?Paul

View 3 Replies View Related

Reboot Notification

Jul 20, 2005

Hi all,I wanted SQL server to sent me an email when it reboots. I created an Alertbut doesn't seem to be working. Any suggestions.Thanks,

View 1 Replies View Related

MSDE Installation Without Reboot

Aug 5, 2004

Hi all, I'm trying to install MSDE in silent mode and without using a .ini file (on a machine with windows 2000 server and SQL 2000 already insatalled).
At the end of the installation, the machine reboot automatically, but I need to stop this reboot.
Someone can help me?
Thanks all

View 2 Replies View Related

How To Reboot A Publication Server ?

Jul 16, 2004

We have to add some hardware and I was wondering if someone could provide a stepwise tip to do it .

It is a 3 Server Environment Pub/Dist/Sub
All three running under SQL2K
Here is what I am planning.

a. Uncheck the Enable in Distributed Agent for each replication
b. Wait for all replications to complete
c. Shut down Publisher ? Or do I have to do something else before that.

Please explain a little .

Thanks

View 2 Replies View Related

SQL 2005 Reboot Schedule

Apr 28, 2008

Do you guys reboot your SQL 2005 servers at a set schedule? If so, how often are you rebooting the servers?

-A

View 2 Replies View Related

Connection Problem After Reboot

May 24, 2007

I've just rebooting the db server and I've currently got 82 connections open to the server. vb6 apps connect fine but .Net apps are sruggling - sa is sql200 query analyzer. they can't get a connection to the server - it just hangs for ages. any idea?

View 2 Replies View Related

Best Practice: How Often To Reboot SQL Server

Feb 15, 2008

An IT dept. I have been consulting with has started to reboot SQL server every night. They are saying that this is the best practices. I would like to know if anyone has any other ideas on this subject. What is the best practices for how often a SQL server should be rebooted, daily, weekly, monthly ... ?

Thanks

View 9 Replies View Related

Pending Reboot Requirement

Feb 20, 2007

I just installed SP2. I wanted to install the AdventureWorksDW database as part of the Database Engine Tuning Advisor tutorial. It said my install was not finished and I had a "pending reboot requirement." I shut down, and 8 different updates ran. When I tried to install the AdventureWorksDW database again, I got the same message. I'll see if there are still more updates to run.

View 10 Replies View Related

SQL2k5 SP1 Installation And Reboot

Feb 20, 2007

I installed SP1 for SS 2005 on a quasi-production server, which is why I didn't mind rebooting the server. Unfortunately, it's been 5 hours and the server still hasn't rebooted. (I see a gray screen and a pointer, and that's it... but there's still disk access happening. I'm not really sure what it's doing.)

What's the best way to avoid the 5 hour reboot in the future?

Thanks,
Robert

View 3 Replies View Related

Windows 2k Server Slow Reboot

Nov 7, 2002

It takes my server forever to reboot, does anyone know how to fix this or is this a problem with the system or just how it is? Thanks

View 12 Replies View Related

Service Manager Won't Start After Reboot

Jun 30, 2004

Got an issue:

I am running SQL Server 7.0 on a Web server and recently the SQL Server has been acting up. Basically what happens is every time the server is restarted the Service Manager fails to restart. I even get an error telling me that the service failed to start. So, when I log back in I have to physically restart the Service Manager. I have the services set to start automatically. Can anyone direct me where to look...perhaps a SQL Server log that might give me a clue. My application and error logs only tell me that it stops. Any ideas?

View 2 Replies View Related

Replication Stops After Server Reboot????

May 2, 2004

Hi,

I have transactional replication set up between two dedicated servers. Server A is the PDC and Server B is a BDC (they are both Win2000 boxes). Both the servers are brand new, and replaced the two that were running like clock work (replication wise) for the last 12 months. I never had this problem with the old servers....

When the servers are shut down (as the case was a couple of weeks back with a power failure) or just recently when they were move to another room. Both servers boot up at the same time. Server B (which is the server holding the db being replicated) boots quicker and as a result replication fails and is then 'sucessfully stopped'. Unless I am aware of the server being rebooted and can monitor this potential problem, within 2 days the logfile grows to large and everything comes to a crashing halt.

I just remove replication, truncate and shrink the log, reset replication and we're away.... BUT I really need to know why it is happening in the first place. I figure there must be a setting that I have forgotten about or something.

Both servers are Win2000 (SP4) and SQL2000(SP3a).

Any help would be appreciated.

Thanks
Casper

View 3 Replies View Related

Server Reboot Time In Tsql?

Feb 28, 2007

is there a way to find out when the sql server was last rebooted (or how long its been up) in tsql or command prompt (which I will take into tsql)

ta

View 7 Replies View Related

Unusually High CPU On SQL Server The 2nd Day After A Reboot.

Jul 23, 2005

To All,I have a SQL2KSP3a database(<1GB) running on a 4x3GB physical CPU with4GB of ram. It is Windows Server 2003 with hyper-threading turn on.There are ~420 .Net users/cxns (fat client, no web/app servers) withconnection pooling and ~1 trx/sec. The database growth is neglegeableand actually is not even relevent which I will explain in a minute.99% of the trxs are from one SP that does a select. The resultsets arerelatively small as well 1~100 rows. Yes I have tuned it with indextuning wizard as well, changed the SQL memory configurations, etc....My problem is this...The first day after a reboot, the server runs 6%CPU during peak hours.During the non-peak hours until the next day something apparentlyhappens. The next day (2nd day after a reboot), it jumps to 40%CPUduring peak hours. The server will continue to run at 40%CPU duringpeak hours until the next reboot. This phenomenon has been occurringfor 6 months or more and the traffic on the server is the same for day1 as it is for day 2,3,4,... This database was on another server with100+ dbs and exibited the same behavior, thus bringing that server toits knees, and thus we had to move it to the server in question with noother dbs.I have googled my eyes out, Microsoft site, white papers, perfmon,SQLDiag, PSSDiag, execution plans, index tuning wizard, and the listgoes on! I currently have a case open with Microsoft that has beenopen for months now. I have been passed around to the 3rd "MS TechSpecialist". I have ran PSSDiag a total of 6 times for them for hourson end. I have changed MAXDOP. I could give more information, but Iwould be here for days. I am running out of patience/ideas andMicrosoft is apparently blowing smoke.Any ideas are greatly appreciated!Thanks in advance!JL

View 10 Replies View Related

Guest User On Tempdb Gone After Reboot.

Jul 17, 2007

Everytime I reboot my sql server 2000 the guest account on tempdb is gone, but the guest account on master remains.



Can anyone offer my any ideas how I can stop that from happening?

View 4 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved