Coping database files

  • I have a database called meso.mdb located on machine 1. This file is located in D:\Program Files\Microsoft SQL Server\MSSQL\Data. I copied this file to machine 2 and stored in same directory. It appears that all of my views, queries and user accounts are the same. In other words, I have a clone of A on B. Am I correct in assuming so?

    Comments are appreciated.......

  • if you want to see this database on your second machine. you will have to create first create the database, then attach the files to the database using sp_attach_db.

    Did you detach the files then copy them to the second machine?

  • Yes. So can I assume that the database On B is a mirror image of A?

  • as long as you detach the mdf/ldf files then copy them to the new location, then reattach the files to machine a, then attach files to machine b. you should have a mirror of the data. Up until the point of copy.

    Not sure about logins/users. you may have to re-create them.

  • If you want it to keep mirroring you will have to write a complex stored proc or dts package. I tried it. My advice is create a job in the middle of the night when you attempt this.

    starting off by using sp_detach_db

    then copy of the files from box to box using either ftp, or a DOS command

    then reattach db using sp_attach_db on machine A

    then attach db using sp_attach_db to machine B

  • you could also copy the files in a vbscript using FileSystemObject

Viewing 6 posts - 1 through 5 (of 5 total)

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