Wednesday, March 28, 2012
restore db and change owner
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,
>>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 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
>> 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?
>>
> Hi John,
> Do you have an all-in example for me where i can use to restore/change
> owner?
restore db and change owner
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?
restore db and change owner
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
Friday, March 23, 2012
Restore Database FROM MDF/LDF, then apply Transaction Log From POint of Failure? Is it pOs
If I have a database backup from sunday, and a failure occurs monday... Can the backup .mdf and .ldf files be attached, and the backup log after the point of failure be applied to them?
The problem I am having is it looks like you can only restore from a .bak file, and then apply the log at the point of failure. IT doesn't look like you can restore the .ldf/.mdf files, and then apply the backup log from the point of failure.
Can someone please help? I'm in desparate need of fixing this !
Thanks,
dp
You can restore from backup and apply your log files to recover up to failure unless it is a transactional database you can restore almost everything but you are also supposed to keep a DR(disaster recovery) copy of your database. Try the link below. Hope this helps.
http://www.sql-server-performance.com/log_explorer_spotlight.asp
sql
restore database from another server
the past user attached to the database.
some objects are attached to the user, the user cannot be dropped.
how can i remove the user.
i saw some solutions but cannot search them out.
grateful for any assistance.
tonyHave you looked at the Microsoft supplied stored procedure
sp_change_users_login?
--
Keith Kratochvil
"tony wong" <x34@.netvigator.com> wrote in message
news:OsxhRcXhGHA.3956@.TK2MSFTNGP02.phx.gbl...
> after restore database from another server to a new server, i cannot
> delete the past user attached to the database.
> some objects are attached to the user, the user cannot be dropped.
> how can i remove the user.
> i saw some solutions but cannot search them out.
> grateful for any assistance.
> tony
>
>|||seems not worked
let me explain in more details
i find the said login (to be removed) owns 3 tables in the old database.
when it is restored at a new server, i cannot delete the said login
once i delete these 3 tables, the said login can be deleted ( but it is not
a solution to me)
how can i change the owner of these 3 tables back to 'sa'?
Thanks a lot.
tony
"Keith Kratochvil" <sqlguy.back2u@.comcast.net> ¼¶¼g©ó¶l¥ó·s»D:O5na4pXhGHA.4864@.TK2MSFTNGP05.phx.gbl...
> Have you looked at the Microsoft supplied stored procedure
> sp_change_users_login?
> --
> Keith Kratochvil
>
> "tony wong" <x34@.netvigator.com> wrote in message
> news:OsxhRcXhGHA.3956@.TK2MSFTNGP02.phx.gbl...
>> after restore database from another server to a new server, i cannot
>> delete the past user attached to the database.
>> some objects are attached to the user, the user cannot be dropped.
>> how can i remove the user.
>> i saw some solutions but cannot search them out.
>> grateful for any assistance.
>> tony
>>
>|||fixed by sp_changeobjectowner
thanks a lot
"Tony WONG" <x34@.hknet.com> ¼¶¼g©ó¶l¥ó·s»D:u6TbsuehGHA.1856@.TK2MSFTNGP03.phx.gbl...
> seems not worked
> let me explain in more details
> i find the said login (to be removed) owns 3 tables in the old database.
> when it is restored at a new server, i cannot delete the said login
> once i delete these 3 tables, the said login can be deleted ( but it is
> not a solution to me)
> how can i change the owner of these 3 tables back to 'sa'?
> Thanks a lot.
> tony
>
> "Keith Kratochvil" <sqlguy.back2u@.comcast.net> ¼¶¼g©ó¶l¥ó·s»D:O5na4pXhGHA.4864@.TK2MSFTNGP05.phx.gbl...
>> Have you looked at the Microsoft supplied stored procedure
>> sp_change_users_login?
>> --
>> Keith Kratochvil
>>
>> "tony wong" <x34@.netvigator.com> wrote in message
>> news:OsxhRcXhGHA.3956@.TK2MSFTNGP02.phx.gbl...
>> after restore database from another server to a new server, i cannot
>> delete the past user attached to the database.
>> some objects are attached to the user, the user cannot be dropped.
>> how can i remove the user.
>> i saw some solutions but cannot search them out.
>> grateful for any assistance.
>> tony
>>
>>
>|||Glad to help. In SQL Server 2000 it is usually recommended to have objects
owned by dbo, not users.
--
Keith Kratochvil
"Tony WONG" <x34@.hknet.com> wrote in message
news:OQdl30ehGHA.3496@.TK2MSFTNGP04.phx.gbl...
> fixed by sp_changeobjectowner
> thanks a lot
>
> "Tony WONG" <x34@.hknet.com>
> ¼¶¼g©ó¶l¥ó·s»D:u6TbsuehGHA.1856@.TK2MSFTNGP03.phx.gbl...
>> seems not worked
>> let me explain in more details
>> i find the said login (to be removed) owns 3 tables in the old database.
>> when it is restored at a new server, i cannot delete the said login
>> once i delete these 3 tables, the said login can be deleted ( but it is
>> not a solution to me)
>> how can i change the owner of these 3 tables back to 'sa'?
>> Thanks a lot.
>> tony
>>
>> "Keith Kratochvil" <sqlguy.back2u@.comcast.net>
>> ¼¶¼g©ó¶l¥ó·s»D:O5na4pXhGHA.4864@.TK2MSFTNGP05.phx.gbl...
>> Have you looked at the Microsoft supplied stored procedure
>> sp_change_users_login?
>> --
>> Keith Kratochvil
>>
>> "tony wong" <x34@.netvigator.com> wrote in message
>> news:OsxhRcXhGHA.3956@.TK2MSFTNGP02.phx.gbl...
>> after restore database from another server to a new server, i cannot
>> delete the past user attached to the database.
>> some objects are attached to the user, the user cannot be dropped.
>> how can i remove the user.
>> i saw some solutions but cannot search them out.
>> grateful for any assistance.
>> tony
>>
>>
>>
>
restore database from another server
the past user attached to the database.
some objects are attached to the user, the user cannot be dropped.
how can i remove the user.
i saw some solutions but cannot search them out.
grateful for any assistance.
tonyHave you looked at the Microsoft supplied stored procedure
sp_change_users_login?
Keith Kratochvil
"tony wong" <x34@.netvigator.com> wrote in message
news:OsxhRcXhGHA.3956@.TK2MSFTNGP02.phx.gbl...
> after restore database from another server to a new server, i cannot
> delete the past user attached to the database.
> some objects are attached to the user, the user cannot be dropped.
> how can i remove the user.
> i saw some solutions but cannot search them out.
> grateful for any assistance.
> tony
>
>|||seems not worked
let me explain in more details
i find the said login (to be removed) owns 3 tables in the old database.
when it is restored at a new server, i cannot delete the said login
once i delete these 3 tables, the said login can be deleted ( but it is not
a solution to me)
how can i change the owner of these 3 tables back to 'sa'?
Thanks a lot.
tony
"Keith Kratochvil" <sqlguy.back2u@.comcast.net> glsD:O5na4pXhGHA.4864@.TK2MSFTNGP05.
phx.gbl...
> Have you looked at the Microsoft supplied stored procedure
> sp_change_users_login?
> --
> Keith Kratochvil
>
> "tony wong" <x34@.netvigator.com> wrote in message
> news:OsxhRcXhGHA.3956@.TK2MSFTNGP02.phx.gbl...
>|||fixed by sp_changeobjectowner
thanks a lot
"Tony WONG" <x34@.hknet.com> glsD:u6TbsuehGHA.1856@.TK2MSFTNGP03.phx.gbl...agreen">
> seems not worked
> let me explain in more details
> i find the said login (to be removed) owns 3 tables in the old database.
> when it is restored at a new server, i cannot delete the said login
> once i delete these 3 tables, the said login can be deleted ( but it is
> not a solution to me)
> how can i change the owner of these 3 tables back to 'sa'?
> Thanks a lot.
> tony
>
> "Keith Kratochvil" <sqlguy.back2u@.comcast.net> glsD:O5na4pXhGHA.
4864@.TK2MSFTNGP05.phx.gbl...
>|||Glad to help. In SQL Server 2000 it is usually recommended to have objects
owned by dbo, not users.
Keith Kratochvil
"Tony WONG" <x34@.hknet.com> wrote in message
news:OQdl30ehGHA.3496@.TK2MSFTNGP04.phx.gbl...
> fixed by sp_changeobjectowner
> thanks a lot
>
> "Tony WONG" <x34@.hknet.com>
> glsD:u6TbsuehGHA.1856@.TK2MSFTNGP03.phx.gbl...
>sql