Solved

Determine the last time a database was accessed

Posted on 2003-10-23
8
277 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
The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

 
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

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

Question has a verified solution.

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

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…
A Stored Procedure in Microsoft SQL Server is a powerful feature that it can be used to execute the Data Manipulation Language (DML) or Data Definition Language (DDL). Depending on business requirements, a single Stored Procedure can return differe…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.

707 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