Sqlserver
 SQL >> Database >  >> RDS >> Sqlserver

Backup e ripristino di un database come copia sullo stesso server

RESTORE FILELISTONLY è solo informativo, ma è fondamentale per scoprire i nomi logici dei file da usare nei comandi MOVE.

backup database test1 to disk='c:\test1_full.bak'
restore filelistonly from disk='c:\test1_full.bak'
restore database test2 from disk='c:\test1_full.bak'
with move 'test1' to 'C:\mssql\data\test2.mdf',
move 'test1_log' to 'C:\mssql\data\test2.ldf'

Mantenendo identici i nomi logici e cambiando i percorsi fisici, ottieni una seconda copia indipendente del database.