• JDixon-385826 (3/17/2010)


    running the below alter DB restricted user will make sure all transactions have been completed before the detach. Running something like the below will make sure you have as little issue as possible

    USE MASTER

    GO

    BACKUP DATABASE DBName

    TO...

    GO

    ALTER DATABASE DBName SET RESTRICTED_USER WITH ROLLBACK IMMEDIATE

    BACKUP DATABASE DBName

    TO...

    WITH DIFFERENTIAL

    SP_DETACH_DB 'DBName'

    GO

    XP_CMDSHELL 'COPY file1'

    XP_CMDSHELL 'COPY file2'

    XP_CMDSHELL 'COPY file3'

    GO

    SP_Attach_DB 'DBName', 'File1', ...

    GO

    ALTER DATABASE DBName SET MULTI_USER WITH ROLLBACK IMMEDIATE

    GO

    I would exclude this step, won't make any difference.

    BACKUP DATABASE DBName

    TO...

    WITH DIFFERENTIAL

    EnjoY!