Problem Restoring Big SQL File ?

Posted by: Joy  :  Category: Programming

Have you ever got a problem with importing big files? For example restoring sql file to phpMyAdmin? I have experienced that once, when i tried to make a hosting migration for our forum. They said the file imported couldn’t be more than 2mb, then how to restore my sql file which was around 25mb at that time? Copy paste the code one by one? huh?! Not recomended, it would take so much time though.

I came up with the solution by writing simple file splitter codes on vfp.
here’s the code :

  1. ** Simple File Splitter (c) 2009 – !CrazyDavinci! (http://crazydavinci.net) **
    Local cFile,nSize,nByte,cString
    cFile = Fopen("forum.sql") && Change this with the filename
    nSize = Fseek(cFile, 0, 2)
    nByte = 1900000 && Change this with max number of file size in bytes
    Fseek(cFile, 0, 0)
    For i = 1 To nSize/nByte+1

    cString = Fread(cFile, nByte)
    Strtofile(cString,"split_"+Allt(Str(i))+".sql")
    Next
    Fclose(cFile)

Simple, isn’t it?
This will create multiple files like “split_1.sql”, “split_2.sql” and so on.
All you have to do next is modifying the content of the file, so the sql command wont be broken on the wrong line, make the approriate editing between one file to another, check the first and the end of the file, then you are ready to import the files one by one.


4 Responses to “Problem Restoring Big SQL File ?”

  1. 1
    kiddy Says:

    coolllllllllllllllllllllllllllllllllllll

    ajib :)

  2. 2
    metropolix tampan Says:

    Xixixixi…

    Om jOy in ActioniX … :P

    wakakakkekeke … :D

  3. 3
    Sebastian Seitz Says:

    hi there, i just found your site listed on google, and i would like to comment that you compose awesomely good via your site. i am truly struck by the mode that you write, and the content is outstanding. anyway, i would also love to acknowledge whether you would like to exchange links with my site? i will be to the great extent than happy to reciprocate and put your link off in the blogroll. anticipating for your response, i would like to convey my appreciation and have a great day!

  4. 4
    Subhash Dasyam Says:

    You should have tried bigdump
    supports larger sql :)

Leave a Reply

Comment moderation is enabled. Your comment may take some time to appear.