成人国产在线小视频_日韩寡妇人妻调教在线播放_色成人www永久在线观看_2018国产精品久久_亚洲欧美高清在线30p_亚洲少妇综合一区_黄色在线播放国产_亚洲另类技巧小说校园_国产主播xx日韩_a级毛片在线免费

資訊專(zhuān)欄INFORMATION COLUMN

數(shù)據(jù)庫(kù)數(shù)據(jù)備份與恢復(fù)

Yu_Huang / 2286人閱讀

摘要:數(shù)據(jù)庫(kù)數(shù)據(jù)備份與恢復(fù)通過(guò)備份數(shù)據(jù)庫(kù),包含和以及的工具中也有類(lèi)似的功能可以實(shí)現(xiàn)數(shù)據(jù)庫(kù)的備份備份數(shù)據(jù)庫(kù)使用命令備份多個(gè)數(shù)據(jù)庫(kù)備份所有數(shù)據(jù)庫(kù)。

數(shù)據(jù)庫(kù)數(shù)據(jù)備份與恢復(fù)
通過(guò)CMD備份數(shù)據(jù)庫(kù),包含Mysql和Oracle
PS: PLSQL以及Navicat 的工具中也有類(lèi)似的功能可以實(shí)現(xiàn)數(shù)據(jù)庫(kù)的備份
MySQL: 備份數(shù)據(jù)庫(kù):

使用mysqldump命令 :mysqldump -uroot -proot [dbname]> f:/backup/backupfile.sql;

備份多個(gè)數(shù)據(jù)庫(kù):mysqldump -u username -p --databases [dbname1] [dbname2]> backupfile.sql;

備份所有數(shù)據(jù)庫(kù):mysqldump -u username -p --all-databases > backupfile.sql。

說(shuō)明: 默認(rèn)在電腦的當(dāng)前用戶(hù)目錄下(例:C:UsersLEGION
問(wèn)題:

使用mysqldump導(dǎo)出時(shí)提示 :Warning:A partial dump from a server that has GTIDs

Warning: A partial dump from a server that has GTIDs will by default include the GTIDs of all  transactions, even those that changed suppressed parts of the database. If you don"t want to restore GTIDs, pass --set-gtid-purged=OFF. To make a complete dump, pass --all-databases --triggers --routines --events.

原因:GTID是5.6以后,加入了全局事務(wù) ID (GTID) 來(lái)強(qiáng)化數(shù)據(jù)庫(kù)的主備一致性,故障恢復(fù),以及容錯(cuò)能力。

官方給的:A global transaction identifier (GTID) is a unique identifier created and associated with each transaction committed on the server of origin (master). 所以可能是因?yàn)樵谝粋€(gè)數(shù)據(jù)庫(kù)里面唯一,但是當(dāng)導(dǎo)入其他的庫(kù)就有可能重復(fù)。
- 解決:按照提示添加:`--set-gtid-purged=off `或`–gtid-mode=OFF` ;
    即:`mysqldump -uroot -set-gtid-purged=off -p mydbname>fbackupfile.sql`。


還原數(shù)據(jù)庫(kù):

直接使用mysql命令:mysql -u root -p [dbname] < backup.sq


更多參考

mysqldump數(shù)據(jù)導(dǎo)出問(wèn)題和客戶(hù)端授權(quán)后連接失敗問(wèn)題

學(xué)會(huì)4種備份MySQL數(shù)據(jù)庫(kù)


Oracle:

導(dǎo)出(exp):
exp 用戶(hù)名/密碼@IP/ORCL file=e:ackupfile.dmp owner=(用戶(hù)名)
例:exp myName/[email protected]/ORCL file=e:ackupfile.dmp owner=(myName)

導(dǎo)入(imp):
imp 用戶(hù)名/密碼@IP/ORCL ignore=y full=y file=e: