Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DBO user gone after rename 1

Status
Not open for further replies.

cheyney

Programmer
Jul 16, 2002
335
CA
Hello,

I just used a script posted at:


to rename one of my databases, and the dbo user on that database disappeared. How can I recreate this guy? when i try to add him with login name "sa" and username "dbo" i get the error message:
"Error 15405: Cannot use the reserved user or role name 'sa'"


Anyone know what to do?

cheyney
 
SA is always a DB owner in every database. Try running the following.

Use YourDatabase
go
exec sp_changedbowner @loginame = 'sa'
go

If that fails try the following.

Use YourDatabase
go
--make another login the database owner temporarily
--this login should not be a user in the database
exec sp_changedbowner @loginame = 'anyvalidlogin'
go
--Now make sa the owner
exec sp_changedbowner @loginame = 'sa'
go If you want to get the best answer for your question read faq183-874 and faq183-3179.
Terry L. Broadbent - DBA
SQL Server Page:
 
Great! first one worked, thanks terry

cheyney
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top