????????????????????SQL Server????????????SQL Server??δ????????????顣??????CREATE DATABASE?????????????????????SQL Server?????2???????
????????????????.mdf??
???????????????????.ldf??

???????????????????????????????????????????????£????????????SQL Server?洢???е???????????????????????ж???????????????????????????????????
????????????
????????????????????????????飬???????????????洢???????????????????????????????
???????????????????????С??
??????????????????????????饗???磬????????????????????????????
???????????????鼶????б???????????????????????????????????????????????
???????????????鼶??????DBCC CHECKDB?????????????????
?????????????????????????????飬?????????洢???????????????????????????????????洢SQL Server?????????????????
??????????
???????????????????????飬??????????????????????????????????????????????顣??????????????????????SQL Server??????????????е??????????ν????????????????Round Robin Allocation Algorithm?????????64K??????????洢???????64k??????????洢????????????????????洢??????????????????2??????????
????????????????SQL Server????????????????????λ????PFS??GAM??SGAM?????????????????????????????????????????????????TempDb?????????????????????SQL Server?????????????????????????????——?????ν????????????Proportional Fill Algorithm??????????????????????????????????????С??????????????????????????????????????????????????
??????????
????????????????????????????δ???????????????ж????????????????????д?????????????????CREATE DATABASE????????????????
-- Create a new database
CREATE DATABASE MultipleFileGroups ON PRIMARY
(
-- Primary File Group
NAME = 'MultipleFileGroups'??
FILENAME = 'C:Program FilesMicrosoft SQL ServerMSSQL11.SQL2012MSSQLDATAMultipleFileGroups.mdf'??
SIZE = 5MB??
MAXSIZE = UNLIMITED??
FILEGROWTH = 1024KB
)??
-- Secondary File Group
FILEGROUP FileGroup1
(
-- 1st file in the first secondary File Group
NAME = 'MultipleFileGroups1'??
FILENAME = 'C:Program FilesMicrosoft SQL ServerMSSQL11.SQL2012MSSQLDATAMultipleFileGroups1.ndf'??
SIZE = 1MB??
MAXSIZE = UNLIMITED??
FILEGROWTH = 1024KB
)??
(
-- 2nd file in the first secondary File Group
NAME = 'MultipleFileGroups2'??
FILENAME = 'C:Program FilesMicrosoft SQL ServerMSSQL11.SQL2012MSSQLDATAMultipleFileGroups2.ndf'??
SIZE = 1MB??
MAXSIZE = UNLIMITED??
FILEGROWTH = 1024KB
)
LOG ON
(
-- Log File
NAME = 'MultipleFileGroups_Log'??
FILENAME = 'C:Program FilesMicrosoft SQL ServerMSSQL11.SQL2012MSSQLDATAMultipleFileGroups.ldf'??
SIZE = 5MB??
MAXSIZE = UNLIMITED??
FILEGROWTH = 1024KB
)
GO
????????????????????????????????????????????飿???????ON???????????????飬???′????????
CREATE TABLE Customers
(
FirstName CHAR(50) NOT NULL??
LastName CHAR(50) NOT NULL??
Address CHAR(100) NOT NULL??
ZipCode CHAR(5) NOT NULL??
Rating INT NOT NULL??
ModifiedDate DATETIME NOT NULL??
)
ON [FileGroup1]
GO
????????????????????????????????顣???SQL Server????????μ?????????????????ON?????????????
????-- FileGroup1 gets the default filegroup?? where new database objects
????-- will be created
????ALTER DATABASE MultipleFileGroups MODIFY FILEGROUP FileGroup1 DEFAULT
????GO
????????????????????????????????????????????????????????????????????????????μ???????????洢??FileGroup1????顣
????-- The table will be created in the file group "FileGroup1"
????CREATE TABLE Test
????(
????Filler CHAR(8000)
????)
????GO