• 用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
  • 相关阅读:
    第03组 Beta冲刺(4/5)
    第03组 Beta冲刺(3/5)
    第03组 Beta冲刺(2/5)
    第03组 Beta冲刺(1/5)
    第03组 Alpha冲刺(6/6)
    第03组 Alpha冲刺(5/6)
    软工实践个人总结
    最终作业
    Beta答辩总结
    Beta 冲刺(7/7)
  • 原文地址:https://www.cnblogs.com/szyicol/p/5121436.html
Copyright © 2020-2023  润新知