July 5, 2012 at 8:21 am
I've been tasked with trolling for references to tables on a particular server/database. We're in the process of moving most of the data to a new machine, but the migration isn't well documented (or executed).
It's my suspicion that a lot of the jobs and processes still running on the old box are in vain.
I'd like to capture all table references in that database over the span of say, 45 days, but PLENTY of code is executed using sp_executesql().
Further, I've found that when stores procs are called, the code shown in SQL Profiler stops well before the entire definition of the sproc, potentially leaving out some references.
Can someone please help me work around these shortfalls with the Profiler? Is there a better approach without incurring too much overhead?
Thanks in advance SSC!
July 8, 2012 at 4:33 am
Profiler won't show the code from a stored proc if you're capturing execution calls. It will only show the code if you're capturing statement calls, which you don't want to do.
You'll need to combine the work. Capture all the calls using Profiler out to file. Then input that to a table where you can parse out the sql statements to get the ad hoc statements and each of their table references. Then you can query the databases directly to get table references from within the stored procedures (although, remember, some stored procs will directly reference the tables, others will build ad hoc statements internally).
In short, this is a huge undertaking.
"The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
- Theodore Roosevelt
Author of:
SQL Server Execution Plans
SQL Server Query Performance Tuning
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply