--------------SQL Server 使用SQL语句将数据库进行备份或还原--------
SQL语句备份和恢复
SQL Server:
备份命令:
BACKUP DATABASE [要备份的数据库名]
TO disk = '[要备份的数据库保存路径:例如,d:\data\数据库名.bak]'
WITH FORMAT,
NAME = '这个是备注,随便写'
还原命令:
USE master
GO
RESTORE DATABASE [还原后的数据库名]
FROM disk = '[还原路径,例如:例如,d:\data\数据库名.bak]'
GO
-----------------------运用的实例--------------------------
BACKUP DATABASE BM_LOG
TO disk = 'E:\data\bm_LOG.bak'
WITH FORMAT,
NAME = '1234'
USE master
GO
RESTORE DATABASE bm_log
FROM disk = 'E:\data\bm_LOG.bak'
GO