Wednesday, March 28, 2012

restore db and change owner

Hi,
Is there any simpler way to set the correct dbowner after a
restore/detached/attached action?
I can only backup or restore as sa, but i have an account for developers
which is also the owner of new databases.
Anyone?Hi
Look at using sp_changedbowner after the restore.
John
"Jason" <jasonlewis@.hotrmail.com> wrote in message
news:O2KG7KTuFHA.2948@.TK2MSFTNGP15.phx.gbl...
> Hi,
> Is there any simpler way to set the correct dbowner after a
> restore/detached/attached action?
> I can only backup or restore as sa, but i have an account for developers
> which is also the owner of new databases.
> Anyone?|||John Bell wrote:
> Hi
> Look at using sp_changedbowner after the restore.
> John
> "Jason" <jasonlewis@.hotrmail.com> wrote in message
> news:O2KG7KTuFHA.2948@.TK2MSFTNGP15.phx.gbl...
>
>
>
Hi John,
Do you have an all-in example for me where i can use to restore/change
owner?|||Hi
Something like:
RESTORE DATABASE TestDB
FROM DISK = 'c:\Northwind.bak'
WITH MOVE 'Northwind' TO 'c:\test\testdb.mdf',
MOVE 'Northwind_log' TO 'c:\test\testdb.ldf'
EXEC TestDB..sp_changedbowner @.loginame = 'sa'
John
"Jason" <jasonlewis@.hotrmail.com> wrote in message
news:ON5x01TuFHA.2880@.TK2MSFTNGP12.phx.gbl...
> John Bell wrote:
> Hi John,
> Do you have an all-in example for me where i can use to restore/change
> owner?sql

No comments:

Post a Comment