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


ADVERTISEMENT

Execution Time Gap Between Simple Tsql And Stored Procedure In SQl Server 2005

Oct 16, 2007

Hi ,

I ma using sql server 2005.I have a bunch of statements of sql and i have created a stored procedure for those. When i execute i found that there is lot's of difference between execution time of stored procedure and direct sql in query windows.

can anyone help me to optimize the execution time for stored prcedure even stored prcedure is very simple.
I have used sql server 2000 and i am new in sql server 2005.

View 1 Replies View Related

TSQL + VBA - Retrieve SQL SERVER 2000 Data Trough Excel 2003 - Time Out Error 80040e31

Sep 17, 2007

Hi guys,
When I thought everything is okay with this script, I got a new problem...
I have a VBA's script from Excel 2003 that builds sql script and retrieves data from SQL SERVER 2000.
in order to make the sql running, I need to use a multi - batch processing, to pass and execute every command line once a time.

Up to here, I am using a test case with Account number = '123456' and getting the desire results.
The code below is running okay with the test case, but when changing the account number (mark as yellow in the code) to include all the accounts (or just one other account), I am getting the following ERROR:
run - time error '-2147217871 (80040e31)' - [Microsoft] [ODBC SQL Server Driver] time out expired.

Now, if I take the same code, with the condition that generates the ERROR, and try it into SQL Server, I get the results without errors.
Thanks in advance,
Aldo.

Below the code:



Code Snippet
Function QuerySalesAging()
'--------------------------------------------------------------
'MUST !!! References: Microsoft ActiveX Data Object 2.1 Library
'--------------------------------------------------------------

Dim ConnString As New ADODB.Connection
Dim RecordSet As New ADODB.RecordSet

'Setting Connection String
Driver = "{SQL Server}"
ServerName = "SERVER"
DB_Name = CompanyName

ConnString = "Driver=" & Driver & ";" & "Server=" & ServerName & ";" _
& "Database=" & DB_Name & ";" & "Uid=" & SQLLoginName & ";" & "Pwd=" & SQLPassword & ";"

'Report Criterias
Criteria05 = " AND " & "Accounts.ACCOUNTKEY Between " & AccountKeyAsRange
' -- ==> With AccountKeyAsRange = '123456' AND '123456' it works okay.
' -- ==> With any other value, in example AccountKeyAsRange = '123456' AND '9999999999' it get's ERROR.

CmdLine01 = " USE " & CompanyName

' Check and drop temporary table
TemporaryTableName = "CTE" ' The table is a regular one
CmdLine02 = " if object_id('" & TemporaryTableName & "') is not null exec('DROP TABLE " & TemporaryTableName & "') "

CmdLine03 = " SELECT ..."
CmdLine03 = CmdLine03 & " INTO " & TemporaryTableName
CmdLine03 = CmdLine03 & " FROM ..."
CmdLine03 = CmdLine03 & " WHERE " & "(" & Replace(Criteria05, "AND", "") & ")"
CmdLine03 = CmdLine03 & " ORDER BY ..."

CmdLine04 = CmdLine04 & " ALTER TABLE " & TemporaryTableName ...

CmdLine05 = CmdLine05 & " UPDATE " & TemporaryTableName ...

CmdLine06 = CmdLine06 & " SELECT ..."
CmdLine06 = CmdLine06 & " FROM ..."

ConnString.Open
ConnString.Execute CmdLine01
ConnString.Execute CmdLine02

RecordSet.Open CmdLine01, ConnString
RecordSet.Open CmdLine02, ConnString
RecordSet.Open CmdLine03, ConnString
RecordSet.Open CmdLine04, ConnString
RecordSet.Open CmdLine05, ConnString
RecordSet.Open CmdLine06, ConnString

ConnString.Execute CmdLine01
ConnString.Execute CmdLine02 ' The debbuger stops here:" if object_id('CTE') is not null exec('DROP TABLE CTE') "
ConnString.Execute CmdLine03
ConnString.Execute CmdLine04
ConnString.Execute CmdLine05
ConnString.Execute CmdLine06
ConnString.Execute CmdLine02

'Retrieve Field titles
For ColNr = 1 To RecordSet.Fields.Count
ActiveSheet.Cells(1, ColNr).Value = RecordSet.Fields(ColNr - 1).Name
Next

ActiveSheet.Cells(2, 1).CopyFromRecordset RecordSet

'Cleanup & Close ADO objects
ConnString.Execute "USE master"
ConnString.Close
Set RecordSet = Nothing
Set ConnString = Nothing
End Function

View 1 Replies View Related

Equivalent Tsql For Sql Server 2000 Is Needed [from Sql Server 2005 Only Tsql]

Nov 19, 2007

Can anyone please give me the equivalent tsql for sql server 2000 for the following two queries which works fine in sql server 2005

1
-- Full Table Structure

select t.object_id, t.name as 'tablename', c.name as 'columnname', y.name as 'typename', case y.namewhen 'varchar' then convert(varchar, c.max_length)when 'decimal' then convert(varchar, c.precision) + ', ' + convert(varchar, c.scale)else ''end attrib,y.*from sys.tables t, sys.columns c, sys.types ywhere t.object_id = c.object_idand t.name not in ('sysdiagrams')and c.system_type_id = y.system_type_idand c.system_type_id = y.user_type_idorder by t.name, c.column_id


2
-- PK and Index
select t.name as 'tablename', i.name as 'indexname', c.name as 'columnname' , i.is_unique, i.is_primary_key, ic.is_descending_keyfrom sys.indexes i, sys.tables t, sys.index_columns ic, sys.columns cwhere t.object_id = i.object_idand t.object_id = ic.object_idand t.object_id = c.object_idand i.index_id = ic.index_idand c.column_id = ic.column_idand t.name not in ('sysdiagrams')order by t.name, i.index_id, ic.index_column_id

This sql is extracting some sort of the information about the structure of the sql server database[2005]
I need a sql whihc will return the same result for sql server 2000

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

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

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

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

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

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

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

How To Reboot A Clustered SQL Server Agent

Jun 11, 2007

If I am running SQL Server 2005 in a clustered environment, what is the safest way to restart the SQL server agent? It is currently running but I need to restart it for maintenance purposes.



Is the safeway way to restart is to login to the SQL Server Management Studio as the system administrator, select the SQL Server Agent object, right-mouse click and select "Restart?"

View 2 Replies View Related

How Often Should I Schedule A Reboot Of SQL Server 2005?

May 10, 2007

How many times per year should we schedule time to reboot a SQL Server 2005 Cluster? We want to do this to defrag the memory. What I am looking for is a document from Microsoft or a consulting firm that has a good reputation that I can show my manager.

View 7 Replies View Related

SQL Server 2014 :: Powershell Script To Find Windows Server Reboot Date

Oct 16, 2015

I am searching for a Powershell script which picks Windows Server names from SQL server table(eg: Instance.DB.tbServerList) & writes last reboot date to SQL server table(can be same or different table).

View 6 Replies View Related

SQl Server Backup Takes 2 Hours To Run But 12 Minutes After A Server Reboot(?)

Sep 19, 2007

Sorry i think i may have posted this in the incorrect forum before - if i have done it again here can someone tell me where i should post this please, thanks:

Hi,
we are having problems with a server Intel RZeon 3ghz, 3gb ram running 2003 service pack 2 with a 70gb drive and and 400 gb drive all with adequate free space. There are 6 hard disks in total and i assume operating at least RAID 5. We have SQL2000 server with a few standard sized databases and a connection to one other server.

A few months ago the back up of SQL server databases started taking 4- 5 hours when before it took 20 minutes. We had actually lost one of our disks in the RAID array and it before this was spotted by our engineers we reindexed the sql databases and defragged both 70gbC: and D: 400gb drives hoping to correct this slow down. Unfortunately the new disk had not been correctly seated and this was why it was taking 4-5 hours. After fixing the disk the backups took 12 minutes again but then started taking 2-3 hours after a few days.

The reindex/defrag did seem to improve the speed of the backups to 12 minutes (from 20 minutes) when the backup did function correctly (also the sql databases' performance improved). However the backups only take 12 minutes after a server reboot - this can last from only 2, up to 5 backups(days) in a row before a slow down to 2-3 hours and again only a reboot will sort out this problem.

NB this intermittent slowdown only occurred after the disk failure.

We have tried monitoring SQL server and can find no CPU/RAM intensive clashes or long running jobs interferring with the back up. Does anyone know what might be going on here? and if there are any server monitoring tools that may help us discover what is causing this problem ?

thanks for your help
best regards
kevin

View 11 Replies View Related

How Autorestart Sql Prifile Trace After Server Reboot ?

Sep 5, 2001

how autorestart sql prifile trace after NT server reboot or or after shotdown and restart of Sql server ?

thanks

View 1 Replies View Related

Server &#34;lock Up&#34; That Requires A Reboot To Recover

Feb 20, 1999

I have a situation that I was wondering if anyone has ever ran into before. It has to do with one of my MS SQL servers. The hardware is a ALR/Gateway 9000R with 4 PP200's, 1 Gb RAM, and a RAID 5 with 72 Gb storage. The NIC card is an ATM 155 Mbit card connected directly to our fiber backbone.

I have WinNT 4.0 Server Enterprise Edition loaded with SP4 and MS SQL Server 6.5 Enterprise Edition with SP5 installed.

I have 7 seperate active databases on the server supporting 7 different applications. The server has been on-line for approximately 4 weeks and just recently (last Thursday) it has started to "lock up" every couple of days. By lockup I mean that it starts to reject all requests by all users. No one can connect to the server including myself. The MS SQL error log grows and grows until we reboot the server. The error logs are 100 Mb or larger in size due to rejection errors being repeated over and over again.

There has been no change made to the server since initial installation.

The error in the MS SQL error log that keeps on being repeated is...
"Message 17308: Kernelerror - Lazywriter. Process (process ID number) generated access violation; SQL Server is terminating this process."

We have an incident in with Microsoft but they are not responding fast enough.

I was hoping that someone out there may have had this type of occurrance happen before.

Any suggestions?

Jim

View 1 Replies View Related

SQL Server 7 Switches To Windows Only Auth On Reboot

Jul 20, 2005

Hi All,I have a SQL Server 7 installation running on a windows 2000 server.SQL Server switches from mixed mode authentication to Windows Only onreboot. Has anyone else experienced this? Any help would be greatlyappreciated.Service Pack Reports:Microsoft SQL Server 7.00 - 7.00.1077 (Intel X86) Sep 6 200215:10:15 Copyright (c) 1988-2002 Microsoft Corporation StandardEdition on Windows NT 5.0 (Build 2195: Service Pack 3)I only see two strange entries in the log:2004-05-01 00:38:09.55 spid37 Using 'xpsqlbot.dll' version'1998.11.13' to execute extended stored procedure 'xp_qv'.2004-05-01 00:38:01.71 spid1 Failed to obtainTransactionDispenserInterface: Result Code = 0x8004d01bI don't believe that either of these are related to the configurationoption for Windows Only, though.

View 2 Replies View Related

SQL Server Service (express) Will Not Autostart On Reboot

Aug 22, 2007

This computer gets set to autostart the SQL Server Service, which is set to local, (have also tried local network and user specific), and everything works fine. But when it gets rebooted, the service refuses to start.

We disabled the Mcafee and Windows firewall. No effect.

The SQL Browser and Full Text Index Services start automatically just fine.

Anyone have any experience with this?


Thanks,
Pat

View 3 Replies View Related

SQL Server Services Stopping After System Reboot (URGENT)

Jun 3, 2002

Hello,
SQL Server 2000 services getting stoped automatically when system get reboot. When system reboot they started and after 5 minutes they were getting stoped.
I went through the event log file and found that an error is occuring in sql server with number 17148.

And I also observed that there is a file called "C : P r o g r a m F i l e s V E R I T A S B a c k u p E x e c N T b e n g i n e . e x e" is executing during the maintenance process,which is stopping the sql server services(agent and olap)

This problem is generating error in sql server with above mentioned number.

regards,
vnk.

View 1 Replies View Related

SQL 2012 :: Analysis Server Database Disappears After A Reboot

Apr 23, 2015

I do not understand why an SSAS cube disappears after a reboot. We schedule a reboot for our server weekly and after the reboot. I have to deploy my SQL server Analysis Database. It is just gone after a reboot and why this happened. I searched a lot on internet but it seams that I am the only one on this world with this issue.

How I can configure the server in such a way that the SSAS cubes will not disappear after a reboot.

View 2 Replies View Related

Strange Reverting On SQL Server 2000 System Reboot.. HELP!

Nov 9, 2007

Hi I've got a sql server 2000 database that when running is runnign fine. About 9 months ago I altered one of the stored procedures and ever since then when the machine is rebooted the stored procedure is "reverted" back to the old sproc... ???
is there any way I can recrete a sproc in a job that runs every day?? why would it be doing this?

View 1 Replies View Related

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

DB Engine :: Reboot / Restart Service After Setting Max Server Memory

Apr 29, 2015

After I have set the maximum sql server memory in sql server 2014 using sp_configure, do I need to reboot whole server or restart sql service?

View 4 Replies View Related

Setup And Upgrade :: Reboot Required To Server To Add SSRS To One Of Many Instances Already Installed?

Jun 9, 2015

Have a production server, 12 Enterprise, and we are adding a new app to an existing instance.  Next app needs SSRS and that was not put in the install request a year ago for the instance.  

I do not think a reboot is required but have been wrong before. There are no SPs applied to this server and only last week we were given go ahead from one app vendor to apply SPs.  That would have been done in monthly maintenance cycle next weekend.  Our test server is doing just fine with all apps on SP1.

View 3 Replies View Related

Recovery :: Restoring AlwaysOn AG (Primary) Server After Reboot Automatically (failback)

May 29, 2015

We have several Sql Server 2014 AlwaysOn Availability Groups set up in our test lab and use a combination of SCDPM and Maintenance Plans to back up the databases in them. 

Our applications always work well regardless of which of the physical servers are, at any given time, designated the "Primary" for a database.  Automatic failover works fine.

There are other applications, such as SQL Server built-in backup and System Center DPM that only work properly when the databases are currently hosted where originally intended.

During the normal course of Windows Updates, etc., machines will occasionally be rebooted in the middle of the night.  When they come back up, we would like them to "reclaim" the databases that properly belong to them, in an orderly fashion of course (when the "Synchronization State = Sychronized").  We have lots of these test servers and we do not have staff watching the servers in the middle of the night.

Is there an automatic way to accomplish this?

View 8 Replies View Related

SQL Server Makes Our Server Reboot!

Jul 20, 2005

hi,we are having this weird problem that can be reproduced easily on 2out of 2 servers where we've tried:- we run a SQL Server 2000 stored procedure that processes 2.5 millionrows (big procedure with many cursors)- when it hits an area of procedure (not always the exact same place,but in the same area) , the server rebootsI've tried to debug the problem but:- there are no event log except when it restarts to say 'previoussystem shutdown unexpected'- the blackbox trace I've created is empty- the perfmon log stops a few seconds before the reboot and shows noout of whack counter- we've had the hardware checked by an IT guy and everything looksfineThe only thing we can see that might have changed is that the disksand data files were reorganized ..but that's on one machine. On theother machine were we copied the database to test, we did not do thatand it still rebooted.I've also run DBCC CHECKDB and everything looks fine. I've scanned allthe hard drive for bad sectors. We've tested the CPUs for overheating.I've monitored the virtual memory to make sure there was enough.Any help will be appreciated, we are out of ideas!!thanksGuillaumeps: we are using win2000/SP4 and SQLServer 2000 SP3

View 3 Replies View Related

SQL Server 2014 :: Gathering Stored Procedure Execution Time In Real Time?

Jun 11, 2015

Is there a way to keep track in real time on how long a stored procedure is running for? So what I want to do is fire off a trace in a stored procedure if that stored procedure is running for over like 5 minutes.

View 5 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

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

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

SQL Server 2008 :: Displaying Transaction Time Punch Data In A Time Card Form?

Oct 7, 2015

I have a table called employee_punch_record that we use to store employee time clock punches.

The columns are:

employeeid,
punch_timestamp,
punch_type (In / Out),
closed (bit used as status for open or closed pay periods),
ident

Here are some examples of a record:

bkingery62015-10-06 16:59:04.000In0
bkingery72015-10-06 16:59:09.000Out0
bkingery82015-10-06 16:59:13.000In0
bkingery92015-10-06 18:22:44.000Out0
bkingery102015-10-06 18:22:46.000In0
bkingery112015-10-06 18:22:48.000Out0
bkingery122015-10-06 18:22:51.000In0
tfeller52015-10-05 17:00:05.000In0

We are using SQL Server 2008 as our database and use Access as a GUI. I am looking to create a form in Access where employees can access their time card and request changes from management. I want to use the format from the attached screen shot for the form. I pretty much know how to do it all, the only point of complication is trying to figure out the easiest way to get the transaction punch record data on employee_punch_record into a format where I can easily populate the form in the horizontal format you see in the screen shot.

I am not super strong in SQL, but figure I can do it using a formatting table of some sort. quick and easy way to move transaction records into a more horizontally oriented record?

View 0 Replies View Related







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