SQL Server 2008如何copy database:
方法一:使用Microsoft SQL Server Management Studio中的Copy Database Wizard来辅助完成。(很容易失败)
方法二:采取Backup/Restore的方式(推荐)
a.备份数据库到磁盘
BACKUP DATABASE Source_Database TO DISK = 'D:\Backup\Source_Database.bak' WITH FORMAT;
RESTORE FILELISTONLY FROM DISK = 'D:\Backup\Source_Database.bak';
CREATE DATABASE Target_Database;
/* 利用bak恢复数据库,强制还原(REPLACE) STATS = 10 每完成10%显示一条记录 Source_Database和Source_Database_log是上面D:\Backup\Source_Database.bak里的逻辑文件 */ RESTORE DATABASE Target_Database FROM DISK='D:\Backup\Source_Database.bak' WITH MOVE 'Source_Database' TO 'C:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\DATA\Target_Database.mdf', MOVE 'Source_Database_log' TO 'C:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\DATA\Target_Database_log.ldf', STATS = 10,REPLACE
SQL Server 2008如何copy database
原文地址:http://blog.csdn.net/tianshijianbing1989/article/details/41013885