Home > Archive > Microsoft SQL Server forum > June 2005 > Database restore









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Database restore
jsfromynr

2005-06-29, 7:23 am

Hi All,

I am trying to restore a database from backup on another system [my
client's] but I had to follow some weired steps.

Step 1. Restore the database from EM 's GUI.
[Users as on My machine get restored but their logins are not
activated. So I have to follow the next steps]

sp_helpuser shows me the userName but null LoginName and
DefaultDatabase

Step 2. Create a new login , grant access to the DB

Step 3. Then run the script to change the ownership from earlier DB
user to new user.

Step 4. In EM make new user as dbo.

Really weired steps.

There should be easier way to restore the database in simple and
effective manner

With warm regards
Jatinder

Erland Sommarskog

2005-06-29, 8:24 pm

jsfromynr (jatinder. singh@clovertechnolo
gies.com) writes:
> I am trying to restore a database from backup on another system [my
> client's] but I had to follow some weired steps.
>
> Step 1. Restore the database from EM 's GUI.
> [Users as on My machine get restored but their logins are not
> activated. So I have to follow the next steps]
>
> sp_helpuser shows me the userName but null LoginName and
> DefaultDatabase
>
> Step 2. Create a new login , grant access to the DB
>
> Step 3. Then run the script to change the ownership from earlier DB
> user to new user.
>
> Step 4. In EM make new user as dbo.


Look at sp_change_users_logi
n in Books Online.



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

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

2005-06-30, 3:23 am

Thanks Erland,
It worked, I have another problem
by mistake I created all of my table in a user not as SA.so I tried
this to change the ownership

select 'EXEC sp_changeobjectowner
oldusername'+
char(39)+name+char(3
9)+','+ char(39) +'dbo'+char(39) from sysobjects
where uid=6 {old user's ID}


It works but I am looking for some easy methods

With warm regards
Jatinder

Erland Sommarskog

2005-06-30, 7:24 am

jsfromynr (jatinder. singh@clovertechnolo
gies.com) writes:
> It worked, I have another problem
> by mistake I created all of my table in a user not as SA.so I tried
> this to change the ownership
>
> select 'EXEC sp_changeobjectowner
oldusername'+
> char(39)+name+char(3
9)+','+ char(39) +'dbo'+char(39) from sysobjects
> where uid=6 {old user's ID}
>
>
> It works but I am looking for some easy methods


It can't get any easier than that!

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

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





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2008 droptable.com