sqlserver技术分享—在线增加tempdb数据文件
发布时间:2021-06-29
USE[master]
GO
ALTER DATABASE [tempdb] ADD FILE ( NAME = N'tempdev02', FILENAME = N'D:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\DATA\temdev02.ndf' , SIZE = 1048576KB , FILEGROWTH = 131072KB )
GO
ALTER DATABASE [tempdb] ADD FILE ( NAME = N'tempdev03', FILENAME = N'D:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\DATA\temdev03.ndf' , SIZE = 1048576KB , FILEGROWTH = 131072KB )
GO
ALTER DATABASE [tempdb] ADD FILE ( NAME = N'tempdev04', FILENAME = N'D:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\DATA\temdev04.ndf' , SIZE = 1048576KB , FILEGROWTH = 10% )
GO
ALTER DATABASE [tempdb] ADD FILE ( NAME = N'tempdev05', FILENAME = N'D:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\DATA\temdev05.ndf' , SIZE = 1048576KB , FILEGROWTH = 10% )
GO
ALTER DATABASE [tempdb] ADD FILE ( NAME = N'tempdev06', FILENAME = N'D:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\DATA\temdev06.ndf' , SIZE = 1048576KB , FILEGROWTH = 10% )
GO
ALTER DATABASE [tempdb] ADD FILE ( NAME = N'tempdev07', FILENAME = N'D:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\DATA\temdev07.ndf' , SIZE = 1048576KB , FILEGROWTH = 10% )
GO
ALTER DATABASE [tempdb] ADD FILE ( NAME = N'tempdev08', FILENAME = N'D:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\DATA\temdev08.ndf' , SIZE = 1048576KB , FILEGROWTH = 10% )
GO
--加完后,确认一下:
sp_helpfile
go
GO
ALTER DATABASE [tempdb] ADD FILE ( NAME = N'tempdev02', FILENAME = N'D:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\DATA\temdev02.ndf' , SIZE = 1048576KB , FILEGROWTH = 131072KB )
GO
ALTER DATABASE [tempdb] ADD FILE ( NAME = N'tempdev03', FILENAME = N'D:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\DATA\temdev03.ndf' , SIZE = 1048576KB , FILEGROWTH = 131072KB )
GO
ALTER DATABASE [tempdb] ADD FILE ( NAME = N'tempdev04', FILENAME = N'D:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\DATA\temdev04.ndf' , SIZE = 1048576KB , FILEGROWTH = 10% )
GO
ALTER DATABASE [tempdb] ADD FILE ( NAME = N'tempdev05', FILENAME = N'D:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\DATA\temdev05.ndf' , SIZE = 1048576KB , FILEGROWTH = 10% )
GO
ALTER DATABASE [tempdb] ADD FILE ( NAME = N'tempdev06', FILENAME = N'D:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\DATA\temdev06.ndf' , SIZE = 1048576KB , FILEGROWTH = 10% )
GO
ALTER DATABASE [tempdb] ADD FILE ( NAME = N'tempdev07', FILENAME = N'D:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\DATA\temdev07.ndf' , SIZE = 1048576KB , FILEGROWTH = 10% )
GO
ALTER DATABASE [tempdb] ADD FILE ( NAME = N'tempdev08', FILENAME = N'D:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\DATA\temdev08.ndf' , SIZE = 1048576KB , FILEGROWTH = 10% )
GO
--加完后,确认一下:
sp_helpfile
go