삽질/개발,엔지니어링

[ERROR] InnoDB: Attempted to open a previously opened tablespace...

maengis 2023. 5. 2. 14:16

건물 전기 작업으로 인해 서버가 강제로 꺼졌는데, mariadb가 실행이 안 되었다.

로그 확인을 해보니

[ERROR] InnoDB: Attempted to open a previously opened tablespace. Previous tablespace {경로} uses space ID: 2 at filepath: ./{경로}.ibd. Cannot open tablespace mysql/innodb_index_stats which uses space ID: 2 at filepath: ./mysql/innodb_index_stats.ibd
2023-04-29 06:13:38 7ff9386997e0  InnoDB: Operating system error number 2 in a file operation.

my.cnf 파일에 innodb_force_recovery을 주고 실행해서 처리.

innodb_force_recovery = 4

값은 1부터 6까지 있는데, 4가 가장 안전해서 4로 했다.

관련 내용은 https://dev.mysql.com/doc/refman/8.0/en/forcing-innodb-recovery.html

 

MySQL :: MySQL 8.0 Reference Manual :: 15.21.3 Forcing InnoDB Recovery

15.21.3 Forcing InnoDB Recovery To investigate database page corruption, you might dump your tables from the database with SELECT ... INTO OUTFILE. Usually, most of the data obtained in this way is intact. Serious corruption might cause SELECT * FROM tbl_

dev.mysql.com

 

반응형