You can use this script that I wrote. Also you can change OPTIMIZE TABLE
with ANAYLIZE TABLE
#!/usr/bin/perl -w
# If you use this give me CREDIT!! :) Dathan Vance Pattishall
#
use strict;
use DBI;
use lib '/site/lib';
my $USER = "";
my $PASSWD = "";
my ($host,$DB,$TABLE) = @ARGV;
die "must specify host" if (!defined $host);
my $dbh = DBI->connect("DBI:mysql:mysql:$host", $USER, $PASSWD); die
"can't connect to $host" if (!defined $dbh); my $dblist; if (!$DB) {
$dblist = $dbh->selectall_arrayref("SHOW DATABASES");
} else {
$dblist = [[$DB]];
}
for my $dr (@$dblist) {
my ($db) = @$dr;
next if ($db eq 'mysql' or $db eq 'test' or ($db =~ /\./) or ($db =~
/\-/));
print "checking $db\n";
$dbh->do("USE $db");
my $tablist;
if ($TABLE) {
$tablist = $dbh->selectall_arrayref("SHOW TABLES LIKE '$TABLE\%'");
} else {
$tablist = $dbh->selectall_arrayref("SHOW TABLES");
}
for my $tr (@$tablist) {
my ($table) = @$tr;
print "...$table...\n";
my $rr = $dbh->selectall_arrayref("OPTIMIZE TABLE $table");
print "OK\n";
}
}
$dbh->disconnect();
-->-----Original Message-----
-->From: Mark Stringham [mailto:[EMAIL PROTECTED]
-->Sent: Tuesday, June 03, 2003 12:40 PM
-->To: [EMAIL PROTECTED]
-->Subject: optimize entire db
-->
-->Hi -
-->
-->Can anyone give the command line syntax for optimizing the entire db?
-->thanks in advance.
-->
-->MS
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]