question

dona avatar image
dona asked

what does mean is intitial size of a database?

when I create a database, how i can do a initial size of a .mdf file or a .ndf file ?
database
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

sp_lock avatar image
sp_lock answered
The initial size is the starting size in MB of the database you are creating (data & log). In most case this is increase to suit the requirement of the newly created database, but I guess this depends. The starting size of a newly created database is taken from the [model][1] database. Think of it as a template for all new database. For example, if you any objects (tables/sp etc) in the model then these objects are copied to the new db. [1]: http://msdn.microsoft.com/en-us/library/ms186388.aspx
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Grant Fritchey avatar image
Grant Fritchey answered
If you're creating a database from the Management Studio interface, when you see the New Database window, right in the center is a column called 'Initial Size (MB)'. As was noted by @sp_lock, this is set, by default, to the size of your Model database. But, you can go into here and type a new number. If you know roughly how much data you need to store, it's a very good idea to go ahead and make your files the appropriate size. I'd also suggest changing the Autogrowth to a larger number than the default 1MB. If you're using T-SQL to create the database, you just modify the numbers supplied for the file sizes. This example script adjusts both the database, the log, and both their autogrowth settings. I use both MB for megabyte and GB for gigabyte. You have complete control over how you create a database. CREATE DATABASE [MyNewDB] ON PRIMARY ( NAME = N'MyNewDB', FILENAME = N'C:\DATA\MyNewDB.mdf' , SIZE = 5GB , FILEGROWTH = 200MB ) LOG ON ( NAME = N'MyNewDB_log', FILENAME = N'C:\DATA\MyNewDB_log.ldf' , SIZE = 200MB , FILEGROWTH = 20MB)
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.