Copying a live MDF file

  • Is there any way to make a copy of the MDF and LDF file while SQL Server service is still running?

    Rob DeMotsis

    Sr. SQL Server DBA

    Pier 1 Imports, Inc.


    Rob DeMotsis
    Sr. SQL Server DBA

  • Do a file backup to the local drive system or a remote drive.

    BACKUP DATABASE [dbnamehere]

    TO DISK = 'D:\Backups\Backup1.dat'

    WITH

    INIT,

    NAME = 'Database Full Backup'

    Just fill your information in then restore to the other machine. But otherwise you cannot do anything to the file itself with the server actively running.

    "Don't roll your eyes at me. I will tape them in place." (Teacher on Boston Public)

  • A backup is the only safe way.

    Steve Jones

    steve@dkranch.net

  • Thank You gentlemen for your replies. The reason for the question is this. We are using IBM's flash backup and restore of Windows volumes in a 2000 environment. The only way to do a flash of the original volume is to stop the sql services on the server and then restart them.

    How does Veritas or ArcServe or any other backup program backup a live database using the additional modules that you have to get for them. There has to be some mechanism for copying the MDF and LDF to a backup device using those programs.

    Rob DeMotsis

    Sr. SQL Server DBA

    Pier 1 Imports, Inc.


    Rob DeMotsis
    Sr. SQL Server DBA

  • Not sure, most likely paid Microsoft so the backup hooks or are hooking some API to get to the database. If I come across anything I will pass it on.

    "Don't roll your eyes at me. I will tape them in place." (Teacher on Boston Public)

  • they attach through a backup named pipes and yes they paid for the api call to MS. It basically uses the same method that MS uses, though for some reason I have had issues resotring their things.

    What happens in a nutshell is the system starts making a backup of the file. If a write is needed in an unbacked up section, the write is accelerated into the log and the pages that will change are backed up. The write then commits. This happens somewhat in the background and I am unsure to what extent this changes the fault tolerance.

    Steve Jones

    steve@dkranch.net

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

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