Deleting a Partition Table

  • Hi, I have a partitioned table that I want to get rid of and start from scratch with. But I'm having a hard time getting rid of the filegroups/files.

    I ran this:

    alter database mydatabasename

    remove file [G:\MSSQL.1\MSSQL\Summary Filegroups 4\2005SUM4.ndf]

    And it said:

    Msg 5009, Level 16, State 9, Line 1

    One or more files listed in the statement could not be found or could not be initialized.

    But I am darned sure that the path and the file name are correct. I even checked the system filegroup tables ... anybody have any idea why it wouldn't be able to find the file I'm talking about?

    I tried the command with just the file name by itself and also with the path...but same thing both times.

  • amy26 (8/13/2010)


    Hi, I have a partitioned table that I want to get rid of and start from scratch with. But I'm having a hard time getting rid of the filegroups/files.

    I ran this:

    alter database mydatabasename

    remove file [G:\MSSQL.1\MSSQL\Summary Filegroups 4\2005SUM4.ndf]

    And it said:

    Msg 5009, Level 16, State 9, Line 1

    One or more files listed in the statement could not be found or could not be initialized.

    But I am darned sure that the path and the file name are correct. I even checked the system filegroup tables ... anybody have any idea why it wouldn't be able to find the file I'm talking about?

    I tried the command with just the file name by itself and also with the path...but same thing both times.

    If what you want to accomplish is to get rid of a table, what you should do is drop the table.

    _____________________________________
    Pablo (Paul) Berzukov

    Author of Understanding Database Administration available at Amazon and other bookstores.

    Disclaimer: Advice is provided to the best of my knowledge but no implicit or explicit warranties are provided. Since the advisor explicitly encourages testing any and all suggestions on a test non-production environment advisor should not held liable or responsible for any actions taken based on the given advice.
  • Dropping the table does not get rid of the files and filegroups that I have created for the table.

  • amy26 (8/13/2010)


    Dropping the table does not get rid of the files and filegroups that I have created for the table.

    That's a different story - did you already drop the offending table?

    _____________________________________
    Pablo (Paul) Berzukov

    Author of Understanding Database Administration available at Amazon and other bookstores.

    Disclaimer: Advice is provided to the best of my knowledge but no implicit or explicit warranties are provided. Since the advisor explicitly encourages testing any and all suggestions on a test non-production environment advisor should not held liable or responsible for any actions taken based on the given advice.
  • Well, I dunno if its a different story my post was referring to the error I got while trying to drop the file that I added to the filegroup for the table.

    Ultimately I'm trying to drop the table and get rid of everything associated with it.

    I hadn't dropped the table yet when I originally made the post but since then, yes I have dropped the table, the partition scheme and the partition function... but I cannot drop the files and the filegroups.

    I read something online about .ndf files not being 'standard' database files and therefore the database cannot initialize them? I am confused by that statement because the instructions I found to create database partitions told me to name them .ndf files.

    If that is the case, can I never ever ever remove these from the database?

    I also just checked sys.database_files and it says the files I'm trying to remove are online *grumble*.

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

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