I can't seem to find any SQL that will clone one database in SQL Server within the same server.
Let's say I have a database called MyDB
. I simply want to make a copy of MyDB
to MyDb2
. I thought that this would work:
BACKUP DATABASE MyDB TO MyDB2;
But I get this error when I try to execute it:
Backup device 'DbTestBack' does not exist. To view existing backup devices, use the sys.backup_devices catalog view. To create a new backup device use either sp_addumpdevice or SQL Server Management Studio.
Does anyone know what the best way to do this is? I want an exact duplicate of the original including security permissions.