{"id":5776,"date":"2022-05-13T04:43:51","date_gmt":"2022-05-13T04:43:51","guid":{"rendered":"https:\/\/pariswells.com\/blog\/?p=5776"},"modified":"2022-11-23T10:14:48","modified_gmt":"2022-11-23T10:14:48","slug":"how-to-find-out-when-the-databases-on-a-sql-server-were-last-usedaccessed-to-help-with-migration-and-decommission","status":"publish","type":"post","link":"https:\/\/pariswells.com\/blog\/research\/how-to-find-out-when-the-databases-on-a-sql-server-were-last-usedaccessed-to-help-with-migration-and-decommission","title":{"rendered":"How to find out when the Database&#8217;s on a SQL server were last used\\accessed to help with migration and decommission"},"content":{"rendered":"<div class=\"wp-block-wab-pastacode\">\n\t<div class=\"code-embed-wrapper\"> <pre class=\"language-markup code-embed-pre line-numbers\"  data-start=\"1\" data-line-offset=\"0\"><code class=\"language-markup code-embed-code\">SELECT d.name,<br\/>last_user_seek = MAX(last_user_seek),<br\/>last_user_scan = MAX(last_user_scan),<br\/>last_user_lookup = MAX(last_user_lookup),<br\/>last_user_update = MAX(last_user_update)<br\/>FROM sys.dm_db_index_usage_stats AS i<br\/>JOIN sys.databases AS d ON i.database_id=d.database_id<br\/>GROUP BY d.name<\/code><\/pre> <div class=\"code-embed-infos\"> <\/div> <\/div><\/div>\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[591],"class_list":["post-5776","post","type-post","status-publish","format-standard","hentry","category-research","tag-sql"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/posts\/5776","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/comments?post=5776"}],"version-history":[{"count":3,"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/posts\/5776\/revisions"}],"predecessor-version":[{"id":6380,"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/posts\/5776\/revisions\/6380"}],"wp:attachment":[{"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/media?parent=5776"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/categories?post=5776"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/tags?post=5776"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}