SQL Server uptime, Database uptime ?
Is there a way, preferably with T-SQL, to query how long the SQL Server service has been running?
Also how long a particular database has been running (i.e. when it was last set online)?
I'm hoping for something simpler than querying the SQL errorlog, especially as that could be cycled to a point where this info is no longer present
CheersMCITP: Database Administrator 2005 / 2008
I agree querying ERROR LOG could be painfull
However since SQL2005 Microsoft introduced the default trace , this is running permanently unless you specify to stop it
so you can query it and this one is pretty interesting
So to track when SQL server has been stopped or started :
SELECT TE.name AS [EventName] ,
V.subclass_name ,
T.LoginName ,
T.StartTime ,
T.SessionLoginName
-- Get the current path of the default trace and will add 'log.trc' at the end so that
-- every traces files that are still on this path will be used for the query result
FROM dbo.fn_trace_gettable(( SELECT REVERSE(SUBSTRING(REVERSE(path),CHARINDEX('\',REVERSE(path)),256)) + 'log.trc'
FROM sys.traces
WHERE is_default = 1
), DEFAULT) T
JOIN sys.trace_events TE ON T.EventClass = TE.trace_event_id
JOIN sys.trace_subclass_values V ON V.trace_event_id = TE.trace_event_id
AND V.subclass_value = T.EventSubClass
WHERE TE.name IN ( 'Audit Server Starts And Stops' )
ORDER BY T.StartTime ASC
Similar Messages
-
Migrating from MS SQL Server 2005 database to Oracle 10g
Hello,
I wanted the full procedure or steps to Migrate the MS SQL Server 2005 database to Oracle 10g. Is there a known procedure to do this or is there a tool which is used?
I have not done migration of database from MS SQL Server to Oracle. Any help is appreciated. Thanks a lot for the time.
Regards,
RPSWrong forum, go to the database forum!
cu
Andreas -
How to restore SQL Server 2008 database to SQL Server Express 2012
How to restore SQL Server 2008 database to SQL Server Express 2012.
I BACKED UP a SQL Server 2008 database from work, which runs the enterprise version of 2008, and I tried to RESTORE it to my new 64-Bit home PC which is running the new SQL Server Express 2012 64-Bit (Advanced Edition).
But if fails. I get the following message text.
Can anyone help me please. I thought restoring a 2008 database to the later version 2012 would be possible.
Here is the error message. Thanks.
TITLE: Microsoft SQL Server Management Studio
Restore of database failed. (Microsoft.SqlServer.Management.RelationalEngineTasks)
ADDITIONAL INFORMATION:
System.Data.SqlClient.SqlError: The database was backed up on a server running version 8.00.2039. That version is incompatible with this server, which is running version 11.00.3128. Either restore the database on a server that supports the backup, or use a
backup that is compatible with this server. (Microsoft.SqlServer.SmoExtended)ADDITIONAL INFORMATION:
System.Data.SqlClient.SqlError: The database was backed up on a server running version 8.00.2039. That version is incompatible with this server, which is running version 11.00.3128. Either restore the database on a server that supports the
backup, or use a backup that is compatible with this server. (Microsoft.SqlServer.SmoExtended)
Are you sure your database is SQL server 2008 from error message it seems your SQL server version is 2000.I guess you have multiple versions of SQL server.
AFAIK you cannot restore backup of SQL server 2000 to 2012 directly .Restore it first to SQL 2008/2008R2 or 2005 then take backup again of new database created and then you would be able to restore it on 2012.Its kind of intermediate way
Also make sure your DB size is less than 10 G as max DB size supported by Express edition is 10 G and if your DB size is more than 10 G restore will fail.
You are also trying to restore enterprise DB backup on express edition so you will loose enterprise features on express edition
Please mark this reply as the answer or vote as helpful, as appropriate, to make it useful for other readers -
How to set the CLASSPATH for an Sql Server 2005 database... help me please
Hello! Guys I want to access a Sql Server 2005 database from Java.I've downloaded the JDBC 2.0 driver from Microsoft.I've copied the sqljdbc4.jar file to C:\Java\jdk1.6.0_14\db\lib.And I've added this to the classpath C:\Java\jdk1.6.0_14\db\lib\sqljdbc4.jar.The classpath variable is defined as a user variable.Well the point is that I get that nasty exception:Exception in thread "main" java.lang.ClassNotFoundException: com.microsoft.sqlserver.jdbc.SQLServerDriver.So if you know how to help me,please do so.Thank you :)
Hi Timo,
My jdev version is 10.1.3.3.0, this is for R12. By PR i mean to say process request and PFR process form request in the controller.
In the Process request of the controller, i am finding the checkbox bean and assigning the firepartialaction for it.
Later in the process form request for the fired event, i am trying to handle the rendered property of the messagetextinput. Is this a right approach?
my code below
public void processRequest(OAPageContext oapagecontext, OAWebBean oawebbean)
super.processRequest(oapagecontext, oawebbean);
OAApplicationModule oaapplicationmodule = oapagecontext.getApplicationModule(oawebbean);
OAMessageCheckBoxBean oamessagecheckboxbean = (OAMessageCheckBoxBean)oawebbean.findChildRecursive("X_FLAG");
if(oamessagecheckboxbean != null)
oapagecontext.writeDiagnostics(this, "Message check box Bean found:", 1);
FirePartialAction firepartialaction = new FirePartialAction("change");
oamessagecheckboxbean.setAttributeValue(PRIMARY_CLIENT_ACTION_ATTR, firepartialaction);
oamessagecheckboxbean.setFireActionForSubmit("change", null, null, true);
oapagecontext.writeDiagnostics(this, "setting fire event", 1);
public void processFormRequest(OAPageContext oapagecontext, OAWebBean oawebbean)
super.processFormRequest(oapagecontext, oawebbean);
oapagecontext.writeDiagnostics(this, "Inside Process Form Request", 1);
if("change".equals(oapagecontext.getParameter(OAWebBeanConstants.EVENT_PARAM)))
OAMessageTextInputBean bean = (OAMessageTextInputBean)oawebbean.findChildRecursive("X_NUMBER");
if(bean!=null){
bean.setRendered(Boolean.TRUE);}
Thanks,
Malar -
Get an image from a varbinary field in an SQL Server 2005 database
Hi:
In a varbinary(MAX) field of an SQL Server 2005 database I
storage JPG images. I design a webservice that returns the
following XML structure:
Public Class IMAGEN
Public ErrorConsulta As Long
Public Imagen As Byte()
End Class
The response look like this:
<FLEXOBTENERIMAGENResponse>
<FLEXOBTENERIMAGENResult>
<IMAGEN>
<ErrorConsulta>0</ErrorConsulta>
<Imagen>/9j/4AAQSkZJRgABAQEAYABgAAD/2wBDAAgGBgcGBQgH....</Imagen>
</IMAGEN>
</FLEXOBTENERIMAGENResult>
</FLEXOBTENERIMAGENResponse>
Where the node Imagen are thousands of caracters that
represents the JPG image.
How can I show this JPG in an Image control of a Flex Builder
2 or 3?
If you need more information please let me know.
Thanx in advance.Assuming that you have text fields storing the Y N then on
the output you
have a code block like this
<%
If recordset.fields.item("wheelchair").value = "Y" then
%>
<img src="images/wheelchair.gif">
<%End if%>
However is your field is set to be a Yes/No type then the
best way is to
write the test like this
If recordset.fields.item("wheelchair").value = TRUE then
Paul Whitham
Certified Dreamweaver MX2004 Professional
Adobe Community Expert - Dreamweaver
Valleybiz Internet Design
www.valleybiz.net
"Lancs" <[email protected]> wrote in message
news:e6srl5$jul$[email protected]..
> Using ASP/VBscript and Access
> I'm making a page that dislays a listing of
organisations (using Repeated
> Regions) concerned with disabilities. I want to use
images for symbols
> that
> indicate whether, for example, an organisation uses
textphones, has
> wheelchair
> access, and the like. I'm using a form to add new
records to the database.
> I
> want the form to allow users to select the applicable
symbols using
> checkboxes.
> What code will allow the listing page to interpret a Y
value as an image
> path
> and ignore a N value.
> Thanks
> -
Replication SQL Server 7 Database to Oracle 9i
Hi -
I'm new to Database Replication, what are the steps for database replication from a MS SQL Server 7 database to Oracle 9i? Eventually this SQL Server Database will be going to SQL Server 2000 are the steps different, if so what are they?
Thanks
MuchI do not what you mean with Replicate between SQL Server and Oracle. Perhaps you mean migrate from SQL Server to Oracle or to stablish a transparent gateway.
I am going to give you this reference:
Migration Workbench Reference Guide for Microsoft SQL Server and Sybase Adaptive Server Migrations Contents / Search / Index / PDF
Heterogeneous Connectivity Administrator's Guide Contents / Search / Index / PDF
http://otn.oracle.com/pls/db92/db92.docindex?remark=homepage
Joel P�rez -
SQL Server 2000 database GETDATE() default for field
I have a SQL Server 2000 database where the createDate field
has a default value of GETDATE() and the data type is datetime. It
is inserting the date just fine, but I do not want to capture the
time along with the date. I only want the date to be entered. How
can I accomplish this? Thanks!IF you only wanted to store the date, then yes you would use
that as the column default value.
createDate datetime default convert(datetime,
convert(varchar, getDate(), 102), 102)
However, as paross1 cautioned be sure you understand you will
only be capturing the date from now on. If you change your mind
later, and decide you need both the created date and time, you will
be seriously out of luck. A safer choice might be to keep the date
and time, and use convert in your queries instead. -
Tell me how to format a date retrieved from a MS SQL Server 2000 database?
Tell me how to format a date retrieved from an MS SQL Server 2000 database for various uses in my JSP page?
Or if you want to use JSTL instead of a scriptlet see:
http://forum.java.sun.com/thread.jspa?threadID=676754&tstart=0 -
Manipulate data of a SQL SERVER 2000 database
Problem:
I need to manipulate data of a SQL SERVER 2000 database that itâs installed in a Windows
from an oracle 8.1.7 database that is installed in a red hat linux server.
This access has to be made in a procedure created in this Oracle instance.
The Solutionâs Environment:
- oracle 8.1.7 database - red hat linux server - ORCL INSTANCE
- SQL SERVER 2000 version 5.0 database - Windows server - SQLSERV INSTANCE
- Oracle 8.1.7 database - windows 2000 professional server - HSDB INSTANCE
We did the following steps:
1) We installed an oracle database 8.1.7 in the windows 2000 professional.
The name of this instance is HSDB.
2) We configured the HSODBC resource in this HSDB instance so as to access the SQLSERVER database.
3) It was created a database link in the ORCL instance (LINUX) so as to access the oracle HSDB instance
4) It was created a procedure in the ORCL instance that insert data into the SQLSERVER database using the database link.
This procedure pass through the following instances:
ORCL Instance (database link) => HSDB Instance (HS Resource) => SQLSERV Instance
5) When I execute this simple procedure of the ORCL Instance, the process takes a long time. Although if I run this insert on a SQL Plus, the transaction ends fast. Why itâs happening?
PROCEDURE PRC_TESTE(P_CD_CMC7 IN VARCHAR2) IS
BEGIN
BEGIN
INSERT INTO VSolicitacaoRetirada@MSSQLDB
("CMC7")
VALUES
(P_CD_CMC7);
EXCEPTION
WHEN OTHERS THEN
DBMS_OUTPUT.PUT_LINE('ERROR '||SQLERRM);
END;
COMMIT;
END;
TranksI modified the PRC_TESTE procedure and worked fine when I made the following change.
In spite of using the P_CD_CMC7 parameter on the INSERT command, I included a fixed value. Althoug I can´t use this fixed value. What it can be?
Example:
CREATE OR REPLACE PROCEDURE PRC_TESTE(P_CD_CMC7 IN VARCHAR2)
IS
BEGIN
BEGIN
INSERT INTO VSolicitacaoRetirada@MSSQLDB
("CMC7")
VALUES
('123456');
EXCEPTION
WHEN OTHERS THEN
DBMS_OUTPUT.PUT_LINE('ERRO NO INSERT '||SQLERRM);
END;
COMMIT;
END;
------------------------------------------------------------ -
Problem converting captured SQL Server 2000 database to Oracle
Java(TM) Platform 1.6.0_17
Oracle IDE 2.1.1.64.45
Versioning Support 2.1.1.64.45
After creating MWREP user, granting it privileges and creating the migration repository, I have captured a small SQL Server 2000 database (1 table), but after performing "Convert to Oracle", I get the message that it has transformed correctly, but no converted model is shown. I was originally using the JRE supplied with SQL Developer 2.1.1, but replaced that with 1.6 U17 after researching the problem here.
The only message in the Migration Log is as follows:
Catalog RAC, Schema dbo coalesced to single schema dbo_RAC
The following message appears in the console:
SELECT DISTINCT(REF_ID_FK), REF_TYPE FROM MD_ADDITIONAL_PROPERTIES WHERE PROP_KEY IN (?) AND CONNECTION_ID_FK = ?
I have tried this with a more complex database, with no luck.
Any thoughts?I did an offline capture.
I used Tools->Migration->Third Party Database Offline Capture->Create Database Capture Scripts to generate scripts OMWB_OFFLINE_CAPTURE.BAT, SS2K_BCP_SCRIPT.BAT and sqlserver2000.ocp. Then the SQL Server DBA ran OMWB_OFFLINE_CAPTURE.BAT and sent me the output.
I used Tools->Migration->Third Party Database Offline Capture->Load Database Capture Scripts Output to capture the model into the repository successfully. -
The error below makes absolutely no sense! I'm using Enterprise Core...yet I'm being told I can't use remote data sources:
w3wp!library!8!03/05/2015-19:08:48:: i INFO: Catalog SQL Server Edition = EnterpriseCore
w3wp!library!8!03/05/2015-19:08:48:: e ERROR: Throwing Microsoft.ReportingServices.Diagnostics.Utilities.OperationNotSupportedException: , Microsoft.ReportingServices.Diagnostics.Utilities.OperationNotSupportedException: The feature: "The edition of Reporting
Services that you are using requires that you use local SQL Server relational databases for report data sources and the report server database." is not supported in this edition of Reporting Services.;
Really? This totally contradicts the documentation found here:
https://msdn.microsoft.com/en-us/library/ms157285(v=sql.110).aspx
That article says remote connections are completely supported.
ARGH! Why does this have to be so difficult to setup?!?Hi jeffoliver1000,
According to your description, you are using Enterprise Core edition and you are prompted that you can’t use remote data sources.
In your scenario, we neither ignore your point nor be doubt with what you say. But actually we have met the case before that even though the SQL Server engine is Enterprise but the reporting services is still standard. So I would recommend you to find the
actual edition of reporting services you are using. You can find Reporting Services starting SKU in the Reporting Service logs ( default location: C:\Program Files\Microsoft SQL Server\<instance name>\Reporting Services\LogFiles). For more information,
please refer to the similar thread below:
https://social.technet.microsoft.com/Forums/en-US/f98c2f3e-1a30-4993-ab41-acbc5014f92e/data-driven-subscription-button-not-displayed?forum=sqlreportingservices
By the way, have you installed the other SQL Server edition before?
Best regards,
Qiuyun Yu
Qiuyun Yu
TechNet Community Support -
Can Reporting Services 2005 report on SQL Server 2012 database?
We would like to upgrade our SQL Server from Standard 2005 to Enterprise/Standard 2012. Unfortunately, we also have a lot of reports based on Reporting Services 2005. If possible we would like avoid upgrading them at this time.
Is it possible to run Reporting Services 2005 of SQL Server 2012? If yes then is there pre-requiste like drivers or dll or any other to connect SSRS 2005 to SQL server 2012?
If we run Reporting Services 2005 of SQL Server 2012 then do we will face performance lag issue due to version difference of SSRS 2005 and SQL server 2012?Moderators,
Can anyone merge this -
http://social.msdn.microsoft.com/Forums/sqlserver/en-US/2c44351c-35b4-4208-a2b7-88fc810d53ff/can-reporting-services-2005-report-on-sql-server-2012-database?forum=sqlreportingservices
sathya - www.allaboutmssql.com ** Mark as answered if my post solved your problem and Vote as helpful if my post was useful **. -
Inserting date from a jsp into sql server 2005 database
Dear Friends.,
i have a jsp page, in that there is a form with various user input fields. in that one field is date field. i tried to insert the date field into the sql server 2005 database. but it is not getting inserted into the database.
when i tried by inserting one field to database, it is getting inserted. for all the fields its works fine, except the date field.
i need hint or code to insert the date get from the jsp page to database.
i am using a servlet to do all database related things. i.e making connections, executing prepared statement queries
thanks
sekar.The variable needs to be outside of the string to be recognized as a variable. You need to remove the variable from the string, then concatinate it onto the string (and concatinate any remaining string parts - the closing paren). For example:
stmt.executeUpdate("INSERT INTO table VALUES ('test', " + companyID + ")");
Hope that's clear enough and helps. Good luck on your thesis!
jim -
Free SQL server 2005 Database administration book
Hi,
From where we can download SQL server 2005 Database administration book
Thanks & Regards,
RajHi,
This not the download forum for book, please don't post such query in this forum.
if you have any basis related query then post it here.
regards,
kaushal -
How do I configure Tuxedo 8.1 with SQL Server 2005 database?
Hi,
Currently using Tuxedo 8.1 (64bit) on SUN Solaris 8.
1. I want to know whether I can configure a SQL Server 2005 database in my current Tuxedo domain?
2. Are there any BEA useful links for examples?
3. Known problems?
Any other useful information
Regards SamHi
Thanks for your reply.
I build the TLOG using following:
tmadmin ?c
crdl -b 500 -z c:\tuxedo\envs\sqlpoc\tlogs\TLOG
tmadmin
crlog -m simple
Built the TMS using the following:
buildtms -v -r SQL_SERVER -o TMS_SQLSERVER
When trying to boot the TMS_SQLSERVER, get the following error (TRACE is switched on):
113626.W039133!TMS_SQLSERVER.exe.3180.3184.0: 08-08-2007: Tuxedo Version 8.1, 32-bit
113626.W039133!TMS_SQLSERVER.exe.3180.3184.0: LIBTUX_CAT:262: INFO: Standard main starting
113626.W039133!TMS_SQLSERVER.exe.3180.3184.0: TRACE:ia: { tpsvrinit(14, "C:\TUXEDO\envs\sqlpoc\bin\TMS_SQLSERVER.exe -C dom=simpapp -g 500 -i 30001 -u W039133 -U C:\TUXEDO\envs\sqlpoc\logs\ULOG -m 0 -A")
113626.W039133!TMS_SQLSERVER.exe.3180.3184.0: TRACE:ia: { tpopen()
113626.W039133!TMS_SQLSERVER.exe.3180.3184.0: TRACE:xa: { xa_open(0x90026c, 0, 0x0)
113632.W039133!TMS_SQLSERVER.exe.3180.3184.0: TRACE:xa: } xa_open = -3
113632.W039133!TMS_SQLSERVER.exe.3180.3184.0: LIBTUX_CAT:466: ERROR: tpopen TPERMERR xa_open returned XAER_RMERR
113632.W039133!TMS_SQLSERVER.exe.3180.3184.0: TRACE:ia: } tpopen = -1 [tperrno TPERMERR]
113632.W039133!TMS_SQLSERVER.exe.3180.3184.0: TRACE:ia: } tpsvrinit = -1 [tperrno TPERMERR]
113632.W039133!TMS_SQLSERVER.exe.3180.3184.0: LIBTUX_CAT:250: ERROR: tpsvrinit() failed
113632.W039133!TMS_SQLSERVER.exe.3180.3184.0: LIBTUX_CAT:300: ERROR: tlogopen: gptblopen: UNIX sys call error - 2
113632.W039133!tmboot.3132.2844.-2: 08-08-2007: Tuxedo Version 8.1, 32-bit
113632.W039133!tmboot.3132.2844.-2: CMDTUX_CAT:825: ERROR: Process C:\TUXEDO\envs\sqlpoc\bin\TMS_SQLSERVER.exe at simple failed with /T tperrno (TPERMERR - resource manager error)
113632.W039133!TMS_SQLSERVER.exe.3284.3528.0: 08-08-2007: Tuxedo Version 8.1, 32-bit
113632.W039133!TMS_SQLSERVER.exe.3284.3528.0: LIBTUX_CAT:262: INFO: Standard main starting
113632.W039133!TMS_SQLSERVER.exe.3284.3528.0: TRACE:ia: { tpsvrinit(14, "C:\TUXEDO\envs\sqlpoc\bin\TMS_SQLSERVER.exe -C dom=simpapp -g 500 -i 30002 -u W039133 -U C:\TUXEDO\envs\sqlpoc\logs\ULOG -m 0 -A")
Can anyone help?
Thanks -
Save .PSR to SQL Server 2005 database
Hi all,
I want to store certain invoice printouts in .psr format, into an SQL Server 2005 database so that the users can retrieve the psr and have the reports displayed. I am using PB 11.5.
I can save it in an external file OK (using SaveAs - PSReport!).
I am puzzled for the following.
How to save it in the database.
Also it would be more than 32kb so FileRead will have issues to create a single file (?).
What is the best datatype to use for SQL Server?
How do I retrieve it to use it? (FileRead and then create external file with FileWrite?)
Has anyone done it before? Any recommendations, samples, guidelines are more than welcome!
Thanx in advance!Hi Panos,
Here's a proc I tested that inserts a blob into a table aaa(id uniqueidentifier pk, rpt varbinary(max))...
CREATE PROCEDURE sp_aaa
@blob varbinary(max)
AS
Declare @li_return_code int
select @li_return_code = 1
BEGIN TRY
insert aaa (id, rpt) values ( newid(), @blob)
select @li_return_code
END TRY
BEGIN CATCH
declare @li_error_code integer,
@li_error_line integer,
@ls_error_proc varchar(40),
@ls_error_msg nvarchar(2048)
select @li_error_code = ERROR_NUMBER()
select @ls_error_msg = ERROR_MESSAGE()
select @li_error_line = ERROR_LINE()
select @ls_error_proc = ERROR_PROCEDURE() + ' Line: ' + convert(varchar(4), @li_error_line)
select @ls_error_msg = @ls_error_msg + char(13) + ' Proc: ' + @ls_error_proc + char(13) + ' Error Code: ' + convert(varchar(4), @li_error_code) + char(13) + ' Line: ' + convert(varchar(4), @li_error_line) + char(13);
/* Rethrow the exception */
THROW 51000, @ls_error_msg, 1
END CATCH
Here's the transaction object rpc declaration for the proc...
function long sp_aaa(blob blob) RPCFUNC ALIAS FOR "dbo.sp_aaa"
Here's the func that calls the rpc...
integer li_ret
TRY
li_ret = this.sp_aaa( ab_blob)
commit;
CATCH
( exception ex)
li_ret = -1
rollback;
messagebox('DB ERROR', ex.getmessage())
END TRY
return li_ret
Here's the call from the window...
blob lb_blob
integer li_rtn, li_filenum
long ll_bytes
string docpath, docname[]
li_rtn = GetFileOpenName("Select File", docpath, docname[], "PSR", + "PSR Files (*.PSR),*.PSR," + "All Files (*.*), *.*", "", 18)
IF li_rtn = 1 THEN
li_filenum = FileOpen(docpath, StreamMode!)
ll_bytes = FileReadEx(li_filenum, lb_blob)
Fileclose(li_filenum)
sqlca.of_insert_blob(lb_blob)
END IF
hth,
Mark
Maybe you are looking for
-
What should I do when iPhone says "iPhone Is Disabled"?
I'm using an iphone 4s with a latest update (ios7). I tottaly forgotten the pasccode. I couldn't recall the password even after a day of thinking. My iphone ended up showing " iPhone is disabled" after several times of entering the wrong password. Th
-
How to dynamic order of groups & How to fetch data at runtime from database
Post Author: ferikpatel CA Forum: Formula I am using visual studio .net application having inbuilt crystal report feature. Now, what I want to do is, i have create 5 groups in crystal report, but dynamically want to change the order of those reports
-
Okay, here's something that I've never experienced before, and it happened after installing the 10.5.2 update. I can scan an image to the HP Photosmart Studio with no problem. However, when I hit "accept," and the final scan is saved to whatever imag
-
JDeveloper Error: White spaces are required between publicId and systemId.
I'm using JDeveloper 10.1.3.1.0. This error is occurring in a BPEL process project. With one particular web service I have, adding a Partner Link to the BPEL generates the following compile error: Error: White spaces are required between publicId and
-
Unsupported feature in Mass Case Tester
Hi, I am getting an unsupported feature error in Mass Case Tester when I am trying to use reference data for priming my rulebase. Please let me know what could be the possible cause of this error. Is the use of reference data not supported in the cur