SQL Server Backup/Restore具體做什麼

來源:互聯網
上載者:User
微軟提供了一些Undocumented Trace Flags可以讓我們瞭解很多備份與還原的資訊,通過輸出的內容我們可以清楚的看到BACKUP/Restore都做了哪些事情。 因為這些是Undocumented ,所以微軟的建議是謹慎使用,如果要用的話需要有微軟工程師的指導,當然大家可以在自己的電腦上玩玩, 這樣可以看到備份與還原背後的故事。 這是我在自己電腦上做的測試:開啟TraceFlag

DBCC TRACEON(3004);

 

DBCC TRACEON(3014);

 

DBCC TRACEON(3604);

 

DBCC TRACEON(3605);

 

備份資料庫:

backup database AdventureWorks to disk ='d:\mssql\AdventureWorks.bak'

在Error log中可以看到下面的資訊:

BackupDatabase: Database AdventureWorks

Backup: Media open

Backup: Media ready to backup

Backup: Clearing differential bitmaps

Backup: Bitmaps cleared

BackupDatabase: Checkpoint done

Backup: Scanning allocation bitmaps

Backup: Done with allocation bitmaps

Calculating expected total data to write

Fid(1) ExpectedExt(2888) DiffMapAccurate(0)

Total (189267968)

BackupDatabase: Work estimates done

Backup: Leading metadata section done

Calculating expected total data to write

Fid(1) ExpectedExt(2888) DiffMapAccurate(0)

Total (189267968)

Backup:Copying data

Backup: DBReaderCount = 1

Backup data streams: Initial=189267968 Final=189267968 ExcessMode=0

Calculating expected total data to write

Fid(1) ExpectedExt(2888) DiffMapAccurate(0)

Total (189267968)

BackupDatabase: Database files done

Processed 23104 pages for database 'AdventureWorks', file 'AdventureWorks_Data' on file 2.
BackupLog: Family(0) StreamSize=0x10000

BackupLog: Family(0) StreamSize=0x0

BackupLog: Family(0) StreamSize=0x0

BackupLog: Family(0) StreamSize=0x0

BackupLog: Family(0) StreamSize=0x0

BackupLog: Family(0) StreamSize=0x0

BackupLog: Family(0) StreamSize=0x0

BackupLog: Family(0) StreamSize=0x0

Processed 1 pages for database 'AdventureWorks', file 'AdventureWorks_Log' on file 2.
BackupDatabase: Log files done

Backup: Trailing config done

Backup: MBC done

Writing backup history records

BACKUP DATABASE successfully processed 23105 pages in 2.169 seconds (83.221 MB/sec).
BackupDatabase: Finished

 然後做還原:

RestoreDatabase: Database AdventureWorks

Opening backup set

Restore: Configuration section loaded

Restore: Backup set is open

Restore: Planning begins

Halting FullText crawls on database AdventureWorks

Dismounting FullText catalogs

X-locking database: AdventureWorks

Restore: Planning complete

Restore: BeginRestore (offline) on AdventureWorks

Restore: PreparingContainers

Restore: Containers are ready

Restore: Restoring backup set

Restore: Transferring data to AdventureWorks

FileHandleCache: 0 files opened. CacheSize: 12

Restore: Data transfer complete on AdventureWorks

Processed 23104 pages for database 'AdventureWorks', file 'AdventureWorks_Data' on file 1.
Processed 6 pages for database 'AdventureWorks', file 'AdventureWorks_Log' on file 1.
Restore: Backup set restored

Restore-Redo begins on database AdventureWorks

Rollforward complete on database AdventureWorks

Restore: Done with fixups

Restore: Transitioning database to ONLINE

Restore: Restarting database for ONLINE

Restore: Database is restarted

Resuming any halted fulltext crawls

Restore: Writing history records

Writing backup history records

Restore: Done with MSDB maintenance

RESTORE DATABASE successfully processed 23110 pages in 2.531 seconds (71.331 MB/sec).
RestoreDatabase: Finished

 更多的Trace flag的資訊可以參考:Undocumented Trace Flags: Inside the Restore Processhttp://www.remotedbaexperts.com/Blog/2011/03/undocumented-trace-flags-inside-the-restore-process/
相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.