mySQL 백업시 아래와 같은 에러가 나타날 경우가 있다.

mysqldump: Got error: 1016: Can't open file: './mydb/mytable.frm' (errno: 24) when using LOCK TABLES


백업 시에 열수 있는 파일의 제한 때문에 출력되는 에러이다. 아래와 같이 my.cnf 파일에서 [mysqld]세션에 아래와 같이 내용을 추가 또는 수정.

open-files-limit=15000


mySQL 또는 MariaDB에서 사용되는 데이터베이스의 용량을 쿼리로 확인 할수 있는 명령어 입니다. 



select * from ( select 

to_char(reg_date, 'yyyymmdd hh') as m_date,

count(*) as cnt,

from measure_logs 

WHERE reg_date >= CAST('2016-02-03 00:00:00' as timestamp) 

AND reg_date <= CAST('2016-03-02 23:59:59' as timestamp) 

group by rollup(to_char(reg_date, 'yyyymmdd hh'))

) as t; 

위는 postgreSQL에서 사용되었던 날짜별 통계 여기서 각 필드의 평균 / 최소 / 최대값을 구하는 부분을 카운터 함수 부분에 추가하면 더욱 유용하게 사용 되는 부분이다. 


+ Recent posts