Solved

Determine the last time a database was accessed

Posted on 2003-10-23
8
276 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 40 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
Free eBook: Backup on AWS

Everything you need to know about backup and disaster recovery with AWS, for FREE!

 
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 40 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 45 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

Technology Partners: 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!

Question has a verified solution.

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

Having an SQL database can be a big investment for a small company. Hardware, setup and of course, the price of software all add up to a big bill that some companies may not be able to absorb.  Luckily, there is a free version SQL Express, but does …
I have a large data set and a SSIS package. How can I load this file in multi threading?
Via a live example combined with referencing Books Online, show some of the information that can be extracted from the Catalog Views in SQL Server.
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function

749 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