Re: FLUSH TABLES WITH READ LOCK via shell script
Posted by:
JinNo Kim
Date: September 21, 2005 10:02AM
Patrick,
Initially I misread your post - keeping it locked while you excute other shell commands is harder - the script below will let you chain a bunch of SQL statments in a single connection, but does nothing to help you. Sorry...
Try something like:
---Begin---
#!/bin/bash
LOCK_SQL="FLUSH TABLES WITH READ LOCK;"
BACKUP_SQL="SELECT a from b; INSERT b to a; DROP; CREATE;...;"
UNLOCK_SQL="UNLOCK TABLES;"
echo $LOCK_SQL > /tmp/tmp_backup.sql
echo $BACKUP_SQL >> /tmp/tmp_backup.sql
echo $UNLOCK_SQL >> /tmp/tmp_backup.sql
mysql --user="user" --password=="password" --host=="host" -D dbname < /tmp/tmp_backup.sql
rm /tmp/tmp_backup.sql
---End---
Hope that helps (and works)... I've chained together entire "create;select;delete" statements this way without any real issue using one variable, just used 3 to make it a little clearer.
-JNK
Edited 3 time(s). Last edit at 09/21/2005 10:08AM by JinNo Kim.
Subject
Written By
Posted
September 21, 2005 04:46AM
Re: FLUSH TABLES WITH READ LOCK via shell script
September 21, 2005 10:02AM
September 29, 2005 02:16PM
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.