Sqlserver
 sql >> Base de Dados >  >> RDS >> Sqlserver

Criar cópia do banco de dados no sql server 2012 express


Você pode criar um backup e restaurá-lo usando o script a seguir;
--To backup Database (Delete the previous backup first)
BACKUP DATABASE ExistingDb --Database Name
TO DISK = 'C:\DBBackup\ExistingDb.bak' WITH INIT --Path of backup location

Em seguida, restaure-o;
RESTORE DATABASE NewDbName  -- use your new db name
FROM  DISK = N'C:\DBBackup\ExistingDb.bak'  --Path of backup location
WITH  REPLACE,RECOVERY,  
MOVE N'Reporting' TO N'C:\Databases\MDF\NewDbName.mdf',  --logical name and physical name 
MOVE N'Reporting_log' TO N'C:\Databases\LDF\NewDbName.ldf' --logical name and physical name