SQL Server 修改数据库

查看数据库信息
execute sp_helpdb Northwind
删除数据库

包括其中所有数据文件,在不使用本数据库的状态下才能执行。

drop database Northwind
修改数据库名
alter database Northwind modify name=Northwind_000

增添数据文件组3
alter database Northwind add filegroup G3
给文件组3增添数据文件
alter database Northwind add file
(   name=NorthwindG31,
    filename='d:\Northwind\NorthwindG31.ndf',
    size=1,maxsize=3,filegrowth=1
),
(   name=NorthwindG32,
    filename='d:\Northwind\NorthwindG32.ndf',
    size=1,maxsize=3,filegrowth=1
)
to filegroup G3
给文件组3增添日志文件
alter database Northwind add log file
(   name=NorthwindLog3,
    filename='d:\Northwind\Northwind3.ldf',
    size=1,maxsize=5,filegrowth=1
),
(   name=NorthwindLog4,
    filename='d:\Northwind\Northwind4.ldf',
    size=1,maxsize=5,filegrowth=1
)

修改数据文件属性
alter database Northwind modify file
(   name=NorthwindG31, --要修改的文件,不可修改 filename
    size=2,maxsize=6,filegrowth=2 --指定的 size 必须大于当前值
)
删除数据文件
alter database Northwind remove file Northwind2
--alter database Northwind remove file NorthwindLog
alter database Northwind remove file NorthwindLog2
alter database Northwind remove file NorthwindLog3
alter database Northwind remove file NorthwindLog4
alter database Northwind remove file NorthwindG31
alter database Northwind remove file NorthwindG32
先删除文件组中的文件,再删除文件组
alter database Northwind remove filegroup G3
alter database Northwind remove file NorthwindG21
alter database Northwind remove file NorthwindG22
alter database Northwind remove filegroup G2
alter database Northwind remove file NorthwindG11
alter database Northwind remove file NorthwindG12
alter database Northwind remove filegroup G1
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值