How do I add new data or log files to a database?

Document ID : KB000053640
Last Modified Date : 14/02/2018
Show Technical Document Details


You can 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

  1. Connect to an instance of the SQL Server 2005 Database Engine in the SQL Server Management Studio Object Explorer.

  • Expand the instance.

  • Expand Databases and select the database for which you add files.

  • Right-click the database from which to add the files, and click Properties.

  • Select the Files page in the Database Properties dialog.

  • Click Add to add a data or transaction log file.

  • Type a logical name for the file in the Database files grid.
    Note: The file name must be unique within the database.

  • Select the file type, data or log.

  • Select the filegroup in which the file should be included from the list for a data file. (Or) select <new filegroup> to create a new filegroup.
    Note: 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.

  • Click (...) in the Autogrowth column to specify how the file should grow. Select from the following options:
    1. Select the Enable Autogrowth check box to allow for the currently selected file to grow as more data space is required. Select from the following options:
    2. Select In Megabytes and specify a value to specify that the file should grow by fixed increments.
    3. Select In Percent and specify a value to specify that the file should grow by a percentage of the current file size.

  • Select from the following options to specify the maximum file size limit:
    1. Select Restricted File Growth (MB) and specify a value to specify the maximum size the file should be able to grow to.
    2. Select Unrestricted File Growth to allow for the file to grow as much as needed.
    3. Clear the Enable Autogrowth check box to prevent the file from growing.
      The size of the file will not grow beyond the value specified in the Initial Size (MB) column.
      Note: 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.
    Note: 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.

  • Click OK.