备份和恢复SQL SERVER 数据库脚本

2017/12/20 posted in  数据库
  • 备份脚本:BACKUP DATABASE [被备份的数据库名] TO DISK = '备份文件路径';
  • 离线脚本:ALTER DATABASE [数据库名] SET OFFLINE WITH ROOLBACK IMMEDIATE;
  • 恢复脚本:RESTORE DATABASE [被恢复的数据库名] FROM DISK = '备份文件路径';
  • 在线脚本:ALTER DATABASE [数据库名] SET ONLINE WITH ROOLBACK IMMEDIATE;