create
database
databaseName
on primary
(
Name = dbName1,
FileName = ' C:\mydatabase1\dbName1.mdf ' ,
Size = 10MB,
MaxSize = 20MB,
FileGrowth = 10mb),
(
Name = dbName2,
FileName = ' C:\mydatabase2\dbName2.mdf ' ,
Size = 10MB,
MaxSize = 20MB,
FileGrowth = 10mb)
Log on
(
Name = dbLogName1,
Filename = ' C:\mydatabaseLog\dbLogName1.ldf ' ,
Size = 10mb,
MaxSize = 20mb,
FileGrowth = 10mb)
/*
Name sql server使用的逻辑名称
Filename 完全限定的NT Server 文件名
Size 文件的初始大小 ,默认值是model数据库主文件[model.mdf]的大小
MaxSize 最大的文件尺寸,默认值是占满整个空间
FileGrowth 当需要时,SQL Server拓展文件的量 。默认值10%
*/
-- ----------
-- -修改数据库----
-- 添加文件--
alter database databaseName
add File
(
Name = dbName3,
size = 10MB,
MaxSize = 20mb,
FileName = ' C:\dbName3.mdf ' ,
FileGrowth = 10mb
)
-- -移除文件-----
Alter Database databaseName
remove File dbName3
-- ----修改文件---------
alter database databaseName
Modify File
(
Name = dbName2,
Size = 15mb
)
on primary
(
Name = dbName1,
FileName = ' C:\mydatabase1\dbName1.mdf ' ,
Size = 10MB,
MaxSize = 20MB,
FileGrowth = 10mb),
(
Name = dbName2,
FileName = ' C:\mydatabase2\dbName2.mdf ' ,
Size = 10MB,
MaxSize = 20MB,
FileGrowth = 10mb)
Log on
(
Name = dbLogName1,
Filename = ' C:\mydatabaseLog\dbLogName1.ldf ' ,
Size = 10mb,
MaxSize = 20mb,
FileGrowth = 10mb)
/*
Name sql server使用的逻辑名称
Filename 完全限定的NT Server 文件名
Size 文件的初始大小 ,默认值是model数据库主文件[model.mdf]的大小
MaxSize 最大的文件尺寸,默认值是占满整个空间
FileGrowth 当需要时,SQL Server拓展文件的量 。默认值10%
*/
-- ----------
-- -修改数据库----
-- 添加文件--
alter database databaseName
add File
(
Name = dbName3,
size = 10MB,
MaxSize = 20mb,
FileName = ' C:\dbName3.mdf ' ,
FileGrowth = 10mb
)
-- -移除文件-----
Alter Database databaseName
remove File dbName3
-- ----修改文件---------
alter database databaseName
Modify File
(
Name = dbName2,
Size = 15mb
)