move database from One server to a new one

  • Hi,

    If I decide to move my db from one server to a new one, and my .mdf, and .log files called mydb.mdf, and mydb.log, should I move just this files?...or I have to move also the master, model, msdb, and tempdb files???if so, why??? Does anybody can give me please an step by step moving database?

    Thanks.

  • You should be able to dettach your database from one server, then copy the .ldf and .mdf file and re-attach these to your new server.

    You should not have to copy the system databases unless you have made changes to the model database that you need.

  • Do you have SSIS packages stored in the database?

    What about the scheduled jobs?

    Do you have replication in that server?

    You may have to take a backup of MSDB and restore it in the new server.

    Cheers,
    Prithiviraj Kulasingham

    http://preethiviraj.blogspot.com/

  • I already have SQL Server 2005 installed in the new server, and it's running with one different instance, in this case do I have to restore MSDB, master, and all files?..or just work with the ones from the instance I want to move?

    I am getting crazy with this 2 definitions.... usually I use Oracle, and I am really new with SQL. PLease any kindly assistance?

    Thanks a lot.

  • G.R.Preethiviraj Kulasingham (7/21/2008)


    Do you have SSIS packages stored in the database?

    What about the scheduled jobs?

    Do you have replication in that server?

    as above

    -----------------------------------------------------------------------------------------------------------

    "Ya can't make an omelette without breaking just a few eggs" 😉

  • I already have a master file and msdb file on my "destination" server... if I move this files from my older server, that will means that I will copy this new ones and....what will happend with the other ones that I have?

    Thanks

  • you cant just copy master and msdb, what if the collations are different between servers?

    do you have any SSIS packages?

    do you have any custom jobs running against the db?

    are you using replication?

    answer these questions first, you wouldnt normally copy master and msdb. Master cannot be restored in the same way as a user database

    -----------------------------------------------------------------------------------------------------------

    "Ya can't make an omelette without breaking just a few eggs" 😉

  • Any step by step guide please to perform this..or just a copy/paste task.

    Thank you for your help.

  • [font="Verdana"]Ok, Try the below steps.

    *) Before detaching the db you need to script default db for all the logins, because if the user db is default db for logins then after detaching the db the login will point NULL. Use the script below.

    Script Default Database. Save the output.

    *) You can detach all the user databases except system db's (master, msdb, tempdb & model). You can use the script below

    Detach User Databases

    *) Copy all the physical files of the user db from source server to destination server

    *) Since you are migrating the system, you need to move system db's also. To move the system databases your source and destination server should have same edition, version and same build (SQL edition, version and build), else you can't move the system database you can proceed directly to attaching user db step.

    *) Check the article "Moving System Databases - SQL Server 2005" for moving system db's

    *) Attach all the databases in the destination server.

    *) Once the above steps completed successfully and start sql server

    *) Open the script (saved in step1) and execute the script to map all the logins back to its default db.[/font]

  • are the file paths exactly the same on the new server?

    -----------------------------------------------------------------------------------------------------------

    "Ya can't make an omelette without breaking just a few eggs" 😉

Viewing 10 posts - 1 through 9 (of 9 total)

You must be logged in to reply to this topic. Login to reply