Restore filelistonly & headeronly & labelonly & verifyonly

Source: Internet
Author: User
Instructions

-- List backup content

Restore filelistonly from disk = 'C: \ northwind \ 2012_46 \ northwind_20121115_log.bak'

 

-- Restore headeronly searches all backup headers of all backup sets on a specific backup device. The result of executing restore headeronly is a result set.

Restore headeronly from disk = 'C: \ northwind \ 2012_46 \ northwind_20121116_155022_full.bak'

 

-- Restore labelonly returns a result set consisting of information about the backup media identified by the specified backup device.

Restore labelonly from disk = 'C: \ northwind \ 2012_46 \ northwind_20121116_154237_full.bak'

-- Restore verifyonly verifies the backup but does not restore the backup. Check whether the backup set is complete and whether all volumes are readable.
-- However, restore verifyonly does not attempt to verify the data structure in the backup volume. If the backup is valid, Microsoft SQL Server 2000 returns the message "This backup set is valid ".

Restore verifyonly from disk = 'C: \ northwind \ 2012_46 \ northwind_20121116_140924_log.bak'

 

 

Demo

-- List all database files

Select * From sysaltfiles s

 

-- Modify the file name
-- Link: http://blog.erp100.com/home.php? MoD = Space & uid = 101227 & Do = Blog & id = 13554900

Alter database northwind Modify file (name = northwind_log, newname = northwind_log _)

 

-- Displays the number of rows, the disk space reserved, and the disk space used by the tables in the current database, or the disk space reserved and used by the entire database.

Exec sp_spaceused [[@ objname =] 'objname'] [, [@ updateusage =] 'updateusage']

 

-- Add a temp table and insert the results of restore filelistonly.

Create Table # T (LN nvarchar (128), PN nvarchar (260), TP char (1), FGN nvarchar (128), SZ numeric (20, 0 ), msz numeric (20, 0)
insert into # T exec ('Restore filelistonly from disk ='' C: \ northwind \ 2012_47 \ northwind_20121119_193715_full.bak ''')
select * from # T
drop table # T

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.