Thursday, March 8, 2012

Db Owner

Hi,

I currently have two databases (DEV & TEST) with the same users but
different owners. The TEST database is on a remote machine with 2
database users - USR1 & DBO. The DEV database is exactly the same.
However, when I create procedures etc the DEV database recognises the
owner as DBO and the TEST database USR1.

I have made USR1 an owner on DEV and I login using the correct
credentials. However it still is not recognising this when creating
procedures.

This is very frustrating when doing a SQL Compare as it thinks the
stored procs are different!

I have done a sp_changedbowner and this didn't work. There must be
another config value that need changing?

Any ideas?

Thanks.
jack-b@.humlog.com wrote:
> Hi,
> I currently have two databases (DEV & TEST) with the same users but
> different owners. The TEST database is on a remote machine with 2
> database users - USR1 & DBO. The DEV database is exactly the same.
> However, when I create procedures etc the DEV database recognises the
> owner as DBO and the TEST database USR1.
> I have made USR1 an owner on DEV and I login using the correct
> credentials. However it still is not recognising this when creating
> procedures.
> This is very frustrating when doing a SQL Compare as it thinks the
> stored procs are different!
> I have done a sp_changedbowner and this didn't work. There must be
> another config value that need changing?
> Any ideas?
> Thanks.

Could you try:

CREATE PROCEDURE dbo.procname

The Owner can be included in the create syntax

--
David Rowland
NEW DBMonitor Version Out Now! New EMAIL Alert Feature!
http://dbmonitor.tripod.com|||(jack-b@.humlog.com) writes:
> I currently have two databases (DEV & TEST) with the same users but
> different owners. The TEST database is on a remote machine with 2
> database users - USR1 & DBO. The DEV database is exactly the same.
> However, when I create procedures etc the DEV database recognises the
> owner as DBO and the TEST database USR1.
> I have made USR1 an owner on DEV and I login using the correct
> credentials. However it still is not recognising this when creating
> procedures.
> This is very frustrating when doing a SQL Compare as it thinks the
> stored procs are different!
> I have done a sp_changedbowner and this didn't work. There must be
> another config value that need changing?

Not really sure that I understood your setup correctly. But if you
login as USR1 and USR1 is the owner of DEV, the login USR1 will map
to the user dbo.

I'm not really sure what you want to achieve, but the simplest is to
have dbo as owner of all stored procedures. You can use
sp_changeobjectowner to change the owners of the procedure in TEST.

--
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techin.../2000/books.asp

No comments:

Post a Comment