PDA

View Full Version : .::Backup DB on Server (Selective Tables) ::.


Kumaro
08-01-2002, 07:49 PM
Problem:
The database of my forums is well over 900MB in size after saving it to my server. This is mainly because of my search index which is basically useless to save since it can be rebuilt. In fact, due to this gigantic DB, I can't even backup anymore because the backup script takes so long that it times out.

Solution:
I noticed that it is possible to backup without certain tables of choise, however I need to keep the backups on the server.

I was hoping somebody could make a hack that allows me to backup the database on the server and be able to deselect the tables I don't want to include.

I think this would benefit many sites with large traffic and databases. Thanks

Xenon
08-01-2002, 08:00 PM
the backupfeature of vb can do that as i know...

Kumaro
08-02-2002, 02:23 AM
no, i don't think you read this properly. You can select what tables to include and not include, but thats only if you are downloading the backup. i want to be able to select what tables to include and not include when saving the backup directly on the server.

Xenon
08-02-2002, 10:25 AM
yes sorry was my fault...

hmm, i think you can try this:

open admin/backup.php

find:
doformheader("backup","sqlfile");
maketableheader("Save data to file on server:");

below add:$result=$DB_site->query("SHOW tables");
while ($currow=$DB_site->fetch_array($result)) {
makeyesnocode($currow[0],"table[$currow[0]]",1);
}

then find this:
while ($currow=$DB_site->fetch_array($result)) {
sqldumptable($currow[0], $filehandle);
fwrite($filehandle, "\n\n\n");
echo "<p>Dumping $currow[0]</p>";
}


and change it to: while (list($key,$val)=each($table)) {
if ($val==1) {
sqldumptable($key,$filehandle);
fwrite($filehandle, "\n\n\n");
echo "<p>Dumping $currow[0]</p>";

}
}


it should work, because it's the same code used for save to disk ;)

Kumaro
08-04-2002, 09:24 PM
i'll try this...i hope it worx...thanks!

Kumaro
08-04-2002, 09:29 PM
hmm...
i get this when i access the backup file

Parse error: parse error in /usr/local/psa/home/vhosts/411hype.com/httpdocs/forums/admin/backup.php on line 279

Xenon
08-04-2002, 09:32 PM
what is line 279 would help ;)

also i've added a } to my post above, seems i have forgotten it ;)

Kumaro
08-04-2002, 09:47 PM
this is really weird...line 256 is the blank line between these codes

makeinputcode("separator","separator",",");
makeinputcode("Quotes","quotes","'");
makeyesnocode("Show column names","showhead",1);

doformfooter("Generate");

}

Kumaro
08-04-2002, 09:57 PM
wait...after that little bracket, it seems to be workin...

Kumaro
08-04-2002, 10:03 PM
okay...now i can get on the backup page, but after entering the path to where i want to save it, and then press "Save File", i get these two errors:

Warning: 6 is not a valid File-Handle resource in /usr/local/psa/home/vhosts/411hype.com/httpdocs/forums/admin/backup.php on line 88

Warning: 6 is not a valid File-Handle resource in /usr/local/psa/home/vhosts/411hype.com/httpdocs/forums/admin/backup.php on line 119

Xenon
08-05-2002, 12:10 AM
please always post the error producing lines, too.

also the function worked on your board for complete databases right?

Kumaro
08-06-2002, 03:18 AM
i posted all the errors it gave me.
The only thing that works now after making your modifications is the downloading backup.

It would be great if you could just make the same changes you've posted above to your own backup script. If it works for you, then i'm sure it will work for me.

Neo
08-06-2002, 05:34 AM
I would suggest using phpmyadmin or asking your server if they will send you the backup for it. Simple and no code edit / errors.

Kumaro
08-07-2002, 12:33 AM
hmm...i'd rather have the hack :(