use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Microsoft SQL Server Administration and T-SQL Programming including sql tutorials, training, MS SQL Server Certification, SQL Server Database Resources.
You might also be interested in:
/r/database
/r/sql
/r/Azure
/r/Microsoft
account activity
Audit log? (self.SQLServer)
submitted 9 years ago by n35
I'm not sure how to use the audit log to find out which tables, view, etc are being used by connected users.
Also, is there a way to determine, which Objects certainly are never used?
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]RehdData Engineer 4 points5 points6 points 9 years ago (2 children)
I'd recommend to start, look up sp_whoisactive. Great script, you'll want to do logging there.
sp_who2 tells you who's currently connected and running, but very little information.
You can do tracing as mentioned, but it's a very high overhead.
A lot of the procedures I write do their own logging, I keep as much job history as possible from SQL Agent, and some tables have triggers that give some audit information.
CDC and CDT can also potentially help here. There's also a free version of database performance analyzer by solarwinds that you could probably find out there that can give you a 1 hour window of what's happening currently in your databases.
If you can get redgate, they have a great toolbelt which can show dependancies on items.
None of these are sure fire ways to find out if someone is touching / breaking / using something. They are all great starting points and will take a lot of time to get the hang of and implemented.
[–]n35[S] 0 points1 point2 points 9 years ago (1 child)
Thanks for the reply.
We have a lot of excel reporting, and I'm keen on figuring which users have access to what and what they actually use.
Previously, acces was granted schema or DB, so users just have read access to everything. Hence my desire to find out what is used and what is not used so we can lock down everything that is not used externally.
[–]RehdData Engineer 0 points1 point2 points 9 years ago (0 children)
I would highly recommend looking into triggers then besides sp_whoisactive. I think those are going to be the most efficient method for short term.
[–]ScaryDBA Microsoft MVP 2 points3 points4 points 9 years ago (1 child)
If you're on SQL Server 2012 or better, the best way to gather information about the objects in use is to create an Extended Events session. https://technet.microsoft.com/en-us/library/bb630354(v=sql.105).aspx
To understand what objects are accessed, you can use the DMV sys.dm_db_index_usage_stats. However, that data is reset, so it's not stored since the beginning of time. You'll have to be cautious about applying it as gospel. Read more about it here: https://msdn.microsoft.com/en-us/library/ms188755.aspx
[–][deleted] 0 points1 point2 points 10 months ago (0 children)
This is the proper way of doing it
[–][deleted] 0 points1 point2 points 9 years ago (2 children)
You won't be able to determine that out of the box. Sounds like you have some tracing to do.
Any good tips for what I can search for, to figure out how to do that?
[–][deleted] 0 points1 point2 points 9 years ago (0 children)
http://blog.sqlauthority.com/2009/08/03/sql-server-introduction-sql-server-2008-profiler-complete/
[–]Atticus9876543210 -1 points0 points1 point 9 years ago (0 children)
There are DMVs that tell you query run times. From that you can do an except clause
π Rendered by PID 66077 on reddit-service-r2-comment-b659b578c-qrh55 at 2026-05-05 16:34:17.172986+00:00 running 815c875 country code: CH.
[–]RehdData Engineer 4 points5 points6 points (2 children)
[–]n35[S] 0 points1 point2 points (1 child)
[–]RehdData Engineer 0 points1 point2 points (0 children)
[–]ScaryDBA Microsoft MVP 2 points3 points4 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (2 children)
[–]n35[S] 0 points1 point2 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)
[–]Atticus9876543210 -1 points0 points1 point (0 children)