tempdb多文件处理
DECLARE @sql VARCHAR(max)
DECLARE @name VARCHAR(max)
DECLARE @path VARCHAR(max)
DECLARE @i VARCHAR(max)
SET @i=1
WHILE (@i<=48)
BEGIN
SET @name='tempdev'+CAST(@i AS VARCHAR(20))
SET @path='F:\tempdb\'+@name+'.ldf'
SET @sql='
USE [master]
ALTER DATABASE [tempdb]
ADD FILE ( NAME = N'''+@name+''',
FILENAME = N'''+@path+''' ,
SIZE = 3072KB ,
MAXSIZE = 512000KB ,
FILEGROWTH = 102400KB
)
'
EXEC( @sql)
set @i=@i+1
END