What’s going on here?
When trying to open Default Trace files on Windows 7 and SQL Server 2008 I got the “You don’t have permission to open this file” error. My first and second thoughts were “How can this be, I’m an administrator!?”. SO the first thing I tried was reading the files using fn_trace_gettable in SSMS. This works, what is different between SSMS and Profiler? Nothing that I can think of.
What’s Next?
First step, check permissions on the folder, yup, full control. Second step, turn off inheritance. Third step, bang head on desk! So off to google/bing I went. I found this post by the SQL Server PSS team, , which told me about the issue, but not a good way to solve it. I can’t just grant rights to each file because the Default Trace rolls over and creates new files, I need rights all the time. Then I found this post, which says the owner of the files needs to copy and paste them out to a another shared folder. While not the most helpful idea for my situation I tried it, and it worked! I’m still annoyed at this point because I don’t want to have to move the files to read them.
Finally, a solution
Once again it is Twitter to the rescue. I tweeted my problem and got a pretty quick response from Brian Kelley (Twitter|Blog) asking about OS and if I ran Profiler as Administrator. I answered Win 7 and Yes, I was mistaken on the Yes it turns out. I thought because the account I was running under had administrative privileges that I was running as administrator. This is not the case in Vista, Win 7, and Windows Server 2008 when UAC is on. With UAC on you still need to run Profiler using elevated privileges by right-clicking and selecting “Run As Administrator”. That is the answer. I should also note that Ken Simmons (Twitter|Blog) also produced this answer. Jonathan Kehayias (Twitter|Blog) also chimed in to let me know that you can set individual applications to always run as administrator by right-clicking, selecting Properties, Compatibility, and checking the Run as Administrator box. All of this in about 20 minutes and this is after I spent at least an hour fighting with it and searching the internet for a solution!
Conclusion
I really need to get a better understanding of UAC, and believe it or not, Twitter works!
you are the wise guy.
ReplyDeletebecause you looked out for options and then came back to the simple solution of running as admin.
:)
Just like me.