SCRIPT: TempDB initial file size

 --------- Below query would show current size of TempDB files -----------

SELECT name

              ,size*8.0/1024 'Current Size in MB' 

FROM   tempdb.sys.database_files

--------- Below query would show Iniial size of TempDB files -----------

SELECT name

              ,size*8.0/1024  'Initial Size in MB'

FROM master.sys.sysaltfiles WHERE dbid = 2  


-- remove file

ALTER DATABASE [tempdb]  REMOVE FILE [tempvent]

GO

-- add additional to files

ALTER DATABASE [tempdb] ADD FILE (NAME = N'tempdev9', FILENAME = N'U:\MSSQL\TempDB\tempdev9.ndf' , SIZE = 115GB);

-- modify file size

ALTER DATABASE tempdb MODIFY FILE ( NAME = tempdev, SIZE = 115GB )

REFERENCE

Comments