Skip to content

Latest commit

 

History

History
73 lines (48 loc) · 2.59 KB

File metadata and controls

73 lines (48 loc) · 2.59 KB
title Increase the Size of a Database
description Increase the Size of a Database
author WilliamDAssafMSFT
ms.author wiassaf
ms.reviewer randolphwest
ms.date 11/21/2024
ms.service sql
ms.topic how-to
helpviewer_keywords
databases [SQL Server], size
increasing database size
database size [SQL Server], increasing
size [SQL Server], databases
monikerRange >=sql-server-2016 || >=sql-server-linux-2017

Increase the size of a database

[!INCLUDE SQL Server]

This article describes how to increase the size of a database in [!INCLUDE ssnoversion] by using [!INCLUDE ssManStudioFull] or [!INCLUDE tsql]. The database is expanded by either increasing the size of an existing data or log file, or by adding a new file to the database.

Limitations

You can't add or remove a file while a BACKUP statement is running.

Permissions

Requires ALTER permission on the database.

Use SQL Server Management Studio

  1. In Object Explorer, connect to an instance of the [!INCLUDE ssDEnoversion], and then expand that instance.

  2. Expand Databases, right-click the database to increase, and then select Properties.

  3. In Database Properties, select the Files page.

  4. To increase the size of an existing file, increase the value in the Initial Size (MB) column for the file. You must increase the size of the database by at least 1 megabyte.

  5. To increase the size of the database by adding a new file, select Add and then enter the values for the new file. For more information, see Add Data or Log Files to a Database.

  6. Select OK.

Use Transact-SQL

  1. Connect to the [!INCLUDE ssDE].

  2. From the Standard bar, select New Query.

  3. Copy and paste the following example into the query window and select Execute.

    This example changes the size of the file test1dat3 to 200 MB.

    USE master;
    GO
    
    ALTER DATABASE AdventureWorks2022
        MODIFY FILE (NAME = test1dat3, SIZE = 200 MB);
    GO

For more examples, see ALTER DATABASE (Transact-SQL) File and Filegroup Options.

Related content