RESTORE DATABASE with FILE Simple instance description

Source: Internet
Author: User

--by chance, in the book, test


--Empty the backup record (execute a command on the line) and execute it in the test library. ~ use
msdb;
exec sp_delete_backuphistory ' 2014-10-27 ';
exec sp_delete_database_backuphistory ' TEST ';

--Note: Backup
DATABASE TEST to
DISK = ' E:\TEST2014 ' full-variance-log backup with the same name. BAK ' with
init,description = ' full backup '

backup DATABASE TEST to
DISK = ' E:\TEST2014. BAK ' with
differential,description = ' DIFF backup '

backup LOG TEST to
DISK = ' E:\TEST2014. BAK '
with DESCRIPTION = ' LOG BACKUP '-


-can be viewed, [TEST2014. BAK] is an external backup set.
SELECT * FROM msdb.dbo.backupmediafamily
SELECT *-msdb.dbo.backupmediaset
Select position, * from msdb.dbo.backupset--position Specifies the file order


RESTORE DATABASE TEST from
DISK = ' E:\TEST2014. BAK ' with
FILE = 1, NORECOVERY, REPLACE

RESTORE DATABASE TEST from
DISK = ' E:\TEST2014. BAK ' with
FILE = 2, NORECOVERY

--skips the previous differential direct restore log, restores the most recent variance by default, and this log
restore DATABASE TEST from  
DISK = ' E:\TEST2014. BAK '
with FILE = 3, RECOVERY


When you restore a database from the interface, select what the source database can look at:




--	When the backup record is emptied out of the source database, only the backup set is found from the source device;--	you can see that previous backup of the same name is in the same set;
--	when you add a full backup, Noformat, Noinit does not work, so there can be only one full backup;




Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.