[英]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. 在SQL Server中,“模型”数据库显然在创建新数据库时充当一种模板。 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.
但是,我观察到FILEGROWTH属性未被新数据库继承。
This (somewhat old) 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 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 但是,在这篇文章中,实际上有人在问类似的问题: 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; 所以我的问题是,模型数据库的FILEGROWTH属性应如何影响新数据库? and has this behaviour changed between versions of SQL Server?
并在不同版本的SQL Server之间更改了此行为?
The documentation for CREATE DATABASE
has this to say about the SIZE
parameter: CREATE DATABASE
的文档中有关于SIZE
参数的说法:
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.
如果指定了辅助数据文件或日志文件,但未为文件指定大小,则数据库引擎会将文件设为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: 而对于
FILEGROWTH
参数,它表示:
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.
如果未指定FILEGROWTH,则数据文件的默认值为1 MB,日志文件的默认值为10%,最小值为64 KB。
The documentation for SQL Server 2000's CREATE DATABASE
is also consistent with it not coming from model : SQL Server 2000的
CREATE DATABASE
的文档也与非model一致:
If FILEGROWTH is not specified, the default value is 10 percent and the minimum value is 64 KB
如果未指定FILEGROWTH,则默认值为10%,最小值为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. 通过阅读模型数据库上的MSDN页面,您可以推断出答案是否定的,这不是继承的。 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.
发出CREATE 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. 如果通过完全复制磁盘上的文件结构,然后在master数据库中克隆
sys.database_files
行来创建新数据库,则不需要此限制。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.