Solved

Determine the last time a database was accessed

Posted on 2003-10-23
8
272 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
8 Comments
 
LVL 19

Assisted Solution

by:Dexstar
Dexstar earned 40 total points
Comment Utility
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
Comment Utility
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
Comment Utility
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
 
LVL 8

Author Comment

by:mnashadka
Comment Utility
Namasi, how does that help me determine the last time a database was accessed?
0
How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

 
LVL 15

Expert Comment

by:namasi_navaretnam
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
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 extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.
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

762 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

Need Help in Real-Time?

Connect with top rated Experts

6 Experts available now in Live!

Get 1:1 Help Now