?
Solved

Determine the last time a database was accessed

Posted on 2003-10-23
8
Medium Priority
?
279 Views
Last Modified: 2012-10-18
Is there a way to tell when the last time that a certain database was accessed is in SQL Server 2000?  I'm not a DBA, it's just kind of a side thing that I've been stuck with (I'm a programmer).
0
Comment
Question by:mnashadka
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
8 Comments
 
LVL 19

Assisted Solution

by:Dexstar
Dexstar earned 120 total points
ID: 9610439
mnashadka,

> Is there a way to tell when the last time that a certain database was accessed
> is in SQL Server 2000?

Well, there is a way, but I'm not sure you'll like it.  You can enable security auditing for SQL Server which log all the accesses to the NT Event Log.  Then you can programmatically audit the log to determine when that database was accessed.  If you think that solution will work for you, I can go into how to do it in more detail.

Hope that helps,
Dex*
0
 
LVL 8

Author Comment

by:mnashadka
ID: 9610471
Thanks Dexstar.  But if I do that, it won't help me retroactively determine when a database that hasn't been accessed in a while is accessed.  Also, the event logs will get huge if I have to save them for a month or so.  Is there any other way?

Thanks again.
0
 
LVL 15

Expert Comment

by:namasi_navaretnam
ID: 9611703
I have not had any issues DTS from Excel to MS SQL Server. But I often use a funcky way to import data from excel to MS SQL Server.

For Example, say I have data listed below in a spreadsheet
Col1  Col2   Col2       Col4
1       A       XXXX    
2       B       YYYY


For Col4, I use excel function CANCATENATE to come up with a sql statement concatenating values in the other columns

=CONCATENATE( " INSERT INTO MYTBALE (COL1, COL2, COl3) VALUES (", A1, ",'", B1, "','", C1,"')" )

Then copy the column 4 data to Query explorer and execute it. The data is imported.

You may want to use this method if nothing helps.

Namasi.

0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 8

Author Comment

by:mnashadka
ID: 9611811
Namasi, how does that help me determine the last time a database was accessed?
0
 
LVL 15

Expert Comment

by:namasi_navaretnam
ID: 9613345
Sorry, I have answered the wrong question. This is the answer for a different question.
0
 
LVL 15

Assisted Solution

by:namasi_navaretnam
namasi_navaretnam earned 120 total points
ID: 9613378
I am not sure if there is a sql or command to find out. Can you not check the dat and time MS SQL SERVER data file was modified. But this was not the date and time database was accessed, but modified.
0
 
LVL 30

Accepted Solution

by:
nmcdermaid earned 135 total points
ID: 9613658
You could use profiler to audit database logins. Tell Profiler to export the data to a file then process the file.

I think you can also use performance monitor/Trace logs to audit SQL logins, and save that to a file, also you can automaitcally truncate the file and do stuff like that.
0
 
LVL 8

Author Comment

by:mnashadka
ID: 9614307
Namasi, that's not really accurate.  The timestamp only gets updated when it gets flushed, or when you back up and truncate the data.  I'll look at using the profiler.  Thanks to all for your help.
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
Ever wondered why sometimes your SQL Server is slow or unresponsive with connections spiking up but by the time you go in, all is well? The following article will show you how to install and configure a SQL job that will send you email alerts includ…
Via a live example, show how to setup several different housekeeping processes for a SQL Server.
Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.
Suggested Courses

800 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question