DBCC SHRINKFILE (PTODATA03, EMPTYFILE) - stop or abort

  • Dear all, if I do the shrinkfile command for a 100% filled datafile, what happens whether the procedure abort or if I stop manually? In msdn I can read, I have to drop the empty file. But in case of an abort or stop, the file is not empty. Do I need to restart the shrinkfile process, or can I use the datafile with a filling degree of 50% if the process was done with a part of 50%. Or is the file not useable for database process to add new pages to this file? I can't find any information about this case of error.

  • SHRINKFILE works in transactions of 32 pages - post by CSS which offers some good insight -

    http://blogs.msdn.com/psssql/archive/2008/03/28/how-it-works-sql-server-2005-dbcc-shrink-may-take-longer-than-sql-server-2000.aspx

  • Hi Tommy,

    sry, but in the blog I can't find the info, what I have to do, if the task aborts...

  • mulle-78 (12/16/2009)


    Hi Tommy,

    sry, but in the blog I can't find the info, what I have to do, if the task aborts...

    In short, you can safely stop and restart an emptyfile operation; the file will remains online until it is removed.

  • thx for response

    and if I forget to delete a datafile with an aborted " DBCC SHRINKFILE (PTODATA03, EMPTYFILE)" command, the existing pages will be used by the DB, but no new pages will be created in this datafile?

    The datafile is not usable for new pages, right? But an abort is then not very critical?

    thx

  • mulle-78 (12/16/2009)


    thx for response

    and if I forget to delete a datafile with an aborted " DBCC SHRINKFILE (PTODATA03, EMPTYFILE)" command, the existing pages will be used by the DB, but no new pages will be created in this datafile?

    The datafile is not usable for new pages, right? But an abort is then not very critical?

    thx

    NP - correct - per BOL (http://msdn.microsoft.com/en-us/library/ms189493.aspx):

    EMPTYFILE

    Migrates all data from the specified file to other files in the same filegroup. Because the Database Engine no longer allows data to be placed in the empty file, the file can be removed by using the ALTER DATABASE statement.

  • thx, yes... this is what I read in msdn... but not how critical is an abort

Viewing 7 posts - 1 through 6 (of 6 total)

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