宝马娱乐在线城-宝马娱乐在线

来自 互联网络 2020-03-01 04:10 的文章
当前位置: 宝马娱乐在线城 > 互联网络 > 正文

如何恢复数据库备份到一个已存在的正在使用的

USEmaster--(Cantsitinthedatabasewhilstitsbeingrestored!)GOALTERDATABASEMyDatabaseSETSINGLE_USERWITHROLLBACKIMMEDIATEGO--RestoreFullBackupRESTOREDATABASEMyDatabaseFROMDISK=x:MSSQLBACKUPMyBackupFilename_Full.BAKWITHREPLACE,NORECOVERY,--UseifmoreT/Logstorecover--RECOVERY,--UseifNOmoreT/LogstorecoverSTATS=10,--Showprogress(every10%)MOVEMyDatabase_DataTOx:MSSQLDATAMyDatabase.mdf,MOVEMyDatabase_LogTOx:MSSQLDATAMyDatabase.ldfGO--OptionalrestoreDifferentialBackupRESTOREDATABASEMyDatabaseFROMDISK=x:MSSQLBACKUPMyDatabase_Diff.BAKWITH--RECOVERY--UseifNOmorefiletorecoverNORECOVERY--UseifthereareT/LogstorecoverGO--OptionalrestoreTransactionLogBackupRESTOREDATABASEMyDatabaseFROMDISK=x:MSSQLBACKUPMyDatabase_yyyymmdd_hhmm_Trans.BAKWITH--RECOVERY--UseifNOmoreT/LogstorecoverNORECOVERY--UseifmoreT/LogstorecoverGO--Setthedatabasereadyforuse(afterallbackupshavebeenrestored)RESTOREDATABASEMyDatabaseRECOVERYGO--Renamelogicalnames(onlyneededifrestoringfromabackupforaDifferentdatabase):ALTERDATABASEMyDatabaseMODIFYFILE(NAME=OrigDatabase_Data,NEWNAME=MyDatabase_data)GOALTERDATABASEMyDatabaseMODIFYFILE(NAME=OrigDatabase_Log,NEWNAME=MyDatabase_log)GO

本文由宝马娱乐在线城发布于互联网络,转载请注明出处:如何恢复数据库备份到一个已存在的正在使用的

关键词: