zoukankan      html  css  js  c++  java
  • 用dos命令备份和恢复sql server 数据库

    这里是批处理命令-----备份的

    delete
    d:restorecw_ft.bak delete d:restorecw_sd.bak sqlcmd -i "bak.sql"
    这是sqlcmd 备份的  
    :connect .
    BACKUP DATABASE cw_ft TO DISK = 'd: estorecw_ft.bak' WITH INIT go BACKUP DATABASE cw_sd TO DISK = 'd: estorecw_sd.bak' WITH INIT go
    这是批处理---恢复的
    sqlcmd -i "restore.sql"
    这是sqlcmd    恢复的

    :connect .
    USE master GO ALTER DATABASE [cw_ft] SET SINGLE_USER WITH ROLLBACK IMMEDIATE GO --查看是否还有用户连接 --SELECT * FROM sys.[sysprocesses] WHERE DB_NAME([dbid])='cw_ft' --GO ALTER DATABASE [cw_ft] SET MULTI_USER GO RESTORE DATABASE [cw_ft] FROM DISK = N'd: estorecw_ft.bak' WITH FILE = 1, NOUNLOAD, REPLACE, STATS = 10 go ALTER DATABASE [cw_sd] SET SINGLE_USER WITH ROLLBACK IMMEDIATE GO --查看是否还有用户连接 --SELECT * FROM sys.[sysprocesses] WHERE DB_NAME([dbid])='cw_sd' --GO ALTER DATABASE [cw_sd] SET MULTI_USER GO RESTORE DATABASE [cw_sd] FROM DISK = N'd: estorecw_sd.bak' WITH FILE = 1, NOUNLOAD, REPLACE, STATS = 10 go
  • 相关阅读:
    把字符串输入到表格里
    x 的 x 次方等于10,求 x
    java 中 二进制串与浮点数的相互转化
    堆栈 Objective-C NSString copy strong
    c一些学习过程中突然错过的细节
    视图控制器
    名词从句
    FastDFS
    Python
    http 提交表单数据
  • 原文地址:https://www.cnblogs.com/szyicol/p/5121436.html
Copyright © 2011-2022 走看看