作者:国邮国旅刘峰 | 来源:互联网 | 2023-09-25 06:09
第三课视频笔记:

联机丛书的使用

附加和分离数据库



---收缩数据库

--------数据库快照



create database testxx
on
(
NAME=testxx_DATA,
FILENAME='D:\SqlServerAll\testxx_DATA.mdf', --路径是在服务器上
SIZE=5MB,
MAXSIZE=20MB,
FILEGROWTH=5%
)
LOG ON
(
NAME=testxx_LOGO,
FILENAME='D:\SqlServerAll\testxx_LOGO.ldf',
SIZE=2MB,
MAXSIZE=10MB,
FILEGROWTH=1MB
)
--查看数据库状态界面 函数
select DATABASEPROPERTYEX('testxx','Version')
--查看数据库状态 存储过程
sp_helpdb
-------------------修改数据库 界面
alter database testxx modify name=xxoo
---------------s删除
drop database xxoo
--------------8 分离和附加数据库
--------9 数据库快照
--------10 创建数据库快照 正确
create database Cognos_snap
on(name=Cognos,filename='D:\SqlServerAll\cognos_snap.mdf')
as snapshot of Cognos
--从快照回复
RESTORE DATABASE Cognos from database_snapshot='Cognos_snap'
--数据库 'xxoo' 中不存在 文件'xxoo。name属性在数据库属性的文件--》文件名 查看。
create database xxoo_snap
on(name=testxx_DATA,filename='D:\SqlServerAll\testxx_DATA111.mdf')
as snapshot of xxoo
------------11 任务-》复制数据库