You are here

Monitering load database in mysql

HI, Is there any scripts to moniter load database in mysql,I am trying to moniter with --verbose option in mysql client. but the output giving me all the insert commands. Please help me on this. Thanks Srihari

Hi Srihari,

What exactly you want to monitor in MySQL ?

abdel-mawlacomment

HI,

I want to monitor database refresh,when loading database into mysql I want see the below output,so that I can see if any error occurs.

table1 completed..
table2 completed..
table3 completed..
table4 completed..
.
.
.
.
tablen completed..
database loaded successfully completed..

Thanks
Srihari

sriharicomment

Hi,

The output you just provided could be gotten by having your database's tables backed up individually and then restore them the same way.
For this purpose, the backup script should be something like:
#!/bin/bash cd /backup/script/ for x in `cat tables.txt` do echo $x mysqldump --user=user_name --password='password' database_name $x > /backup/$x.sql echo 'Table '.$x.' completed ...' done echo 'Database backed up successfully ...'
Where the tables.txt file contains all tables names separated by new lines.

And the restore script should be something like:
#!/bin/bash cd /backup/script/ for x in `cat tables.txt` do echo $x mysql --user=user_name --password='password' database_name < /backup/$x.sql echo 'Table '.$x.' completed ...' done echo 'Database loaded successfully ...'

OR if you have all tables backed up in only one file, you can monitor the whole process progress by using the "pv" command in the restore as follows:
# pv /backup/database_backup_file.sql | mysql --user=user_name --password='password' database_name 96.8MB 0:00:17 [5.51MB/s] [==> ] 11% ETA 0:02:10

BTW, at the end of each method, you might need to run the mysqlcheck command against the restored database to double check that everything is going fine after the restore.

I hope that helped.

Abdel-Mawla
abdel-mawlacomment

Thank you very much.

sriharicomment