Agent Jobs

Find When A Database Was Last Accessed

Here’s some very basic sql logic that shows when a database was last accessed.

use master;
set nocount on

last_user_seek = max(convert(char, last_user_seek, 9))
,	last_user_scan = max(convert(char, last_user_scan, 9))
,	last_user_lookup = max(convert(char, last_user_lookup, 9)) ,	last_user_update = max(convert(char, last_user_update, 9)) from
        db_name(database_id) = 'mydb'

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s