2013년 2월 7일 목요일

[MySql] 데이터 무한 삽입 테스트

test.sql에 데이터 삽입 sql문 작성해 놓고
(인서트문 100개 정도 넣어 놨다)

아래를 test.sh로 저장

#!/bin/bash
mysql -u root -p"12345" dbname < test.sql;
mysql -u root -p"12345" dbname -e "select count(*) from testrun;" >> count.text;
mysql -u root -p"12345" dbname -e "show table status like 'testrun'" >> count.text;
mysql -u root -p"12345" dbname -e "select table_schema, sum(round((data_length+index_length)/1024/1024,0)) as total_size_mb from information_schema.tables where table_schema like 'dbname' and engine like 'innodb' group by table_schema;" >> count.text;
date '+%F  %r' >> count.text
echo >> count.text

1분단위로 위 파일을 실행
crontab -e에 등록
*/1 * * * * /root/test.sh

count.text에서 확인

댓글 없음:

댓글 쓰기