Results 1 to 3 of 3
  1. #1
    Join Date
    Apr 2002
    Posts
    17

    Question Unanswered: Date & Time when a DB was last accessed

    Hi,

    Is there a way to find out when a SQL Server 2K database was
    last accessed (the date and time) ?

    Thanks,
    Bujji
    Bujji

  2. #2
    Join Date
    Feb 2002
    Location
    Houston, TX
    Posts
    809
    try sp_who2

    or you can get the 'lastquerybatch' field from the sysprocesses table.

    select last_batch from master.dbo.sysprocesses order by last_batch

    of course you will need to ignore the very last entry as it will be you.
    Paul Young
    (Knowledge is power! Get some!)

  3. #3
    Join Date
    Apr 2002
    Posts
    17
    Hi Paul,

    Thanks for your reply.

    Sysprocesses is a dynamic table and if I have to keep reading that table to find out info reg. dbs being accessed, I have to keep reading it every minute. Further, I will not be able to get info on dbs that are not being accessed by any processes if I read sysprocesses.

    I wanted to know if SQL Server has a feature that stores the date and time a database was last accessed.

    Thanks.
    Bujji

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •