標籤:blog http os 使用 sp 檔案 資料 log bs
方案一:(不用太大的變化my.ini檔案)
copy 原資料庫A中的 資料庫(database) ib_logfile1 ib_logfile0 ibdata1;
關閉目的資料庫B;
備份目的資料庫B中的 ib_logfile1 ib_logfile0 ibdata1 三個檔案,防止更改後不能使用資料庫;
將copy 來的原資料庫A中的 ib_logfile1 ib_logfile0 ibdata1 放置在目的資料庫B相應的位置 ,如果您目的資料庫中的 ib_logfile倆個檔案的大小和copy來的檔案大小一樣,直接粘貼就可以;
重新啟動資料庫B
方案二:(需要更改my.ini檔案)
copy 原資料庫A中的 資料庫(database) ib_logfile1 ib_logfile0 ibdata1;
關閉目的資料庫B;
如果您目的資料庫B中的ib_logfile倆個檔案的大小和copy來的檔案大小不一樣,備份目的資料庫B中的 ib_logfile1 ib_logfile0 ibdata1 三個檔案,防止更改後不能使用資料庫, 刪除目的資料庫下的 ib_logfile1 ib_logfile0 檔案,更改my.ini 檔案中的innodb_log_file_size 為原資料庫中 ib_logfile1 ib_logfile0 檔案大小eg. innodb_log_file_size=90M ;
重啟資料庫B;
成功後,刪除重啟資料庫B的 ib_logfile1 ib_logfile0 ,將copy 來的 ib_logfile1 ib_logfile0 粘貼過來(或者用copy 來的 ib_logfile1 ib_logfile0 替換現有資料庫B中的 ib_logfile1 ib_logfile0 即可);
粘貼 資料庫(database) ibdata1 到相應的位置;
重新啟動資料庫B
PS:目的就是保證
1、資料庫(database) ib_logfile1 ib_logfile0 ibdata1;必須同時複製的,也就是說不能在你複製的過程中還有別的操作來操作你要複製的資料庫。(這樣複製過來的資料可能有crash)
轉自:http://my.oschina.net/u/1462678/blog/223646
複製MySQL資料庫A到另外一個MySQL資料庫B(僅僅針對innodb資料庫引擎)