dbTalk Databases Forums  

separate binary log for each database (MySQL 5.0)?

comp.databases.mysql comp.databases.mysql


Discuss separate binary log for each database (MySQL 5.0)? in the comp.databases.mysql forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Sarah
 
Posts: n/a

Default separate binary log for each database (MySQL 5.0)? - 01-13-2011 , 10:40 AM






Hi,

I have binary logging enabled for our MySQL 5.0 instance. We have
several databases in the MySQL instance. So one binary log file is
recording the transactions for all of the databases. The log gets
flushed each night, after the full backup, and the old log files are
preserved.

Is it possible to get MySQL to do a separate binary log file for each
database? I'm asking because if I need to do a point-in-time recovery
of just one database it is extremely tedious to weed through the
binary log files to pull out the database-specific transactions. It
would be much easier if each database had it's own binary log. I've
looked in the MySQL documentation but can't seem to find anything
indicating this is possible.

If it's not possible to have a separate log, can anyone suggest a
strategy for dealing with editing the binary logs if you have to do a
recovery? (I'm already using mysqlbinlog to write the binary logs
to .sql files. So it's the .sql files I'm editing, not the binary log
files themselves).

Thanks in advance for your help!

Sarah B. Anderson
The Nature Conservancy
Arlington, VA

Reply With Quote
  #2  
Old   
Sarah
 
Posts: n/a

Default Re: separate binary log for each database (MySQL 5.0)? - 01-13-2011 , 10:45 AM






Well ... nevermind, maybe. I just did more searching of the MySQL
documentation and found a reference to being able to use a switch with
mysqlbinlog that will just output the log entries for one database.
I'll play with that and see if it's doing what I hope it is. Thanks
anyway!

Sarah


On Jan 13, 11:40*am, Sarah <sander... (AT) tnc (DOT) org> wrote:
Quote:
Hi,

I have binary logging enabled for our MySQL 5.0 instance. *We have
several databases in the MySQL instance. *So one binary log file is
recording the transactions for all of the databases. *The log gets
flushed each night, after the full backup, and the old log files are
preserved.

Is it possible to get MySQL to do a separate binary log file for each
database? *I'm asking because if I need to do a point-in-time recovery
of just one database it is extremely tedious to weed through the
binary log files to pull out the database-specific transactions. *It
would be much easier if each database had it's own binary log. *I've
looked in the MySQL documentation but can't seem to find anything
indicating this is possible.

If it's not possible to have a separate log, can anyone suggest a
strategy for dealing with editing the binary logs if you have to do a
recovery? *(I'm already using mysqlbinlog to write the binary logs
to .sql files. *So it's the .sql files I'm editing, not the binary log
files themselves).

Thanks in advance for your help!

Sarah B. Anderson
The Nature Conservancy
Arlington, VA

Reply With Quote
  #3  
Old   
Axel Schwenke
 
Posts: n/a

Default Re: separate binary log for each database (MySQL 5.0)? - 01-13-2011 , 11:56 AM



Sarah <sanderson (AT) tnc (DOT) org> wrote:
Quote:
Well ... nevermind, maybe. I just did more searching of the MySQL
documentation and found a reference to being able to use a switch with
mysqlbinlog that will just output the log entries for one database.
Beware! That option is buggy in some versions. Also it filters on
the selected database, so cross database updates (USE db1; UPDATE
db2.table1 ...) will not be correctly filtered.

The better approach to roll forward only a specific set of tables,
is to create a user with write permission only on those tables and
then use

mysqlbinlog ... | mysql -f ...

RTFM for mysql -f


XL

Reply With Quote
  #4  
Old   
Gordon Burditt
 
Posts: n/a

Default Re: separate binary log for each database (MySQL 5.0)? - 01-14-2011 , 01:15 AM



Quote:
Is it possible to get MySQL to do a separate binary log file for each
database? I'm asking because if I need to do a point-in-time recovery
of just one database it is extremely tedious to weed through the
binary log files to pull out the database-specific transactions. It
Beware that it is possible to use a cross-database query, and if
you do, restoring *one database* to a point-in-time doesn't make a
lot of sense.

Quote:
would be much easier if each database had it's own binary log. I've
looked in the MySQL documentation but can't seem to find anything
indicating this is possible.
Replication might fail if this was done and a cross-database query
appeared. Even a single-database query on a database that wasn't
the current one would likely end up in the wrong binary log.

Quote:
If it's not possible to have a separate log, can anyone suggest a
strategy for dealing with editing the binary logs if you have to do a
recovery? (I'm already using mysqlbinlog to write the binary logs
to .sql files. So it's the .sql files I'm editing, not the binary log
files themselves).
If you don't do cross-database queries, I think mysqlbinlog's -d
option might do what you want.

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.