How to: Add Data or Log Files to a Database (SQL Server Management Studio)
This topic describes how to add data or log files to a database by using Object Explorer in SQL Server Management Studio.
To add data or log files to a database
In Object Explorer, connect to an instance of the SQL Server 2005 Database Engine and then expand that instance.
Expand Databases, right-click the database from which to add the files, and then click Properties.
In the Database Properties dialog box, select the Files page.
To add a data or transaction log file, click Add.
In the Database files grid, enter a logical name for the file. The file name must be unique within the database.
Select the file type, data or log.
For a data file, select the filegroup in which the file should be included from the list, or select <new filegroup> to create a new filegroup. Transaction logs cannot be put in filegroups.
Specify the initial size of the file. Make the data file as large as possible, based on the maximum amount of data you expect in the database. For more information, see Using Files and Filegroups to Manage Database Growth.
To specify how the file should grow, click (…) in the Autogrowth column. Select from the following options:
- To allow for the currently selected file to grow as more data space is required, select the Enable Autogrowth check box and then select from the following options:
- To specify that the file should grow by fixed increments, select In Megabytes and specify a value.
- To specify that the file should grow by a percentage of the current file size, select In Percent and specify a value.
To specify the maximum file size limit, select from the following options:
- To specify the maximum size the file should be able to grow to, select Restricted File Growth (MB) and specify a value.
- To allow for the file to grow as much as needed, select Unrestricted File Growth.
- To prevent the file from growing, clear the Enable Autogrowth check box. The size of the file will not grow beyond the value specified in the Initial Size (MB) column.
The maximum database size is determined by the amount of disk space available and the licensing limits determined by the version of SQL Server that you are using.
Specify the path for the file location. The specified path must exist before adding the file.
By default, the data and transaction logs are put on the same drive and path to accommodate single-disk systems, but may not be optimal for production environments. For more information, see Understanding Files and Filegroups.