SQL Server 2016 introduces two new options to ALTER DATABASE statement which can be used to modify database files namely AUTOGROW_SINGLE_FILE and AUTOGROW_ALL_FILES.
In the earlier versions of SQL Server to achieve similar functionality you could use the trace flag 1117. This would allow all the files of the database to auto grow at the same time if they are configured files to auto grow.
This is Part 6 of 10 Part T-SQL Enhancements in SQL Server 2016 for Developers and DBAs. Click here to read it from the beginning….
One of the biggest disadvantages of using trace flag 1117 is that in the event of auto growth all the files of the database will grow. Since this trace flag is set at global level, all the databases residing on the SQL Server Instance will auto grow as per the relevant auto growth settings configured for each database file. This scenario would result in filling drive space faster.
Trending SQL Server Articles and Tips
- How to Export records from SQL Server to Text File using BCP Command
- How to Use Dedicated Administrator Connection in SQL Server
- Fix Cannot open user default database. Login failed. Login failed for user SQL Server Error
- How to Enable and Refresh IntelliSense in SQL Server Management Studio (SSMS)
- COPY_ONLY Backup in SQL Server Step by Step Tutorial with Examples
AUTOGROW_SINGLE_FILE: This is the default option used when a database is created in SQL Server 2016. Whenever, AUTO GROWTH is triggered it will only grow the particular DATA or LOG file leaving behind rest of the files available within the file group at their respective size.
Example ALTER DATABASE SET AUTOGROW_SINGLE_FILE
ALTER DATABASE Adventureworks MODIFY FILEGROUP [PRIMARY] AUTOGROW_SINGLE_FILE GO
Clicking Next Page button to continue reading the topics and click on the Previous Page button to revisit the previous topic.
- ALTER DATABASE SET AUTOGROW_ALL_FILES
- COMPRESS and DECOMPRESS Functions
- STRING_SPLIT and STRING_ESCAPE Functions
- FORMATMESSAGE Statement
- SERVERPROPERTY Function
- TRUNCATE TABLE WITH PARTITIONS
- DROP IF EXISTS
- ALTER TABLE WITH (ONLINE = ON | OFF)
- MAXDOP for DBCC CHECKDB, DBCC CHECKTABLE and DBCC CHECKFILEGROUP
- ALTER DATABASE SET AUTOGROW_SINGLE_FILE