微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

SQLSERVER 压缩服务器端备份文件

一、在sql2000当中

   use master

  backup database zy to disk='C:/db.bak' with noinit  --备份

  use master exec xp_makecab 'c:/db.cab',mszip,1,'c:/db.bak'     --mszip 压缩方式

二、在sql2005当中

  首先在sqlSERVER 外围应用配置器中启用xp_cmdshell.

  use master

  exec xp_cmdshell "makecab c:/db.bak  d:/db.cab"  --调用系统命令 makecab

三、复制文件

    exec xp_cmdshell "copy d:/db.cab f:/db.cab"

----------------------------原形--------------------------------------

用   xp_cmdshell   调用system32下的makecab.exe可以压缩文件 使用方法:命令行下输入命令 MAKECAB   [/V[n]]   [/D   var=value   ...]   [/L   dir]   source   [destination] MAKECAB   [/V[n]]   [/D   var=value   ...]   /F   directive_file   [...]     source                   File   to   compress.     destination         File   name   to   give   compressed   file.     If   omitted,  the                                   last   character   of   the   source   file   name   is   replaced                                   with   an   underscore   (_)   and   used   as   the   destination.     /F   directives     A   file   with   MakeCAB   directives   (may   be   repeated).     /D   var=value       Defines   variable   with   specified   value.     /L   dir                   Location   to   place   destination   (default   is   current   directory).     /V[n]                     Verbosity   level   (1..3).

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐