简体   繁体   English

在SQL Server 2008中创建新数据库时,是否应从模型数据库继承FILEGROWTH设置?

[英]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.

相关问题 在 SQL Server 2008 中创建新数据库时,自动关闭选项是什么? - What is the Auto-Close option when creating a new database in SQL Server 2008? SQL Server 2008 Filestream:使用filestream创建数据库时出错 - SQL Server 2008 Filestream: Error when creating database with filestream 根据SQL Server 2008中的属性从大型数据库创建视图 - Creating Views from a large database on the basis of attributes in SQL server 2008 创建数据库架构SQL Server 2008时出现问题 - problem creating a database schema sql server 2008 如何使用SQL Server 2008 R2将数据库从现有数据库sql脚本复制到新数据库sql脚本? - How to copy Database from existing to new database sql script using sql server 2008 R2? 使用SQL Server 2008创建SQL Server 2000数据库 - Creating SQL Server 2000 database using SQL Server 2008 MS-SQL:一般更改数据库的 FileGrowth 参数 - MS-SQL: Changing the FileGrowth parameters of a database generically 将SQL Server 2008数据库架构克隆到新数据库-以编程方式(PHP?) - Cloning an SQL Server 2008 Database Schema to a new Database - Programatically (PHP?) 从数据库中选择 SQL Server 2008 指标? - Selecting SQL Server 2008 metrics from a database? 使用VBS(SQL DMO)创建SQL Server 2008 R2数据库时出错 - Error when creating a SQL Server 2008 R2 database using VBS (SQL DMO)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM