开发者

When creating a new database in SQL Server 2008, should FILEGROWTH settings be inherited from the model database?

In SQL Server, the 'model' database apparently acts as a sort of template when creating new databases. It seems as if some properties of this database are inherited by the new database. However, I'm observing that the FILEGROWTH properties are not inherited by new databases.

This (somewhat 开发者_StackOverflowold) post suggests that this should be inherited:

To change the default settings for future databases, make the change on the model database.

http://weblogs.sqlteam.com/tarad/archive/2008/09/11/File-Growth-Settings-for-SQL-Server-Databases.aspx

However, in this post, somebody is essentially asking a similar question: http://www.sqlservercentral.com/Forums/Topic1065073-391-1.aspx

So my question is how should the FILEGROWTH properties of the model database affect new databases; and has this behaviour changed between versions of SQL Server?


The documentation for CREATE DATABASE has this to say about the SIZE parameter:

When size is not supplied for the primary file, the Database Engine uses the size of the primary file in the model database. When a secondary data file or log file is specified but size is not specified for the file, the Database Engine makes the file 1 MB. The size specified for the primary file must be at least as large as the primary file of the model database.

Whereas, for the FILEGROWTH parameter, it says:

If FILEGROWTH is not specified, the default value is 1 MB for data files and 10% for log files, and the minimum value is 64 KB.


The documentation for SQL Server 2000's CREATE DATABASE is also consistent with it not coming from model:

If FILEGROWTH is not specified, the default value is 10 percent and the minimum value is 64 KB


Original answer:

By reading the MSDN page on the model database, you can infer that the answer is no, this isn't inherited. Firstly, we have:

When a CREATE DATABASE statement is issued, the first part of the database is created by copying in the contents of the model database. The rest of the new database is then filled with empty pages.

This would imply that the database files for the new database already exist before model is used. Also:

The following operations cannot be performed on the model database:

  • Adding files or filegroups.

If a new database was created by exactly duplicating the file structures on disk, and then cloning the sys.database_files rows in the master database, this restriction wouldn't be necessary.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜