blogs.conchango.com

welcome to the conchango blogging site
Welcome to blogs.conchango.com Sign in | Join | Help
in Search

SSIS Junkie

VSTS4DBP: Check for permissions

On my current project we are using Visual Studio Team System for Database Professionals aka Datadude to manage the deployment of SQL Server objects to our various dev, test, QA and production environments. In doing that I came across a bit of a problem that can easily occur if you are not dliligently testing your deployment scenarios.

A datadude deployment will try and create the database if it doesn't already exist. In order for this to work you need to ensure that the account that you are deploying with has DBCreator permissions on the target server. If it doesn't then ideally you would like the process to end gracefully - unfortunately that doesn't happen. The attempt to create the database will fail and the deployment process will then attempt to create all of the schema objects in master database. If for some reason the account has db_owner permissions in master then all the objects will get created there. This is obviously very bad and if you're not being vigilant then you might not even know that its happened (who ever takes a look in master, right?).

I reported this problem here: http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1399149&SiteID=1&mode=1 and Jamie Laflen from the Datadude dev team told me that this problem has been fixed in SP1 which is due soon. In the meantime, you can apply a simple fix yourself. Put the following code into a pre-build script:

:on error exit

IF NOT EXISTS (SELECT 1 FROM [sys].[databases] WHERE [name] = N'$(DatabaseName)')

BEGIN

    RAISERROR(N'The target database, %s, is not available', 16, 127,N'$(DatabaseName)') WITH NOWAIT

    RETURN

END

USE [$(DatabaseName)]

GO

:on error resume

Be aware of this. Its potentially quite dangerous.

 

-Jamie

 

 

 

 

http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1399149&SiteID=1&mode=1

Published 27 March 2007 22:23 by jamie.thomson

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

 

Dan said:

I hate to be a party-pooper...

This blog has started asking me for a twitter login - is there any way to make it stop?

I've enjoyed your blog a lot, but that login request makes it less likely I will read it.

March 29, 2007 18:56
 

jamie.thomson said:

ooo thanks for letting me know. I'll take it off straightaway.

March 29, 2007 19:19
 

CoqBlog said:

Vu sur le blog de Jamie Thomson : une information concernant Visual Studio Team Edition for Database

April 1, 2007 14:34

Leave a Comment

(required) 
(optional)
(required) 
Submit

This Blog

Syndication

News

Powered by Community Server (Personal Edition), by Telligent Systems