Saturday, February 25, 2012

Move database from 1 server to another

If we would like to move a database from Server A to
Server B, we should use sp_detach_db or make a backup copy
and restore on Server B ?
Is there any difference and advantage of these 2 methods ?
Moreover, if there are 60 logins & users are created in
that database (It is done by contractor), is it necessary
for us to create those Logins in Server B before
restoring / attaching the Database ?
ThanksDetach or backup is fine. Detach (with update statistics) / Attach
is probably easier.
Doesn't really matter when you handle the users. You could
write a little script for that. If you use the Generate Script option on
the database and select the option to include users and permissions,
you can review the script and pull out just that section.
2005 Microsoft MVP C#
Robbe Morris
http://www.robbemorris.com
http://www.masterado.net/home/listings.aspx
"Jason" <anonymous@.discussions.microsoft.com> wrote in message
news:749e01c525d6$99190530$a401280a@.phx.gbl...
> If we would like to move a database from Server A to
> Server B, we should use sp_detach_db or make a backup copy
> and restore on Server B ?
> Is there any difference and advantage of these 2 methods ?
> Moreover, if there are 60 logins & users are created in
> that database (It is done by contractor), is it necessary
> for us to create those Logins in Server B before
> restoring / attaching the Database ?
> Thanks|||Dear Robbe,
Thank you for your advice.
I have selected the database I have to transfer to another
Server, Generate Script, select all options AND get a SQL
script generated.
Should I run the script in target server before I attach
the database from Source Server ?
Thank you !

>--Original Message--
>Detach or backup is fine. Detach (with update
statistics) / Attach
>is probably easier.
>Doesn't really matter when you handle the users. You
could
>write a little script for that. If you use the Generate
Script option on
>the database and select the option to include users and
permissions,
>you can review the script and pull out just that section.
>--
>2005 Microsoft MVP C#
>Robbe Morris
>http://www.robbemorris.com
>http://www.masterado.net/home/listings.aspx
>
>"Jason" <anonymous@.discussions.microsoft.com> wrote in
message
>news:749e01c525d6$99190530$a401280a@.phx.gbl...
copy[vbcol=seagreen]
methods ?[vbcol=seagreen]
necessary[vbcol=seagreen]
>
>.
>|||Pull the script up in Query analyzer and strip out everything but
the code that creates the users and grants permissions. Attach
your database and then run the modified script.
2005 Microsoft MVP C#
Robbe Morris
http://www.robbemorris.com
http://www.masterado.net/home/listings.aspx
"Jason" <anonymous@.discussions.microsoft.com> wrote in message
news:753701c525ee$0457e340$a401280a@.phx.gbl...[vbcol=seagreen]
> Dear Robbe,
> Thank you for your advice.
> I have selected the database I have to transfer to another
> Server, Generate Script, select all options AND get a SQL
> script generated.
> Should I run the script in target server before I attach
> the database from Source Server ?
> Thank you !
>
> statistics) / Attach
> could
> Script option on
> permissions,
> message
> copy
> methods ?
> necessary

No comments:

Post a Comment