您好,登錄后才能下訂單哦!
這篇文章將為大家詳細講解有關如何將MYSQLDUMP全庫備份分為單庫文件,小編覺得挺實用的,因此分享給大家做個參考,希望大家閱讀完這篇文章后可以有所收獲。
有時候我們備份是做的全庫的備份,但是在恢復的時候卻需要單庫的文件,如果需要的庫很小,我們把全庫備份恢復回去然后導出想要的庫的文件勢必非常慢和耗時,這個時候如果
能夠拆分文件為單庫就好了,所以做了如下一個工具
工具叫做mysplit 可以查看備份出來每個庫的大小和分割文件。
下載百度云盤:
http://pan.baidu.com/s/1mhfl6R2
下載后傳入到LINUX系統
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!
*****************************************************/
使用實例分割庫:
[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
查看每個庫備份出來的大小:
[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
如此我們可以使用分割的文件進行導入!
關于“如何將MYSQLDUMP全庫備份分為單庫文件”這篇文章就分享到這里了,希望以上內容可以對大家有一定的幫助,使各位可以學到更多知識,如果覺得文章不錯,請把它分享出去讓更多的人看到。
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。