1、没有其他文件组
create database LibraryCC
on primary
(
name=librarycc_dat,
filename='D:MDataBaseLibrarylibraryccdat.mdf',
size=5,
maxsize=unlimited,
filegrowth=1
)
log on
(
name=librarycc_log,
filename='D:MDataBaseLibrarylibrarycclog.ldf',
size=3,
maxsize=10,
filegrowth=10%
)
2、使用文件组创建数据库
下面的示例使用三个文件组创建名为 sales 的数据库:
主文件组包含文件 Spri1_dat 和 Spri2_dat。指定这些文件的 FILEGROWTH 增量为 15%。
名为 SalesGroup1 的文件组包含文件 SGrp1Fi1 和 SGrp1Fi2。
名为 SalesGroup2 的文件组包含文件 SGrp2Fi1 和 SGrp2Fi2。
CREATE DATABASE Sales
ON PRIMARY
( name= SPri1_dat,
filename = 'c:program filesmicrosoft sql servermssqldataSPri1dat.mdf',
size = 10,
maxsize = 50,
filegrowth = 15% ),
( name= SPri2_dat,
filename = 'c:program filesmicrosoft sql servermssqldataSPri2dt.ndf',
size = 10,
maxsize= 50,
filegrowth = 15% ),
filegroup SalesGroup1
( name = SGrp1Fi1_dat,
filename = 'c:program filesmicrosoft sql servermssqldataSG1Fi1dt.ndf',
size = 10,
maxsize = 50,
filegrowh = 5 ),
( name= SGrp1Fi2_dat,
filename = 'c:program filesmicrosoft sql servermssqldataSG1Fi2dt.ndf',
size = 10,
maxsize = 50,
filegrowth = 5 ),
filegroup SalesGroup2
( name = SGrp2Fi1_dat,
filename = 'c:program filesmicrosoft sql servermssqldataSG2Fi1dt.ndf',
size = 10,
maxsize = 50,
filegrowth = 5 ),
( name= SGrp2Fi2_dat,
filename = 'c:program filesmicrosoft sql servermssqldataSG2Fi2dt.ndf',
size = 10,
maxsize = 50,
filegrowth = 5 )
log on
( name = 'Sales_log',
filename = 'c:program filesmicrosoft sql servermssqldatasalelog.ldf',
size = 5MB,
maxsize = 25MB,
filegrowth = 5MB )
go