This is a small tool to split up large MySQL dumps into small, independently executable SQL files. It is useful in cases where an upload limit is in place in web administration tools for example. This little program is a revival of a very old program of mine.
But this time, it is far more useful:
- it is based on a minimal, use case tailored SQL parser
- using this parser, the tool can take care about:
- splitting INSERTs with many value tuples over the files
- if the INSERT contains a “ON DUPLICATE” statement and it is split over many files, the statement is preserved
- SET statements are repeated in the split files
- USE statements are repeated in the split files, even if there are multiple ones, the most recent is memorized
- it is cross platform
A part of the parser is open source as a Go library, Peek-A-Buf.
So, happy splitting and report any bugs, you might encounter!
Download Version 0.9.3 Alpha for Windows |
Download Version 0.9.3 Alpha for MacOS |
Download Version 0.9.3 Alpha for Linux |
Command line interface
This tool also comes along with a CLI. Here is how it is used:
SQLDumpSplitter3 split --file FILE --size SIZE --unit UNIT
- split: tells the program to execute a SQL split and not start the GUI. Shortcut: s
- –file FILE: the FILE to split. Must be given. Shortcut: -f FILE
- –size SIZE: the maximum file size, min. 100 KB. Default: 2. Shortcut: -s
- –unit UNIT: the unit of the maximum file size, one of “KB”, “MB”, “GB”. Default: “KB” Shortcut: -u
Example calls:
# simple split with 2 MB files
SQLDumpSplitter3 split --file dump.sql
# the same using the shortcuts
SQLDumpSplitter3 s -f dump.sql
# this results in max 512 KB files
SQLDumpSplitter3 split --file dump.sql --size 512 --unit KB
# this results in max 512 KB files using the shortcuts
SQLDumpSplitter3 s -f dump.sql -s 512 -u KB
full-width
Đăng nhận xét