SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Is This Database Being Used?


Is This Database Being Used?

Author
Message
Ginger Keys
Ginger Keys
SSC-Enthusiastic
SSC-Enthusiastic (141 reputation)SSC-Enthusiastic (141 reputation)SSC-Enthusiastic (141 reputation)SSC-Enthusiastic (141 reputation)SSC-Enthusiastic (141 reputation)SSC-Enthusiastic (141 reputation)SSC-Enthusiastic (141 reputation)SSC-Enthusiastic (141 reputation)

Group: General Forum Members
Points: 141 Visits: 207
Comments posted to this topic are about the item Is This Database Being Used?
Dave Poole
Dave Poole
SSC-Dedicated
SSC-Dedicated (32K reputation)SSC-Dedicated (32K reputation)SSC-Dedicated (32K reputation)SSC-Dedicated (32K reputation)SSC-Dedicated (32K reputation)SSC-Dedicated (32K reputation)SSC-Dedicated (32K reputation)SSC-Dedicated (32K reputation)

Group: General Forum Members
Points: 32116 Visits: 3666
Nice article. We used traces on DBs we believed to be inactive. We worried about mystery monthly processes so needed a long running trace to be certain we identified this.

One of the biggest challenges was to get prioritisation agreed to carry out remedial work done to applications to deprecate old DBs once and for all. As far as a DBA is concerned a database is either in use or it is not. If it is in use then it needs backup/archive, suitable HADR, maintenance jobs etc.
As far as a business person is concerned DB usage is shades of grey. The impact (and costs) of their "hardly ever used" DB probably won't be understood and on shared servers difficult to assign a cost.

LinkedIn Profile
www.simple-talk.com
mauriciorpp
mauriciorpp
Mr or Mrs. 500
Mr or Mrs. 500 (583 reputation)Mr or Mrs. 500 (583 reputation)Mr or Mrs. 500 (583 reputation)Mr or Mrs. 500 (583 reputation)Mr or Mrs. 500 (583 reputation)Mr or Mrs. 500 (583 reputation)Mr or Mrs. 500 (583 reputation)Mr or Mrs. 500 (583 reputation)

Group: General Forum Members
Points: 583 Visits: 265
great article, getting evidence of things that are NOT in use is lways a complicated matter, mostly because nobody wants to think about that.

does someone have a stored procedure that can capture data from time to time and can share here too?
Jeff Moden
Jeff Moden
SSC Guru
SSC Guru (459K reputation)SSC Guru (459K reputation)SSC Guru (459K reputation)SSC Guru (459K reputation)SSC Guru (459K reputation)SSC Guru (459K reputation)SSC Guru (459K reputation)SSC Guru (459K reputation)

Group: General Forum Members
Points: 459435 Visits: 43757
No matter which method you use to determine if a database is being used, it's not a good idea to immediately kill the database. To Dave's point, I'll typically take a final backup along with a "Tail Log" backup, which also takes the database offline and then I'll leave it like that for at least two monthly cycles and a quarterly cycle, whichever is the furthest out. And then I guard the final MDF and LDF locally (as well as on tape) until the year end cycle has passed. If we needed to drop the database because of space issues, having the MDF and LDF locally might not be feasible so I'll have a special tape made and keep that locally.

--Jeff Moden

RBAR is pronounced ree-bar and is a Modenism for Row-By-Agonizing-Row.
First step towards the paradigm shift of writing Set Based code:
Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column.
If you think its expensive to hire a professional to do the job, wait until you hire an amateur. -- Red Adair

Helpful Links:
How to post code problems
How to post performance problems
Forum FAQs
Yuri Padorin
Yuri Padorin
SSC Rookie
SSC Rookie (35 reputation)SSC Rookie (35 reputation)SSC Rookie (35 reputation)SSC Rookie (35 reputation)SSC Rookie (35 reputation)SSC Rookie (35 reputation)SSC Rookie (35 reputation)SSC Rookie (35 reputation)

Group: General Forum Members
Points: 35 Visits: 122

Surprised you didn't mention it, but I use an extended events session that I leave running to capture the login and source (among a few others) for a lock_acquired event. I filter by database and I filter out our maintenance and sysadmin accounts.


Eric M Russell
Eric M Russell
SSC Guru
SSC Guru (57K reputation)SSC Guru (57K reputation)SSC Guru (57K reputation)SSC Guru (57K reputation)SSC Guru (57K reputation)SSC Guru (57K reputation)SSC Guru (57K reputation)SSC Guru (57K reputation)

Group: General Forum Members
Points: 57509 Visits: 12563
To complicate things, there could be legacy jobs or reports that robotically access the database on a schedule, but it's defunct and no end user or business process really depends on it or even looks at it. That's why it's a best practice to state the purpose or business justification for a job within it's description, and also have one or more operators setup for each job, even if there are no routine email notifications. In this case the operators are really business owners who are there in case someone needs an actual human contact to vouch for the purpose or continued need of a process when it comes under scrutiny for some reason.

I'm speaking from the perspective of someone who helps manage a database environment containing 100+ production servers and 1000+ jobs. The first logic branch on my mental flowchart for troubleshooting jobs is: "Who who created this thing?" and the 2nd branch is "Do we actually need it?". Only when those questions are answered can I justify spending any serious time trying to fix or optimize it. Nothing makes me happier than to give the ax to some old resource hog of a job that's wasting server resources in addition to wasting DBA time.


"The universe is complicated and for the most part beyond your control, but your life is only as complicated as you choose it to be."
Jeff Moden
Jeff Moden
SSC Guru
SSC Guru (459K reputation)SSC Guru (459K reputation)SSC Guru (459K reputation)SSC Guru (459K reputation)SSC Guru (459K reputation)SSC Guru (459K reputation)SSC Guru (459K reputation)SSC Guru (459K reputation)

Group: General Forum Members
Points: 459435 Visits: 43757
Yuri Padorin - Monday, December 4, 2017 7:32 AM

Surprised you didn't mention it, but I use an extended events session that I leave running to capture the login and source (among a few others) for a lock_acquired event. I filter by database and I filter out our maintenance and sysadmin accounts.



If you measure something, it costs in clock cycles and memory used. While people say that EE is more efficient than a server side SQL Profiler Trace, I find there's not really much difference especially if someone forgets to turn the damned thing off. Also, as Eric suggested above, even if something isn't used, there may be some forgotten job somewhere that really serves no purpose. One does require some bit of esoteric knowledge of such things to either prevent something valuable from being turned off or, to reverse it all, something that is being used that actually provides no value from being turned off.

--Jeff Moden

RBAR is pronounced ree-bar and is a Modenism for Row-By-Agonizing-Row.
First step towards the paradigm shift of writing Set Based code:
Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column.
If you think its expensive to hire a professional to do the job, wait until you hire an amateur. -- Red Adair

Helpful Links:
How to post code problems
How to post performance problems
Forum FAQs
alen teplitsky
alen teplitsky
SSChampion
SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)

Group: General Forum Members
Points: 14725 Visits: 4717
A lot of those counters have values since the last start time of the server. If you can restart the server, then track the database specific counters to see if any don't increase
Dave Poole
Dave Poole
SSC-Dedicated
SSC-Dedicated (32K reputation)SSC-Dedicated (32K reputation)SSC-Dedicated (32K reputation)SSC-Dedicated (32K reputation)SSC-Dedicated (32K reputation)SSC-Dedicated (32K reputation)SSC-Dedicated (32K reputation)SSC-Dedicated (32K reputation)

Group: General Forum Members
Points: 32116 Visits: 3666
If we are trying to detect activity in a "unused" DB then the overhead of a trace or extended event should not be of concern.
I'd be more worried about the app that doesn't handle faulty connections gracefully

LinkedIn Profile
www.simple-talk.com
Bert-701015
Bert-701015
SSC-Addicted
SSC-Addicted (407 reputation)SSC-Addicted (407 reputation)SSC-Addicted (407 reputation)SSC-Addicted (407 reputation)SSC-Addicted (407 reputation)SSC-Addicted (407 reputation)SSC-Addicted (407 reputation)SSC-Addicted (407 reputation)

Group: General Forum Members
Points: 407 Visits: 718
Just a heads up; some of the techniques discussed can be skewed (in use) by maintenance jobs like re-indexing.
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum







































































































































































SQLServerCentral


Search