mysql binlog恢復(fù)數(shù)據(jù) MySQL的數(shù)據(jù)如何恢復(fù)到任意時間點(diǎn)?
MySQL的數(shù)據(jù)如何恢復(fù)到任意時間點(diǎn)?要將數(shù)據(jù)庫還原到以前的時間點(diǎn),必須有日志備份。下面是使用日志的示例:create database db1 go alter database db1 set r
MySQL的數(shù)據(jù)如何恢復(fù)到任意時間點(diǎn)?
要將數(shù)據(jù)庫還原到以前的時間點(diǎn),必須有日志備份。下面是使用日志的示例:create database db1 go alter database db1 set recovery full go backup database db1 to disk=“db1。Bak“with init--首先,對數(shù)據(jù)庫進(jìn)行完全備份,否則checkpoint將暫存非活動日志(類似于簡單恢復(fù))go use db1 go create table t(col int)go--一些數(shù)據(jù)庫操作--一些數(shù)據(jù)庫操作--一些數(shù)據(jù)庫操作--假設(shè)您在15:15之后刪除此表。如果要恢復(fù)此表,則需要備份數(shù)據(jù)庫的日志。使用master go backup log db1 to disk=”db1。TRN“使用norecovery go---然后執(zhí)行以下操作:使用master go從disk=”db1還原數(shù)據(jù)庫db1。Bak“with norecovery go restore log db1 from disk=”db1。TRN “with recovery,stopat=”2009-03-08 15:15:00 “--此時,數(shù)據(jù)庫恢復(fù)到15:15的狀態(tài)。