[TYPO3] mysqldump - clear cache-tables before dump?

Krystian Szymukowicz t33kRE.MO.VE. at RE.MO.VE.prolabium.com
Tue Mar 25 09:40:40 CET 2008


Arne Metzger wrote:
> Hi,
> 
> i use automysqlbackup to make a daily dump of my db. Today it was 2.8GB 
> uncompressed...
> Most space required those cache_*-tables.
> 
> Is there any way to clear them before dumping the db?
> 
> automysqlbackup knows "PREBACKUP", it can be a command to be exceduted 
> before dumping the db. Maybe it is possible to envoke a script that 
> clear cache-tables? which does the same as clicking "Clear FE-Cache" in BE?
> Or running a script as cronjob some minutes before automysqlbackup starts?
> 
> Any ideas?

hi

mysqldump has an option --ignore-table

Example from my script. I get rid of all tables that can be easily rebuild.

--- php code ----

$sql_database = 'my_database';

$ignore_tables_cache = "--ignore-table=$sql_database.cache_hash 
--ignore-table=$sql_database.cache_pages 
--ignore-table=$sql_database.cache_extensions 
--ignore-table=$sql_database.cache_pagesection";
$ignore_tables_index = "--ignore-table=$sql_database.index_rel";
$ignore_tables_sys = "--ignore-table=$sql_database.sys_history 
--ignore-table=$sql_database.sys_log";
$ignore_tables_static ="--ignore-table=$sql_database.static_template 
--ignore-table=$sql_database.static_tsconfig_help";

#join all ignores
$ignore_tables = "$ignore_tables_cache $ignore_tables_index 
$ignore_tables_sys $ignore_tables_static";

--- php code ----

You can see complete script at
http://dev.typo3cms.pl/index.php?id=94

Then - after recovery from such dump - you need to go to install tool 
"Database analyzer" -> "Compare" and recreate tables that are missing.


--
grtz
Krystian


More information about the TYPO3-english mailing list