Database/mysql & mariaDB

Azure PaaS MariaDB에서 MySQL로 이관 전 DB 상태 체크

봉의일상 2025. 6. 24. 21:48

최근 Azure PaaS에서 제공되던 MariaDB 서비스의 종료 이슈로 인해 많은 기업들이 MySQL로의 이관을 고려하고 있습니다. 데이터 덤프와 복원만으로 이관이 가능할 거라 생각하기 쉽지만, 실제로는 트리거, 뷰, 프로시저, 이벤트, 유저 권한 등 다양한 객체들을 빠짐없이 이관하기 위해 사전 점검이 반드시 필요합니다.

이 글에서는 MariaDB를 MySQL로 이관하기 전에 현재 DB의 상태를 점검할 수 있는 쿼리들을 정리해 봤습니다.

특히, HeidiSQL 등 DB Tool을 사용하여 직접 실행 가능한 쿼리 위주로 구성했습니다.


1. 테이블 목록

SELECT table_name
FROM information_schema.tables
WHERE table_schema = 'your_database_name'
  AND table_type = 'BASE TABLE';

2. 뷰(View) 목록

SELECT table_name
FROM information_schema.views
WHERE table_schema = 'your_database_name';

3. 트리거(Trigger) 목록

SELECT trigger_name, event_manipulation, event_object_table, action_timing
FROM information_schema.triggers
WHERE trigger_schema = 'your_database_name';

4. 스토어드 프로시저(Procedure) 목록

SELECT routine_name
FROM information_schema.routines
WHERE routine_schema = 'your_database_name'
  AND routine_type = 'PROCEDURE';

5. 함수(Function) 목록

SELECT routine_name
FROM information_schema.routines
WHERE routine_schema = 'your_database_name'
  AND routine_type = 'FUNCTION';

6. 이벤트(Event Scheduler) 목록

SELECT event_name, event_definition, event_type, interval_value, interval_field
FROM information_schema.events
WHERE event_schema = 'your_database_name';

7. 외래키(Foreign Key) 목록

SELECT table_name, constraint_name, referenced_table_name
FROM information_schema.referential_constraints
WHERE constraint_schema = 'your_database_name';

8. 인덱스(Index) 목록

SELECT table_name, index_name, column_name, non_unique
FROM information_schema.statistics
WHERE table_schema = 'your_database_name';

9. ENUM/SET 타입 컬럼 확인

SELECT table_name, column_name, column_type
FROM information_schema.columns
WHERE table_schema = 'your_database_name'
  AND data_type IN ('enum', 'set');

10. 파티셔닝 테이블 확인

SELECT table_name, partition_name, subpartition_name, partition_ordinal_position
FROM information_schema.partitions
WHERE table_schema = 'your_database_name';

11. 스키마 용량 확인

SELECT table_schema,
       ROUND(SUM(data_length + index_length) / 1024 / 1024, 2) AS size_mb
FROM information_schema.tables
WHERE table_schema = 'your_database_name'
GROUP BY table_schema;

12. 사용자 및 권한 확인

-- 유저 목록
SELECT user, host FROM mysql.user;

-- 특정 유저 권한 확인
SHOW GRANTS FOR 'username'@'host';

마무리

위 쿼리들을 이용해 현재 MariaDB의 구조를 종합적으로 점검하면, MySQL 이관 시 누락되기 쉬운 객체들을 사전에 파악할 수 있습니다.

HeidiSQL의 Export 기능에서도 View, Trigger, Routine, Event 항목을 반드시 체크하여 전체 구조를 스크립트로 추출해두는 것이 중요합니다. 이후 데이터는 mysqldump 또는 HeidiSQL을 활용한 dump & restore 방식으로 이관하면 됩니다.