Increase the Size of a Database - SQL Server (2024)

  • Article

Applies to: Increase the Size of a Database - SQL Server (1) SQL Server

This topic describes how to increase the size of a database in SQL Server by using SQL Server Management Studio or Transact-SQL. 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

Limitations and Restrictions

  • You cannot add or remove a file while a BACKUP statement is running.

Security

Permissions

Requires ALTER permission on the database.

Using SQL Server Management Studio

To increase the size of a database

  1. In Object Explorer, connect to an instance of the SQL Server Database Engine, and then expand that instance.

  2. Expand Databases, right-click the database to increase, and then click 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, click Add and then enter the values for the new file. For more information, see Add Data or Log Files to a Database.

  6. Click OK.

Using Transact-SQL

To increase the size of a database

  1. Connect to the Database Engine.

  2. From the Standard bar, click New Query.

  3. Copy and paste the following example into the query window and click Execute. This example increases the size of the file test1dat3.

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

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

See Also

Add Data or Log Files to a Database
Shrink a Database

Increase the Size of a Database - SQL Server (2024)
Top Articles
Latest Posts
Article information

Author: Rubie Ullrich

Last Updated:

Views: 6077

Rating: 4.1 / 5 (52 voted)

Reviews: 83% of readers found this page helpful

Author information

Name: Rubie Ullrich

Birthday: 1998-02-02

Address: 743 Stoltenberg Center, Genovevaville, NJ 59925-3119

Phone: +2202978377583

Job: Administration Engineer

Hobby: Surfing, Sailing, Listening to music, Web surfing, Kitesurfing, Geocaching, Backpacking

Introduction: My name is Rubie Ullrich, I am a enthusiastic, perfect, tender, vivacious, talented, famous, delightful person who loves writing and wants to share my knowledge and understanding with you.