Share via


LogFile Object

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

The LogFile object exposes the attributes of an operating system file used to maintain transaction log records for a Microsoft SQL Server database.

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

Properties

FileGrowth Property

Name Property

FileGrowthInKB Property

PhysicalName Property

FileGrowthType Property

Size Property

ID Property

SizeInKB Property

MaximumSize Property

 

Methods

Shrink Method

 

解説

SQL Server logs transactions applied to a database. Transaction logs assist in recovering database integrity in the event of system failure. Transaction log records for a single database are maintained on one or more operating system files called log files.

With the LogFile object, you can:

  • Create a database log file and add it to the list of operating system files available to a SQL Server database.
  • Determine the usage of a database log file.
  • Shrink the operating system file to reflect actual transaction log use.

The Name property of a LogFile object can contain up to 128 characters. The value of the Name property must be unique for all files, both log and data, used by a database.

To create an operating system file for transaction log records

  1. Create a LogFile object.

  2. Set the Name property.

  3. Set the PhysicalName property to the full operating system path and file name for the operating system file.

  4. Set the Size property to the initial size for the operating system file in megabytes (MB). If you do not specify a file size, a 2-MB file is created.

  5. Add the LogFile object to the LogFiles collection of a connected Database object.