This article for everyone to share the SQL Server database recovery backup two methods for your reference, the specific contents are as follows
The first approach: usually we use the way to restore backup, select the target database, select the source device for recovery.
Screenshot below:
The second way: This is sometimes inconvenient, and scripting is more convenient, using the following script.
/*
backup Data db to. bak file. Then use this BAK file to restore a new database dbtest.
*/
Use master
BACKUP DATABASE DB to
disk = ' E:\DBTest.bak '
RESTORE filelistonly from
DISK = ' E:\DBTest.bak '
RESTORE DATABASE dbtest
From DISK = ' E:\DBTest.bak '
and move ' dbtest ' to ' E:\Program Files\Microsoft SQL Server2005\data\dbtest.mdf ', Move
' dbtest_log ' to ' E:\Program Files\Microsoft SQL Server2005\data\dbtest_log.ldf ',
STATS = ten, REPLACE go
Note:
STATS = 10% shows one record per completion
REPLACE Use BAK to restore the database, force restore
dbtest and dbtest_log are above g:\back. The logical file in Bak
The above is the SQL Server database restore backup method, I hope to help you learn.