![如何在 SQL Server 2008 中进行备份](https://linux22.com/image/515974/%E5%A6%82%E4%BD%95%E5%9C%A8%20SQL%20Server%202008%20%E4%B8%AD%E8%BF%9B%E8%A1%8C%E5%A4%87%E4%BB%BD.png)
我需要帮助我在 sql server 2008 中备份的菜单?谢谢
答案1
备份数据库?右键单击数据库,单击tasks
然后backup
或者在 T-SQL 中
BACKUP DATABASE YourDatabase TO DISK = N'C:\Backup\YourDatabase.bak'
WITH NOFORMAT, INIT, NAME = N'Full Database Backup',
SKIP, NOREWIND, NOUNLOAD, STATS = 10
GO
答案2
您可能会发现此 MSDN 页面很有帮助:
答案3
要备份数据库:
USE master
GO
BACKUP DATABASE MyDataBase TO DISK = N'C:\Program Files\Microsoft SQL Server\MSSQL10.SQLExpress\MSSQL\Backup\MyDataBase.bak'
WITH NOFORMAT, INIT, NAME = N'MyDataBase Full Database Backup', SKIP, NOREWIND, NOUNLOAD
GO
恢复:
USE master
GO
ALTER DATABASE MyDataBase SET SINGLE_USER WITH ROLLBACK IMMEDIATE
RESTORE DATABASE MyDataBase FROM DISK = N'C:\Program Files\Microsoft SQL Server\MSSQL10.SQLExpress\MSSQL\Backup\MyDataBase.bak'
WITH FILE = 1, NOUNLOAD, REPLACE
-- use with next if file names were changed
,MOVE 'MyDataBase' TO
N'C:\Program Files\Microsoft SQL Server\MSSQL10.SQLExpress\MSSQL\Data\MyDataBase.mdf'
,MOVE 'MyDataBase_log' TO
N'C:\Program Files\Microsoft SQL Server\MSSQL10.SQLExpress\MSSQL\Data\MyDataBase.log.ldf'
GO