INFORMATION_SCHEMA 는 각 mysql 인스턴스안에 있는 '데이터베이스'이다.
해당 MySQL 서버가 유지하는 다른 모든 데이터베이스에 대한 정보를 저장하는 곳입니다.
The Information_schema 데이터베이스는 몇몇의 읽기전용 테이블을 포함합니다.
사실 그것들은 View이고, 테이블은 아닙니다. 그래서 그것들과 관련된 파일들은 없습니다.
그리고 트리거 셋팅도 불가능합니다.
또한 데이터베이스 파일구조도 존재 하지 않습니다.
당신은 INFORMATION_SCHEMA
를 SELECT(조회)만 가능하고 삽입, 삭제 , 변경은 불가합니다.
요약)
INFORMATION_SCHEMA 는 DATABASE의 정보를 저장하는 VIEW이며 오직 SELECT만 가능하고, INSERT, DELETE, UPDATE는 불가하다.
참고 )
https://dev.mysql.com/doc/mysql-infoschema-excerpt/8.3/en/information-schema-introduction.html
MySQL :: MySQL Information Schema :: 2 Introduction
INFORMATION_SCHEMA provides access to database metadata, information about the MySQL server such as the name of a database or table, the data type of a column, or access privileges. Other terms that are sometimes used for this information are data dictiona
dev.mysql.com
1. stored Procedure 리트스 조회하기
SELECT routine_name, routine_type, definer, created, last_altered
FROM information_schema.routines
WHERE routine_schema = "db 이름";
→ 해당 데이터 베이스에 들어가있는 sp 이름이 다나옴
2. table 리스트 조회하기
SELECT *
FROM information_schema.tables
WHERE table_schema = 'db 이름';
→ 해당 데이터 베이스에 들어있는 table 이름 다나옴
※ ex) 특정 시점 기준으로 생성된 테이블 리스트 조회
SELECT table_name, create_time, update_time
FROM information_schema.tables
WHERE table_schema = 'db 이름' and create_time >= "2024-02-01 00:00:00";
※ 위에서 알아낸 stored procedured의 생성 query
SHOW CREATE PROCEDURE 쿼리이름;