|
发表于 2014-9-15 00:26:44
|
显示全部楼层
USE master;
go
IF DB_ID (N'NCDB') IS NOT NULL 说明:NCDB为数据库名称
DROP DATABASE [NCDB];
go
CREATE DATABASE [NCDB]
go
ALTER DATABASE [NCDB] ADD FILEGROUP [NNC_DATA01]
go
ALTER DATABASE [NCDB] ADD FILEGROUP [NNC_DATA02]
go
ALTER DATABASE [NCDB] ADD FILEGROUP [NNC_DATA03]
go
ALTER DATABASE [NCDB] ADD FILEGROUP [NNC_INDEX01]
go
ALTER DATABASE [NCDB] ADD FILEGROUP [NNC_INDEX02]
go
ALTER DATABASE [NCDB] ADD FILEGROUP [NNC_INDEX03]
go
ALTER DATABASE [NCDB] ADD FILE(NAME = N'nnc_data01', FILENAME = N'D:\Microsoft SQL Server\MSSQL$SQL1\data\nnc_data01_Data.NDF' , SIZE = 500, FILEGROWTH = 200) TO FILEGROUP [NNC_DATA01] 说明:此路径为数据文件存放路径
go
ALTER DATABASE [NCDB] ADD FILE(NAME = N'nnc_data02', FILENAME = N'D:\Microsoft SQL Server\MSSQL$SQL1\data\nnc_data02_Data.NDF' , SIZE = 500, FILEGROWTH = 200) TO FILEGROUP [NNC_DATA02]
go
ALTER DATABASE [NCDB] ADD FILE(NAME = N'nnc_data03', FILENAME = N'D:\Microsoft SQL Server\MSSQL$SQL1\data\nnc_data03_Data.NDF' , SIZE = 500, FILEGROWTH = 200) TO FILEGROUP [NNC_DATA03]
go
ALTER DATABASE [NCDB] ADD FILE(NAME = N'nnc_index01', FILENAME = N'D:\Microsoft SQL Server\MSSQL$SQL1\data\nnc_index01_Data.NDF' , SIZE = 200, FILEGROWTH = 100) TO FILEGROUP [NNC_INDEX01]
go
ALTER DATABASE [NCDB] ADD FILE(NAME = N'nnc_index02', FILENAME = N'D:\Microsoft SQL Server\MSSQL$SQL1\data\nnc_index02_Data.NDF' , SIZE = 200, FILEGROWTH = 100) TO FILEGROUP [NNC_INDEX02]
go
ALTER DATABASE [NCDB] ADD FILE(NAME = N'nnc_index03', FILENAME = N'D:\Microsoft SQL Server\MSSQL$SQL1\data\nnc_index03_Data.NDF' , SIZE = 200, FILEGROWTH = 100) TO FILEGROUP [NNC_INDEX03]
Go
-- 调整临时表空间
declare @name char(50)
declare @sql nvarchar(500)
select @name=rtrim(name) from tempdb.dbo.sysfiles where status & 0x40 != 0x40
set @sql='alter database tempdb modify file ( name='+@name+',size=300mb,filegrowth=10mb)'
exec master.dbo.sp_executesql @sql
|
|