LiCongMingDeShujuku / Find-When-A-Database-Was-Last-Accessed

查找上次访问数据库的时间

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

CLEVER DATA GIT REPO

查找上次访问数据库的时间

Find When A Database Was Last Accessed

发布-日期: 2015年8月26日 (评论)

#

Contents

中文

这是一些用来显示上次访问数据库的时间的非常基本的SQL逻辑(logic)。

English

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


Logic

use master;
set nocount on
 
select
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
sys.dm_db_index_usage_stats
where
        db_name(database_id) = 'mydb'

WorksEveryTime

Build-Info

Build Quality Build History
Build-Status
Coverage
Nuget
Build history

Author

  • 李聪明的数据库 Lee's Clever Data
  • Mike的数据库宝典 Mikes Database Collection
  • 李聪明的数据库 "Lee Songming"

Gist Twitter Wordpress


License

LicenseCCSA

Lee Songming

About

查找上次访问数据库的时间