Topic: Database restore fails

I have a six month old backup that I am trying to restore (5MB) and it just doesn't want to work. I am installing this on a new server on a different domain.

The database plugin just gives me this:

"No file was uploaed or the upload failed, the database was not restored"

and phpmyadmin just gives me about 20 different errors.... is there something simple that I am missing?

FREE web hosting: www.subnixus.com

Re: Database restore fails

Most likely a script timeout error. Do you have shell access to the server? If you do, you could try restoring the DB from the command line.

Re: Database restore fails

Nope, I don't have shell access... this is the other error:


"There is a chance that you may have found a bug in the SQL parser. Please examine your query closely, and check that the quotes are correct and not mis-matched. Other possible failure causes may be that you are uploading a file with binary outside of a quoted text area. You can also try your query on the MySQL command line interface. The MySQL server error output below, if there is any, may also help you in diagnosing the problem. If you still have problems or if the parser fails where the command line interface succeeds, please reduce your SQL query input to the single query that causes problems, and submit a bug report with the data chunk in the CUT section below:
----BEGIN CUT----
eNpzDQryD7JScDZUcDZS8HH1s1IwUjBWMDIy4QoOAYozc3E5hwVbKah4plgpFBfmFCQWFacW6eVk
JukVZBTolCkY6Rmb6BnpGSoYGRiY6huY6RsbKBiaWZlaWBkaKuSk5loquFYUKKhw+VYGB/pYKZjo
GegZmeoWlyTmpSQWpXCFBgcp+AfrKDi6u/qF6CiEuQLtDM/MU/D1j/L08XFUMNUz4ArwdQS6Ss9M
z1i3IMeQK8AjAKROxz8YZJyxHtAen8y80gouH0c/dyuF1DzdzOJ8XQsLU0tdQy6wpQHezCwiDAwM
HAxRIuuMKrdebdhtns1QvOEbEz9QtCg1JzM90yi+oDRPD+jDN3tfF90O26b3q96WNWr3t6A7s5e5
3n1asr1fZnXy10+5kV67g15OkVZxFBLk2MAYwFP8Si2nxDp8/z3J++bH5sxoyAgusspeH7tV+PhE
j5hnqWcK5e9X/LGIOiO2/vrzx5Wz3MP//9Sq2jhH/9/bj49fmGmu3nJi8d9/hfUfKia+fXw4MlZ/
nlp6iXXlpqi1v4pu18g+3lY378oPof97dVb9ypwiuthi9sn+Hy9uq/if2nFs87rLlZ9MqmTXLz6Y
qH/r/m0AzyquzA==
----END CUT----
----BEGIN RAW----

ERROR: C1 C2 LEN: 2 3 224
STR: 

CVS: $Id: sqlparser.lib.php,v 2.34.2.1 2005/06/30 16:58:11 lem9 Exp $
MySQL: 4.0.25-standard
USR OS, AGENT, VER: Win MOZILLA 5.0
PMA: 2.6.3-pl1
PHP VER,OS: 4.3.11 Linux
LANG: en-iso-8859-1"

FREE web hosting: www.subnixus.com

Re: Database restore fails

since it's 5mb, the DB plugin won't let you upload it
phpMyAdmin has the ability to load those files from directly off the server: I would look into that

Re: Database restore fails

Can you point me in the direction to loading it from the server directly? I can't seem to find any information on how to do it.

FREE web hosting: www.subnixus.com

6 (edited by Smartys 2005-10-08 17:59)

Re: Database restore fails

As much as I hate to link there... tongue
http://www.phpbb.com/kb/article.php?article_id=264

(Although now that I read that, another option seems better, since most people can't edit phpmyadmin's files)
I'll get the edit for the DB Management mod in a sec tongue

Re: Database restore fails

FIND

    $backup_file_name = (!empty($HTTP_POST_FILES['backup_file']['name'])) ? $HTTP_POST_FILES['backup_file']['name'] : "";
    $backup_file_tmpname = ($HTTP_POST_FILES['backup_file']['tmp_name'] != "none") ? $HTTP_POST_FILES['backup_file']['tmp_name'] : "";
    $backup_file_type = (!empty($HTTP_POST_FILES['backup_file']['type'])) ? $HTTP_POST_FILES['backup_file']['type'] : "";
    if($backup_file_tmpname == "" || $backup_file_name == "")
    {
        message('No file was uploaed or the upload failed, the database was not restored');
    }
    if( preg_match("/^(text\/[a-zA-Z]+)|(application\/(x\-)?gzip(\-compressed)?)|(application\/octet-stream)$/is", $backup_file_type) )
    {
        if( preg_match("/\.gz$/is",$backup_file_name) )
        {
            $do_gzip_compress = FALSE;
            $phpver = phpversion();
            if($phpver >= "4.0")
            {
                if(extension_loaded("zlib"))
                {
                    $do_gzip_compress = TRUE;
                }
            }
            if($do_gzip_compress)
            {
                $gz_ptr = gzopen($backup_file_tmpname, 'rb');
                $sql_query = "";
                while( !gzeof($gz_ptr) )
                {
                    $sql_query .= gzgets($gz_ptr, 100000);
                }
            }
            else
            {
                message('Sorry the database could not be restored');
            }
        }
        else
        {
            $sql_query = fread(fopen($backup_file_tmpname, 'r'), filesize($backup_file_tmpname));
        }
    }
    else
    {
        message('Error the file name or file format caused an error, the database was not restored');
    }

If the backup isn't gzipped:
REPLACE WITH

$sql_query = fread(fopen('backup.sql', 'r'), filesize('backup.sql'));

If it is
REPLACE WITH

                $gz_ptr = gzopen($backup_file_tmpname, 'rb');
                $sql_query = "";
                while( !gzeof($gz_ptr) )
                {
                    $sql_query .= gzgets($gz_ptr, 100000);
                }

Then, upload the backup via FTP or another method into the plugins directory, go to the db management, type anything in the box, and submit the form. Wait, and it should restore.

Tell me if it doesn't work wink