| description | Increase the Size of a Database | ||||
|---|---|---|---|---|---|
| title | Increase the Size of a Database | Microsoft Docs | ||||
| ms.custom | |||||
| ms.date | 03/14/2017 | ||||
| ms.prod | sql | ||||
| ms.prod_service | database-engine | ||||
| ms.reviewer | |||||
| ms.technology | |||||
| ms.topic | conceptual | ||||
| helpviewer_keywords |
|
||||
| ms.assetid | 14f4206d-3afa-4ba9-9849-23e81d63306d | ||||
| author | WilliamDAssafMSFT | ||||
| ms.author | wiassaf | ||||
| monikerRange | >=sql-server-2016||>=sql-server-linux-2017 |
[!INCLUDE SQL Server]
This topic describes how to increase the size of a database in [!INCLUDEssnoversion] by using [!INCLUDEssManStudioFull] or [!INCLUDEtsql]. 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.
In This Topic
-
Before you begin:
-
To increase the size of a database, using:
- You cannot add or remove a file while a BACKUP statement is running.
Requires ALTER permission on the database.
-
In Object Explorer, connect to an instance of the [!INCLUDEssDEnoversion], and then expand that instance.
-
Expand Databases, right-click the database to increase, and then click Properties.
-
In Database Properties, select the Files page.
-
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.
-
To increase the size of the database by adding a new file, click Add and then enter the values for the new file. For more information, see Add Data or Log Files to a Database.
-
Click OK.
-
Connect to the [!INCLUDEssDE].
-
From the Standard bar, click New Query.
-
Copy and paste the following example into the query window and click Execute. This example increases the size of the file
test1dat3.
[!code-sqlDatabaseDDL#AlterDatabase5]
For more examples, see ALTER DATABASE File and Filegroup Options (Transact-SQL).