FLUSH TABLES WITH READ LOCK via shell script
Posted by: Patrick Scheidt
Date: September 21, 2005 04:46AM

Hi,

I like to do a backup and exchange update logs with another server. Before I do this I have to lock the tables. All this backup and exchanging stuff is done by a shell script that is initiated by a cronjob every night.

Basically the script looks like this:

mysql --user="user" --password=="password" --host=="host" \
--execute=="FLUSH TABLES WITH READ LOCK"

#backup and exchanging stuff

mysql --user="user" --password=="password" --host=="host" \
--execute=="UNLOCK TABLES"

But that doesn't work because the '--execute' option closes the mysql connection right away after executing the mysql statement. But mysql implicitly kills all locks while closing so in the end the tables are not locked.

Is there any solution work-around that works in a shell script?

Thanks for your help
Patrick

Options: ReplyQuote


Subject
Written By
Posted
FLUSH TABLES WITH READ LOCK via shell script
September 21, 2005 04:46AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.