You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This topic describes how to increase the size of a database in [!INCLUDE[ssnoversion](../../includes/ssnoversion-md.md)] by using [!INCLUDE[ssManStudioFull](../../includes/ssmanstudiofull-md.md)] or [!INCLUDE[tsql](../../includes/tsql-md.md)]. 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.
20
-
21
-
**In This Topic**
22
-
23
-
-**Before you begin:**
24
-
25
-
[Limitations and Restrictions](#Restrictions)
26
-
27
-
[Security](#Security)
28
-
29
-
-**To increase the size of a database, using:**
30
-
31
-
[SQL Server Management Studio](#SSMSProcedure)
32
-
33
-
[Transact-SQL](#TsqlProcedure)
34
-
35
-
## <aname="BeforeYouBegin"></a> Before You Begin
36
-
37
-
### <aname="Restrictions"></a> Limitations and Restrictions
38
-
39
-
- You cannot add or remove a file while a BACKUP statement is running.
40
-
41
-
### <aname="Security"></a> Security
42
-
43
-
#### <aname="Permissions"></a> Permissions
44
-
Requires ALTER permission on the database.
45
-
46
-
## <aname="SSMSProcedure"></a> Using SQL Server Management Studio
47
-
48
-
#### To increase the size of a database
49
-
50
-
1. In **Object Explorer**, connect to an instance of the [!INCLUDE[ssDEnoversion](../../includes/ssdenoversion-md.md)], and then expand that instance.
51
-
52
-
2. Expand **Databases**, right-click the database to increase, and then click **Properties**.
53
-
54
-
3. In **Database Properties**, select the **Files** page.
55
-
56
-
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.
57
-
58
-
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](../../relational-databases/databases/add-data-or-log-files-to-a-database.md).
59
-
60
-
6. Click **OK**.
61
-
62
-
## <aname="TsqlProcedure"></a> Using Transact-SQL
63
-
64
-
#### To increase the size of a database
65
-
66
-
1. Connect to the [!INCLUDE[ssDE](../../includes/ssde-md.md)].
67
-
68
-
2. From the Standard bar, click **New Query**.
69
-
70
-
3. Copy and paste the following example into the query window and click **Execute**. This example increases the size of the file `test1dat3`.
For more examples, see [ALTER DATABASE File and Filegroup Options (Transact-SQL)](../../t-sql/statements/alter-database-transact-sql-file-and-filegroup-options.md).
75
-
76
-
## See Also
77
-
[Add Data or Log Files to a Database](../../relational-databases/databases/add-data-or-log-files-to-a-database.md)
78
-
[Shrink a Database](../../relational-databases/databases/shrink-a-database.md)
This article describes how to increase the size of a database in [!INCLUDE [ssnoversion](../../includes/ssnoversion-md.md)] by using [!INCLUDE [ssManStudioFull](../../includes/ssmanstudiofull-md.md)] or [!INCLUDE [tsql](../../includes/tsql-md.md)]. 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.
22
+
23
+
## Limitations
24
+
25
+
You can't add or remove a file while a `BACKUP` statement is running.
26
+
27
+
## Permissions
28
+
29
+
Requires `ALTER` permission on the database.
30
+
31
+
<aid="SSMSProcedure"></a>
32
+
33
+
## Use SQL Server Management Studio
34
+
35
+
1. In **Object Explorer**, connect to an instance of the [!INCLUDE [ssDEnoversion](../../includes/ssdenoversion-md.md)], and then expand that instance.
36
+
37
+
1. Expand **Databases**, right-click the database to increase, and then select **Properties**.
38
+
39
+
1. In **Database Properties**, select the **Files** page.
40
+
41
+
1. 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.
42
+
43
+
1. 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](add-data-or-log-files-to-a-database.md).
44
+
45
+
1. Select **OK**.
46
+
47
+
<aid="TsqlProcedure"></a>
48
+
49
+
## Use Transact-SQL
50
+
51
+
1. Connect to the [!INCLUDE [ssDE](../../includes/ssde-md.md)].
52
+
53
+
1. From the Standard bar, select **New Query**.
54
+
55
+
1. Copy and paste the following example into the query window and select **Execute**.
56
+
57
+
This example changes the size of the file `test1dat3` to 200 MB.
58
+
59
+
```sql
60
+
USE master;
61
+
GO
62
+
63
+
ALTERDATABASE AdventureWorks2022
64
+
MODIFY FILE (NAME = test1dat3, SIZE =200 MB);
65
+
GO
66
+
```
67
+
68
+
For more examples, see [ALTER DATABASE (Transact-SQL) File and Filegroup Options](../../t-sql/statements/alter-database-transact-sql-file-and-filegroup-options.md).
69
+
70
+
## Related content
71
+
72
+
-[Add Data or Log Files to a Database](add-data-or-log-files-to-a-database.md)
0 commit comments