• I prefer using ALTER DATABASE ... MODIFY FILE to move database files. This method preserves the database ownership and does not require a detach/attach of the database.

    The first step is to modify the file location:

    ALTER DATABASE {your database} MODIFY FILE (filename = {new file location and name});

    GO

    Then, you take the database offline:

    ALTER DATABASE {your database} SET OFFLINE WITH ROLLBACK IMMEDIATE;

    GO

    Once the database is offline, copy the file to the new location and name and then bring the database online:

    ALTER DATABASE {your database} SET ONLINE;

    GO

    Jeffrey Williams
    “We are all faced with a series of great opportunities brilliantly disguised as impossible situations.”

    ― Charles R. Swindoll

    How to post questions to get better answers faster
    Managing Transaction Logs