Dbcc emptyfile the .mdf file online

  • Hi,

    I have a db and i have to migrate this db to another disk but on the same server, and this operation must be ONLINE.

    So when i add et new datafile which is in the same filegroup and try to make a :

    use

    [AdventureWorks2012]

    dbcc shrinkfile ('AdventureWorks2012_data',emptyfile)

    And as expected i have this error :

    Msg 2555, Level 16, State 2, Line 1

    Cannot move all contents of file AdventureWorks2012_Data to other places to complete the emptyfile operation.

    I know, the .mdf file is necesarry and contains the information to start the database.

    However i'm nearly sure that i've seen before that was possible to migrate entirely the .mdf file and change the default mdf file.

    I searched and read lots of topics in this forum, but i couldn't find it. Maybe that was just an illusion? (i can't remember where and how...) .

    Any Ideas?

    Thanks in advance.

  • humbar-a (10/7/2015)


    I know, the .mdf file is necesarry and contains the information to start the database.

    Yes that is correct

    humbar-a (10/7/2015)


    However i'm nearly sure that i've seen before that was possible to migrate entirely the .mdf file and change the default mdf file.

    No, not possible, the primary file cannot be removed!

    humbar-a (10/7/2015)


    Maybe that was just an illusion?

    Yes

    -----------------------------------------------------------------------------------------------------------

    "Ya can't make an omelette without breaking just a few eggs" 😉

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

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