sql >> Base de Datos >  >> RDS >> Sqlserver

Crear una copia de la base de datos en el servidor sql 2012 express

Puede crear una copia de seguridad y restaurarla usando el siguiente script;

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

Luego restaurarlo;

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