[MariaDB] Backup Dump File with Procedure

2023. 11. 8. 13:49DevOps/RDBMS

MariaDB Version: 10.6.10
MariaDB Backup Dump File 생성시 default로 procedure는 백업되지 않는다. 따라서 --routines 옵션을 이용해서 procedure까지 함께 백업 해야 한다.

  • Trigger: True(default) → option: --triggers
  • Procedure: False(default) → option: --routines
mysqldump -u [계정명] -p'[패스워드]' -h [MARIADB 주소] --routines --verbose [데이터베이스] > [백업받을 파일명] 
mysqldump -u root -p'admin12341234' -h $MARIADB_SVC_IP --routines --verbose chub_cms > ./chub_cms.bak

 

참고: How to export MySQL database with triggers and procedures?

mysqldump will backup by default all the triggers but NOT the stored procedures/functions. There are 2 mysqldump parameters that control this behavior:

  • --routines – FALSE by default
  • --triggers – TRUE by default

so in mysqldump command , add --routines

'DevOps > RDBMS' 카테고리의 다른 글

[MariaDB] Grant / TimeZone / Trigger / Procedure Check  (0) 2023.11.08