<!-- [if gte mso 9]><xml> <w:WordDocument> <w:View>Normal</w:View> <w:Zoom>0</w:Zoom> <w:PunctuationKerning/> <w:DisplayHorizontalDrawingGridEvery>0</w:DisplayHorizontalDrawingGridEvery> <w:DisplayVerticalDrawingGridEvery>2</w:DisplayVerticalDrawingGridEvery> <w:ValidateAgainstSchemas/> <w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid> <w:IgnoreMixedContent>false</w:IgnoreMixedContent> <w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText> <w:Compatibility> <w:SpaceForUL/> <w:BalanceSingleByteDoubleByteWidth/> <w:DoNotLeaveBackslashAlone/> <w:ULTrailSpace/> <w:DoNotExpandShiftReturn/> <w:AdjustLineHeightInTable/> <w:BreakWrappedTables/> <w:SnapToGridInCell/> <w:WrapTextWithPunct/> <w:UseAsianBreakRules/> <w:DontGrowAutofit/> <w:UseFELayout/> </w:Compatibility> <w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel> </w:WordDocument> </xml><![endif]--><!-- [if gte mso 9]><xml> <w:LatentStyles DefLockedState="false" LatentStyleCount="156"> </w:LatentStyles> </xml><![endif]--><!-- [if !mso]> <object classid="clsid:38481807-CA0E-42D2-BF39-B33AF135CC4D" id=ieooui> </object> <style> st1/:*{behavior:url(#ieooui) } </style> <![endif]--><!-- [if gte mso 10]> <style> /* Style Definitions */ table.MsoNormalTable {mso-style-name:表格內文; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-parent:""; mso-padding-alt:0cm 5.4pt 0cm 5.4pt; mso-para-margin:0cm; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:10.0pt; font-family:"Times New Roman"; mso-fareast-font-family:"Times New Roman"; mso-ansi-language:#0400; mso-fareast-language:#0400; mso-bidi-language:#0400;} </style> <![endif]-->
/*
<!-- [if gte mso 9]><xml> <w:WordDocument> <w:View>Normal</w:View> <w:Zoom>0</w:Zoom> <w:PunctuationKerning/> <w:DisplayHorizontalDrawingGridEvery>0</w:DisplayHorizontalDrawingGridEvery> <w:DisplayVerticalDrawingGridEvery>2</w:DisplayVerticalDrawingGridEvery> <w:ValidateAgainstSchemas/> <w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid> <w:IgnoreMixedContent>false</w:IgnoreMixedContent> <w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText> <w:Compatibility> <w:SpaceForUL/> <w:BalanceSingleByteDoubleByteWidth/> <w:DoNotLeaveBackslashAlone/> <w:ULTrailSpace/> <w:DoNotExpandShiftReturn/> <w:AdjustLineHeightInTable/> <w:BreakWrappedTables/> <w:SnapToGridInCell/> <w:WrapTextWithPunct/> <w:UseAsianBreakRules/> <w:DontGrowAutofit/> <w:UseFELayout/> </w:Compatibility> <w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel> </w:WordDocument> </xml><![endif]--><!-- [if gte mso 9]><xml> <w:LatentStyles DefLockedState="false" LatentStyleCount="156"> </w:LatentStyles> </xml><![endif]--><!-- [if gte mso 10]> <style> /* Style Definitions */ table.MsoNormalTable {mso-style-name:表格內文; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-parent:""; mso-padding-alt:0cm 5.4pt 0cm 5.4pt; mso-para-margin:0cm; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:10.0pt; font-family:"Times New Roman"; mso-fareast-font-family:"Times New Roman"; mso-ansi-language:#0400; mso-fareast-language:#0400; mso-bidi-language:#0400;} </style> <![endif]-->
Microsoft SQL Server 2005 - 9.00.4035.00 (Intel X86) Nov 24 2008 13:01:59
backupfile
針對資料庫的每個資料或記錄檔,各包含一個資料列。
backupfilegroup
針對備份時在資料庫中的每個檔案群組,各包含一個資料列。
backupmediafamily
針對每個媒體家族,各包含一個資料列。
backupmediaset
針對每個備份媒體集,各包含一個資料列。
backupset
針對每個備份組,各包含一個資料列。
logmarkhistory
針對已認可的每個標示交易,各包含一個資料列。
restorefile
針對每個還原的檔案,各包含一個資料列。其中包括檔案群組名稱間接還原的檔案。
restorefilegroup
針對每個還原的檔案群組,各包含一個資料列。
restorehistory
針對每個還原作業,各包含一個資料列。
suspect_pages
針對每個失敗並出現 824 錯誤 ( 限制為 1,000 個資料列 ) 的頁面,各包含一個資料列。
sysopentapes
針對目前開啟的每個磁帶裝置,各包含一個資料列。
*/
USE msdb
go
-- 針對指定日期之前的備份組來刪除備份與還原歷程記錄資料表中的項目。
EXEC sp_delete_backuphistory '2011-01-05' ;
go
-- 備份
BACKUP DATABASE [Test] TO DISK = N'D:/Test.bak' WITH NOFORMAT , NOINIT , NAME = N'Test- 完整資料庫備份 ' , SKIP , NOREWIND , NOUNLOAD , STATS = 10
-- 查看備份信息
SELECT
Name , backup_start_date, backup_finish_date, type , backup_size, server_name, machine_name, recovery_model
FROM dbo. backupset
/*
Name backup_start_date backup_finish_date type backup_size server_name machine_name recovery_model
Test- 完整資料庫備份 2011-01-04 19:08:30.000 2011-01-04 19:08:31.000 D 23250432 實例 機器名 FULL
*/
-- 還原
RESTORE DATABASE [Test] FROM DISK = N'D:/Test.bak' WITH FILE = 1, NOUNLOAD , REPLACE , STATS = 10
GO
-- 查看還原信息
SELECT
destination_database_name,
restore_date,
USER_NAME ,
restore_type
FROM dbo. restorehistory
/*
destination_database_name restore_date USER_NAME restore_type
Test 2011-01-04 19:11:03.810 還原賬號 D
*/