次の方法で共有


DBFile Object

この機能は、将来のバージョンの Microsoft SQL Server では削除される予定です。新規の開発作業ではこの機能を使用しないようにし、現在この機能を使用しているアプリケーションは修正することを検討してください。

The DBFile object represents the properties of an operating system file used by Microsoft SQL Server for table and index data storage.

現在のオブジェクトを表す SQL-DMO オブジェクト モデル

Properties

FileGrowth Property

PhysicalName Property

FileGrowthInKB Property

PrimaryFile Property

FileGrowthType Property

Size Property

ID Property

SpaceAvailableInMB Property

MaximumSize Property

SizeInKB Property

Name Property

 

Methods

Remove Method (Objects)

解説

SQL Server can direct data storage for tables and indexes to specific operating system files. A single operating system file can contain data from only a single database. Within SQL Server, database data files are categorized by filegroup. A SQL Server database contains one or more filegroups containing one or more data files. This organization is reflected in the FileGroup and DBFile objects and collections.

All SQL Server databases contain a filegroup named PRIMARY. This filegroup contains the database primary data file. When using SQL Distributed Management Objects (SQL-DMO) to create a new SQL Server database, add a DBFile object to the FileGroup object named PRIMARY. After database creation, additional data files can be created and added to either the PRIMARY filegroup or to filegroups added to the database.

With the DBFile object, you can:

  • Create new operating system files for SQL Server database storage.
  • Manage the properties of SQL Server database growth.
  • Shrink the operating system files used by a database to reflect actual space used.

The Name property of a DBFile object uses the SQL Server data type sysname. The Name property value is used for the logical_file_name parameter in the CREATE DATABASE and ALTER DATABASE statements when files are added. The restrictions imposed on the logical_file_name parameter apply to the Name property of the DBFile object.

To create a data file for SQL Server database storage

  1. Create a DBFile object.

  2. Set the Name property.

  3. Set the PhysicalName property to the path and file name of the appropriate data file.

  4. Set the Size property. The Size property determines the size of the created data file and is specified in megabytes.

  5. Set optional properties, such as the Maximum (size) property.

  6. Get a FileGroup object from the FileGroups collection of a connected Database object.

  7. Add the DBFile object to the DBFiles collection of the selected FileGroup object.

参照

その他の技術情報

ALTER DATABASE (Transact-SQL)
CREATE DATABASE (Transact-SQL)

ヘルプおよび情報

SQL Server 2005 の参考資料の入手