通过restore database时重命名数据库rename database

时间:2023-02-04 20:51:38

backup database testdb to disk='c:\testdb_ful.bak' with compression

backup log testdb to disk='c:\testdb_ful.trn' with compression

restore filelistonly from disk='c:\testdb_ful.bak'

restore database newtestdb from disk='c:\testdb_ful.bak'
with move 'testdb' to 'c:\newtestdb.mdf'
,move 'testdb_log' to 'c:\newtestdb_log.ldf'
,replace,norecovery

restore database newtestdb from disk='c:\testdb_ful.trn'
with replace,recovery