Bart

Software Engineer - Red Gate Software

How to use SQL Prompt 3 without being dbo...

Published Wednesday, February 28, 2007 2:36 PM

For anyone out there working with SQL Server on a large or mission critical system it's quite likely that, unless you're the DBA, you're not going to have dbo access to the databases you're working with, particularly if you're working directly with the production servers. Unsurprisingly then we've had a number of complaints from people finding themselves in exactly this situation who want to be able to use SQL Prompt 3, but can't because it generally doesn't work unless you're dbo.

Fortunately my colleague Jon this morning let me know that a solution is at hand for SQL Server 2005 at least, although you're still going to have to be nice to your DBA to make this work (I'd suggest that beer often helps). What you need to do is ask him or her to grant you the VIEW DEFINITION permission on the database of interest. What this means is that you'll be able to see all the meta-data for any object defined in the database, but you won't have access to the objects themselves, so for example you won't be able to read any data from a table unless you have the permissions required to do so.

For example, say your username is "bill" and you need access to the AdventureWorks database, then your DBA would need to execute the following command:


GRANT VIEW DEFINITION ON Database::AdventureWorks TO bill


Now, just to be clear about exactly what access this gives you, here's an extract from SQL Server 2005 books online that explains how this permission works:

"The VIEW DEFINITION permission lets a user see the metadata of the securable on which it is granted. However, VIEW DEFINITION permission does not confer access to the securable itself. For example, a user that is granted only VIEW DEFINITION permission on a table can see metadata related to the table in the sys.objects catalog view. However, without additional permissions, the user cannot read data from the table."

You might still be curious about why SQL Prompt needs this permission, and the reason has to do with the fact that back in the mists of time (last May) we decided to use the SQL Compare back-end to retrieve our meta-data. Now this is a great example of software reuse, and it saved us an awful lot of development time, however when you reuse something for a purpose for which it wasn't originally intended you can't really be surprised if you encounter the odd hiccup along the way.

The problem here is that SQL Compare doesn't trust the SQL Server system tables or views (wisely if you think about what it's supposed to do) so it works out most of what it needs to know by parsing the SQL definitions for the objects in your database, and if it can't get at the definition then it can't build up a model of your database. Now for SQL Prompt having partial information is OK since giving people some help is probably better than giving them no help whatsoever, but if you want to find out what the differences are between two databases then anything less than complete and accurate information really won't do at all, and SQL Compare therefore gets mardy as you like if it can't get the information it needs.

You can be sure that we'll be working on fixing this in the future but in the meantime cultivate kindness towards your DBA and ask them nicely to grant you the VIEW DEFINITION permission on your database and all will be well.
by Bart Read
Filed Under: ,

Comments

 

Bart Read said:

Just as an addendum, I should probably have made it clearer that we're not yet aware of a workaround for this that would work for SQL Server 2000, so for now at least you're stuck with needing dbo access to the database.
March 16, 2007 6:02 AM
You need to sign in to comment on this blog

About Bart Read

I've had a few jobs since graduating, but for the last four years I've been settled at Red Gate Software in Cambridge, UK. Over that time I've worked on a wide range of products, both as a developer and as a project manager, including 18 months on SQL Prompt; right now I'm finishing up with ANTS Profiler 4, which we think is going to be amazing - hopefully you will too.

















<February 2007>
SuMoTuWeThFrSa
28293031123
45678910
11121314151617
18192021222324
25262728123
45678910
Creating Technical Presentations
 Making a technical presentation is like being interviewed. It is not a skill that you are likely to... Read more...

Go With the Flow
 Knowing enough about the routes that messages take is vital to being an effective Exchange admin,... Read more...

Policy-Based Management
 Every DBA knows the frustration of trying to manage tens of servers, each of which has a subtly... Read more...

When Email Collaboration Could Have Changed History
 In our mission to make history relevant to the busy IT executive, we speculate how Email might have... Read more...

Bunnikins!
 When an IT manager is selected as a victim of office politics of a large corporate, it is time for him... Read more...