如何在 SQL Server 2008 中进行备份

如何在 SQL Server 2008 中进行备份

我需要帮助我在 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 页面很有帮助:

如何:备份数据库 (SQL Server Management Studio)

答案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

相关内容