BACKUP DATABASE [源数据库名]
TO DISK = N'G:\testbackup.bak'
WITH COMPRESSION,NOUNLOAD , NAME = N'源数据库名',FORMAT, CHECKSUM
RESTORE DATABASE [目标数据库名]
FROM DISK = N'G:\testbackup.bak' WITH FILE = 1,
MOVE N'源数据库名' TO N'D:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER2008\MSSQL\DATA\目标数据库名.mdf',
MOVE N'源数据库名_log' TO N'D:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER2008\MSSQL\DATA\目标数据库名.LDF'
, NOUNLOAD, REPLACE, STATS = 5