Re: Errors with Information_Schema in Create Target Results
Posted by: Vaughan Wickham
Date: October 30, 2021 07:25PM

Hello Peter,

I've noticed the following behaviour with the switch option --tee=some.file

I was initially setting --tee=some.file
then exiting the mysql session between restores
and deleting the 'some.file'
then starting a new mysql session.

With the intention being, to have the 'some.file' only logging the current restore activity.

What I discovered however, is that mysql seems to keep a record of the activity and when 'some.file' is recreated for the next session; all the previous contents of 'some.file' were being re-populated across sessions.

To stop this behaviour, you need to use --disable-tee between sessions.

The reason that I'm raising this, is that I have written a program to backup the databases

And while I now understand that there are some limitations using the query:
SELECT TABLE_NAME,SUM(TABLE_ROWS) FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = 'database' GROUP BY TABLE_NAME;

To compare databases in the source and destination servers; I still think that it is a good first check.

So I have included the above query for each database that I backup

However as you no doubt realise, you need to use different syntax when performing sql queries via a program rather than interactively

The approach that I'm currently using is:
C:\Program Files\MySQL\MySQL Server 5.7\bin\mysql.exe" -uUSER -pPWD < mysql-batch.txt > mysql.log

Where mysql-batch.txt contains the SQL Query

However what I'm finding is that the mysql.log file is being populated not just with the results of the current query, but also previous queries. It's like the earlier behaviour with the --tee option before I started using --disable-tee

But I don't know how to reset the SQL session / logging between my SQL queries when I'm performing the queries via a program.

Do you have any ideas?

Options: ReplyQuote


Subject
Written By
Posted
Re: Errors with Information_Schema in Create Target Results
October 30, 2021 07:25PM


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.