Sql server Database Backup、恢複等

來源:互聯網
上載者:User
--完整備份Backup Database NorthwindCSTo disk='G:\Backup\NorthwindCS_Full_20070908.bak'--差異備份Backup Database NorthwindCSTo disk='G:\Backup\NorthwindCS_Diff_20070908.bak'With Differential--記錄備份,預設截斷日誌Backup Log NorthwindCSTo disk='G:\Backup\NorthwindCS_Log_20070908.bak'--記錄備份,不截斷日誌Backup Log NorthwindCSTo disk='G:\Backup\NorthwindCS_Log_20070908.bak'With No_Truncate--截斷日誌不保留Backup Log NorthwindCSWith No_Log--或者Backup Log NorthwindCSWith Truncate_Only--截斷之後記錄檔不會變小--有必要可以進行收縮--檔案備份Exec Sp_Helpdb NorthwindCS --查看資料檔案Backup Database NorthwindCSFile='NorthwindCS'   --資料檔案的邏輯名To disk='G:\Backup\NorthwindCS_File_20070908.bak'--檔案組備份Exec Sp_Helpdb NorthwindCS --查看資料檔案Backup Database NorthwindCSFileGroup='Primary'   --資料檔案的邏輯名To disk='G:\Backup\NorthwindCS_FileGroup_20070908.bak'With init--分割備份到多個目標--恢複的時候不允許丟失任何一個目標Backup Database NorthwindCSTo disk='G:\Backup\NorthwindCS_Full_1.bak'     ,disk='G:\Backup\NorthwindCS_Full_2.bak'--鏡像備份--每個目標都是相同的Backup Database NorthwindCSTo disk='G:\Backup\NorthwindCS_Mirror_1.bak'MirrorTo disk='G:\Backup\NorthwindCS_Mirror_2.bak'With Format --第一次做鏡像備份的時候格式化目標--鏡像備份到本地和遠程Backup Database NorthwindCSTo disk='G:\Backup\NorthwindCS_Mirror_1.bak'MirrorTo disk='\\192.168.1.200\Backup\NorthwindCS_Mirror_2.bak'With Format--每天產生一個備份檔案Declare @Path Nvarchar(2000)Set @Path ='G:\Backup\NorthwindCS_Full_'+Convert(Nvarchar,Getdate(),112)+'.bak'Backup Database NorthwindCSTo disk=@Path--從NoRecovery或者--Standby模式恢複資料庫為可用Restore Database NorthwindCS_BakWith Recovery--查看目標備份中的備份組Restore HeaderOnlyFrom Disk ='G:\Backup\NorthwindCS_Full_20070908.bak'--查看目標備份的第一個備份組的資訊Restore FileListOnlyFrom Disk ='G:\Backup\NorthwindCS_Full_20070908_2.bak'With File=1--查看目標備份的卷標Restore LabelOnlyFrom Disk ='G:\Backup\NorthwindCS_Full_20070908_2.bak'--備份設定密碼保護備份Backup Database NorthwindCSTo disk='G:\Backup\NorthwindCS_Full_20070908.bak'With Password = '123',initRestore Database NorthwindCSFrom disk='G:\Backup\NorthwindCS_Full_20070908.bak'With Password = '123'
相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.