Add & Remove SQL Server tempdb

Add tempdb

• SQL Server Management Studio

Open the SQL Server Management Studio. Expand Databases tree > System Databases. Right click on tempdb and choose Properties. Choose Files page. Click on Add and fill in the requirements as below (example).

SQL Server Studio - Add tempdb

• Transact SQL
Execute below command.

ALTER database tempdb add file 
(name = tempdev2, filename = 'C:\tempbak\tempdb.ndf', 
size = 300MB, filegrowth= 10%)

go

Remove tempdb

• SQL Server Management Studio
Follow as per adding tempdb using SQL Server Management Studio. Highlight the tempdb and click on Remove.

• ALTER command
Execute below command.

ALTER DATABASE tempdb REMOVE FILE tempdev2
The file "C:\tempbak\tempdb.ndf" has been modified in the system catalog. 
The new path will be used the next time the database is started.
The file 'tempdev2' has been removed.

You May Also Like

Leave a Reply?