msSQL2005数据库备份指令大全ITeye - 牛牛娱乐

msSQL2005数据库备份指令大全ITeye

2019年02月25日08时28分05秒 | 作者: 凝丝 | 标签: 备份,方针,日志 | 浏览: 2144

完好备份
Backup Database NorthwindCS
To disk=G:\Backup\NorthwindCS_Full_20070908.bak

差异备份
Backup Database NorthwindCS
To disk=G:\Backup\NorthwindCS_Diff_20070908.bak
With Differential

日志备份,默许切断日志
Backup Log NorthwindCS
To disk=G:\Backup\NorthwindCS_Log_20070908.bak

日志备份,不切断日志
Backup Log NorthwindCS
To disk=G:\Backup\NorthwindCS_Log_20070908.bak
With No_Truncate

切断日志不保存
Backup Log NorthwindCS
With No_Log

或许
Backup Log NorthwindCS
With Truncate_Only
切断之后日志文件不会变小
有必要能够进行缩短

文件备份
Exec Sp_Helpdb NorthwindCS 检查数据文件
Backup Database NorthwindCS
File=NorthwindCS 数据文件的逻辑名
To disk=G:\Backup\NorthwindCS_File_20070908.bak

文件组备份
Exec Sp_Helpdb NorthwindCS 检查数据文件
Backup Database NorthwindCS
FileGroup=Primary 数据文件的逻辑名
To disk=G:\Backup\NorthwindCS_FileGroup_20070908.bak
With init

切割备份到多个方针
康复的时分不允许丢掉任何一个方针
Backup Database NorthwindCS
To disk=G:\Backup\NorthwindCS_Full_1.bak
,disk=G:\Backup\NorthwindCS_Full_2.bak

镜像备份
每个方针都是相同的
Backup Database NorthwindCS
To disk=G:\Backup\NorthwindCS_Mirror_1.bak
Mirror
To disk=G:\Backup\NorthwindCS_Mirror_2.bak
With Format 第一次做镜像备份的时分格式化方针

镜像备份到本地和长途
Backup Database NorthwindCS
To disk=G:\Backup\NorthwindCS_Mirror_1.bak
Mirror
To disk=\\192.168.1.200\Backup\NorthwindCS_Mirror_2.bak
With Format

每天生成一个备份文件
Declare @Path Nvarchar(2000)
Set @Path =G:\Backup\NorthwindCS_Full_
+Convert(Nvarchar,Getdate(),112)+.bak

Backup Database NorthwindCS
To disk=@Path


从NoRecovery或许
Standby形式康复数据库为可用
Restore Database NorthwindCS_Bak
With Recovery

检查方针备份中的备份集
Restore HeaderOnly
From Disk =G:\Backup\NorthwindCS_Full_20070908.bak

检查方针备份的第一个备份集的信息
Restore FileListOnly
From Disk =G:\Backup\NorthwindCS_Full_20070908_2.bak
With File=1

检查方针备份的卷标
Restore LabelOnly
From Disk =G:\Backup\NorthwindCS_Full_20070908_2.bak

备份设置密码保护备份
Backup Database NorthwindCS
To disk=G:\Backup\NorthwindCS_Full_20070908.bak
With Password = 123,init

Restore Database NorthwindCS
From disk=G:\Backup\NorthwindCS_Full_20070908.bak
With Password = 123
版权声明
本文来源于网络,版权归原作者所有,其内容与观点不代表牛牛娱乐立场。转载文章仅为传播更有价值的信息,如采编人员采编有误或者版权原因,请与我们联系,我们核实后立即修改或删除。

猜您喜欢的文章

阅读排行

  • 1
  • 2

    Sql疑难问题ITeye

    数学家,部分,薪酬
  • 3

    主键与外键ITeye

    主键,数据库,数据
  • 4

    Oracle学习笔记(三)ITeye

    用户,权限,命令
  • 5

    mysql大数据量导出运用ITeye

    企图,运用,成果
  • 6
  • 7

    数据库连接池完成原理ITeye

    数据库,运用,体系
  • 8

    数据库连接符ITeye

    联系,区别,数据库
  • 9

    Informix ODBC设置ITeye

    东西,装备,官方网站
  • 10

    ORACLE的阻隔等级ITeye

    业务,修正,句子