Setting a pre-allocated size for a database that already exists

  • I have a database with one mdf and one ldf. Is it possible to set the mdf file to an allocated size to avoid taking the hit when the database autogrows? I'd like to size the database a great deal larger than it is currently so autogrow doesn't trigger.

    Thanks,

    Ken

  • Yes, you can specify the size as initial size of the file.

    you can set it to a larger value, so it will pre-allocate specified size.

    Vishal Gajjar
    http://SqlAndMe.com

  • Use the following to pre size the primary data file

    alter database MYDB modify file (name = MDFLogicalFileName, size = SizeInMBorGB)

    e.g. size = 100MB or size = 100GB

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

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

  • Thank you very much.

    Ken

  • {edit} Never mind...

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

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

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