简体   繁体   中英

try to restore a sql dump file larger than 10 GB

I am trying to restore a sql dump file that is 13G big. I firstly used phpAdmin in xampp, it said the size was too big. Then i used big dump, still I got the error message that " I can not seek in xx.sql". I found online that it means the file is too big. Then I start to use command line. mysql -u username -p database < location/to/your/dump.sql seems it is working because it asked for password, and I directly pressed enter because I do not have a password. And now i can see the "_" keeps flashing, i am assuming that this means it is working. BUt there is no way I can check to make sure, and it is taking a while already.

Is there a way to make sure it is working? I really appreciate your help!! TJ

Another way to restore files with the mysql command line client is like this:

$ mysql -u username -p database 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2933685
--8<-- snip --8<--

mysql> source location/to/your/dump.sql 

The source command will read the dump file and apply it to the server just like the < redirection operator, but with two differences: you will see continuous "x rows affected" messages scrolling by, giving you some indication that progress is actually occurring. The down-side of this method is that, unlike the method using < redirection, if there are any errors in the dump file, the command line client will just try to keep going, which is not always what you want. Still, it might be a viable approach.

Or... the way you're doing it now, if you can see the connection in the processlist, check the value for Sleep . If the value is constantly 0, then some kind of activity is occurring.

I restore similar sized files

  1. Takes me about 4-5 hours, can be more depends on the nature of keys and constraints you have
  2. You can always check the process list to see if it works.
  3. tail -f the mysql general log, and make sure it logs any query. that's the easiest way to see if it is working or not. A caveat, this slows everything even more, by 100% +

Try this technique

After connecting to the remote MySql database…

  • Generate a query to create table schema, procedures and functions of the source DB
  • Generate a query to find all indexes of all tables except foreign key constraints of the - source DB
  • Generate a query to drop all the indexes found in step 2
  • Generate a query to insert all data of the source DB
  • Generate a query to create all the indexes found in step 2
  • Write all queries in the above order in one .sql file which is your new MySql backup. Zip it using LZ4 compression.
  • Now just restore the DB from this file using normal restore utility of MySql.

Ref: http://axiomnext.com/blog/how-to-restore-large-mysql-database-faster/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM