這篇文章將為大家詳細(xì)講解有關(guān)如何將MySQLDUMP全庫備份分為單庫文件,小編覺得挺實(shí)用的,因此分享給大家做個(gè)參考,希望大家閱讀完這篇文章后可以有所收獲。
成都創(chuàng)新互聯(lián)專注于大悟企業(yè)網(wǎng)站建設(shè),響應(yīng)式網(wǎng)站建設(shè),商城網(wǎng)站建設(shè)。大悟網(wǎng)站建設(shè)公司,為大悟等地區(qū)提供建站服務(wù)。全流程按需策劃,專業(yè)設(shè)計(jì),全程項(xiàng)目跟蹤,成都創(chuàng)新互聯(lián)專業(yè)和態(tài)度為您提供的服務(wù)
有時(shí)候我們備份是做的全庫的備份,但是在恢復(fù)的時(shí)候卻需要單庫的文件,如果需要的庫很小,我們把全庫備份恢復(fù)回去然后導(dǎo)出想要的庫的文件勢(shì)必非常慢和耗時(shí),這個(gè)時(shí)候如果
能夠拆分文件為單庫就好了,所以做了如下一個(gè)工具
工具叫做mysplit 可以查看備份出來每個(gè)庫的大小和分割文件。
下載百度云盤:
http://pan.baidu.com/s/1mhfl6R2
下載后傳入到LINUX系統(tǒng)
chmod 755 mysplit1.2
就可以用了幫助如下:
/*****************************************************
Copyright by GaoPeng .All rights reserved.Version 1.2
This tool is uesd to split more than one database dump
to split to single database file and show every datab
ase dump size.
USEAGE:./mysplit -show/-split dumpfilename [charset]
-show to show every database dump size
-split TO split every database to single file
[charset] is optional default /*SET NAMES UTF8*/
Editer's qq:22389860,bugs report!
*****************************************************/
使用實(shí)例分割庫:
[root@hadoop1 ~]# mysplit1.2 -split log.log utf8
/*****************************************************
Copyright by GaoPeng .All rights reserved.Version 1.2
This tool is uesd to split more than one database dump
to split to single database file and show every datab
ase dump size.
USEAGE:./mysplit -show/-split dumpfilename [charset]
-show to show every database dump size
-split TO split every database to single file
[charset] is optional default /*SET NAMES UTF8*/
Editer's qq:22389860,bugs report!
*****************************************************/
NOTE:if use -show Enter y,follow hint is affect only -split
Will use charset utf8,please check !
Best way to find set names use Linux command:
head -n 10 dumpfilename
[y/n] y:use default charset utf8/n:exit mysplit
y
/*!40101 SET NAMES utf8 */;
number 1,begin 778,end 908,database --g1'size= 0.126953(KB)
new file is create of databse g1
number 2,begin 909,end 1045,database --kkmm'size= 0.132812(KB)
new file is create of databse kkmm
number 3,begin 1046,end 627860,database --mysql'size= 612.123047(KB)
new file is create of databse mysql
number 4,begin 627861,end 628477,database --nvc'size= 0.601562(KB)
new file is create of databse nvc
number 5,begin 628478,end 251621886,database --test'size= 245110.750000(KB)
new file is create of databse test
number 6,begin 251621887,end 251622887,database --test1'size= 0.976562(KB)
new file is create of databse test1
number 7,begin 251622888,end 262508330,database --test100'size= 10630.314453(KB)
new file is create of databse test100
number 8,begin 262508331,end 262992362,database --test2'size= 472.686523(KB)
new file is create of databse test2
number 9,begin 262992363,end 262992505,database --testl2'size= 0.138672(KB)
new file is create of databse testl2
number 10,begin 262992506,end 262992549,database --g1'size= 0.041992(KB)
file is exist append to databse g1
number 11,begin 262992550,end 262992597,database --kkmm'size= 0.045898(KB)
file is exist append to databse kkmm
number 12,begin 262992598,end 262992647,database --mysql'size= 0.047852(KB)
file is exist append to databse mysql
number 13,begin 262992648,end 262992693,database --nvc'size= 0.043945(KB)
file is exist append to databse nvc
number 14,begin 262992694,end 262993646,database --test'size= 0.929688(KB)
file is exist append to databse test
number 15,begin 262993647,end 262994567,database --test1'size= 0.898438(KB)
file is exist append to databse test1
number 16,begin 262994568,end 262995526,database --test100'size= 0.935547(KB)
file is exist append to databse test100
number 17,begin 262995527,end 262995576,database --test2'size= 0.047852(KB)
file is exist append to databse test2
number 18,begin 262995577,end 262996054,database --testl2'size= 0.465820(KB)
file is exist append to databse testl2
UESD TIME TOTAL:
35.000000 seconds used
查看每個(gè)庫備份出來的大?。?br/>
[root@hadoop1 ~]# mysplit1.2 -show log.log utf8
/*****************************************************
Copyright by GaoPeng .All rights reserved.Version 1.2
This tool is uesd to split more than one database dump
to split to single database file and show every datab
ase dump size.
USEAGE:./mysplit -show/-split dumpfilename [charset]
-show to show every database dump size
-split TO split every database to single file
[charset] is optional default /*SET NAMES UTF8*/
Editer's qq:22389860,bugs report!
*****************************************************/
NOTE:if use -show Enter y,follow hint is affect only -split
Will use charset utf8,please check !
Best way to find set names use Linux command:
head -n 10 dumpfilename
[y/n] y:use default charset utf8/n:exit mysplit
y
/*!40101 SET NAMES utf8 */;number 1,begin 778,end 908,database --g1'size= 0.126953(KB)
number 2,begin 909,end 1045,database --kkmm'size= 0.132812(KB)
number 3,begin 1046,end 627860,database --mysql'size= 612.123047(KB)
number 4,begin 627861,end 628477,database --nvc'size= 0.601562(KB)
number 5,begin 628478,end 251621886,database --test'size= 245110.750000(KB)
number 6,begin 251621887,end 251622887,database --test1'size= 0.976562(KB)
number 7,begin 251622888,end 262508330,database --test100'size= 10630.314453(KB)
number 8,begin 262508331,end 262992362,database --test2'size= 472.686523(KB)
number 9,begin 262992363,end 262992505,database --testl2'size= 0.138672(KB)
number 10,begin 262992506,end 262992549,database --g1'size= 0.041992(KB)
number 11,begin 262992550,end 262992597,database --kkmm'size= 0.045898(KB)
number 12,begin 262992598,end 262992647,database --mysql'size= 0.047852(KB)
number 13,begin 262992648,end 262992693,database --nvc'size= 0.043945(KB)
number 14,begin 262992694,end 262993646,database --test'size= 0.929688(KB)
number 15,begin 262993647,end 262994567,database --test1'size= 0.898438(KB)
number 16,begin 262994568,end 262995526,database --test100'size= 0.935547(KB)
number 17,begin 262995527,end 262995576,database --test2'size= 0.047852(KB)
number 18,begin 262995577,end 262996054,database --testl2'size= 0.465820(KB)
UESD TIME TOTAL:
11.000000 seconds used
如此我們可以使用分割的文件進(jìn)行導(dǎo)入!
關(guān)于“如何將MYSQLDUMP全庫備份分為單庫文件”這篇文章就分享到這里了,希望以上內(nèi)容可以對(duì)大家有一定的幫助,使各位可以學(xué)到更多知識(shí),如果覺得文章不錯(cuò),請(qǐng)把它分享出去讓更多的人看到。