Moving FIles

  • Hi Team,

    We have configured Logshipping in Secondary server in C:\Drive space was full. We have put all mdf and ldf file in C:\Drive

    USE master;

    GO

    ALTER DATABASE xx

    MODIFY FILE (NAME = xx, FILENAME = 'D:\Program Files\Microsoft SQL Server\MSSQL10_50.AVN_CD_DB03\MSSQL\DATA\xx.mdf');

    GO

    ALTER DATABASE yy _log

    MODIFY FILE (NAME = yy _log, FILENAME = 'L:\Program Files\Microsoft SQL Server\MSSQL10_50.AVN_CD_DB03\MSSQL\Data\yy _log.ldf');

    GO

    Now we are planning to move these MDF and LDF Files in another location but its giving error below

    Error:

    Msg 5004, Level 16, State 4, Line 1

    To use ALTER DATABASE, the database must be in a writable state in which a checkpoint can be executed.

    Msg 156, Level 15, State 1, Line 2

    Incorrect syntax near the keyword 'FILE'.

  • If this is the log shipping destintion it's being recovered, and so you can't move it like this. To do the ALTER the database must be in a recovered state.

    Two options are:

    1) Fail over to the secondary and move the files. This is very disruptive, so not really recommended

    2) Drop the database abd restore it to your new locations and re-estalish log shipping.

    Leo

    Leo
    Nothing in life is ever so complicated that with a little work it can't be made more complicated.

Viewing 2 posts - 1 through 1 (of 1 total)

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