• AWS 存储过程


    DELIMITER $$
    
    USE `mysql`$$
    
    DROP PROCEDURE IF EXISTS `rds_rotate_slow_log`$$
    
    CREATE DEFINER=`rdsadmin`@`localhost` PROCEDURE `rds_rotate_slow_log`()
        READS SQL DATA
        DETERMINISTIC
    BEGIN
      DECLARE sql_logging BOOLEAN;
      SELECT @@sql_log_bin INTO sql_logging;
      SET @@sql_log_bin=off;
      CREATE TABLE IF NOT EXISTS mysql.slow_log_template LIKE mysql.slow_log;
      CREATE TABLE IF NOT EXISTS mysql.slow_log2 LIKE mysql.slow_log_template;
      DROP TABLE IF EXISTS mysql.slow_log_backup;
      RENAME TABLE mysql.slow_log TO mysql.slow_log_backup, mysql.slow_log2 TO mysql.slow_log;
      SET @@sql_log_bin=sql_logging;
    END$$
    
    DELIMITER ;
    
    DELIMITER $$
    
    USE `mysql`$$
    
    DROP PROCEDURE IF EXISTS `rds_rotate_general_log`$$
    
    CREATE DEFINER=`rdsadmin`@`localhost` PROCEDURE `rds_rotate_general_log`()
        READS SQL DATA
        DETERMINISTIC
    BEGIN
      DECLARE sql_logging BOOLEAN;
      SELECT @@sql_log_bin INTO sql_logging;
      SET @@sql_log_bin=off;
      CREATE TABLE IF NOT EXISTS mysql.general_log_template LIKE mysql.general_log;
      CREATE TABLE IF NOT EXISTS mysql.general_log2 LIKE mysql.general_log_template;
      DROP TABLE IF EXISTS mysql.general_log_backup;
      RENAME TABLE mysql.general_log TO mysql.general_log_backup, mysql.general_log2 TO mysql.general_log;
      SET @@sql_log_bin=sql_logging;
    END$$
    
    DELIMITER ;
    
    DELIMITER $$
    
    USE `mysql`$$
    
    DROP PROCEDURE IF EXISTS `rds_set_fk_checks_on`$$
    
    CREATE DEFINER=`rdsadmin`@`localhost` PROCEDURE `rds_set_fk_checks_on`()
    BEGIN
    DECLARE v_called_by_user VARCHAR(50);
    DECLARE v_mysql_version VARCHAR(20);
    DECLARE sql_logging BOOLEAN;
    SELECT @@sql_log_bin INTO sql_logging;
    SELECT USER() INTO v_called_by_user;
    SELECT VERSION() INTO v_mysql_version;
    SET @@sql_log_bin=off;
    INSERT INTO mysql.rds_history(called_by_user, ACTION, mysql_version) VALUES (v_called_by_user,'set_fk_checks_on', v_mysql_version);
    COMMIT;
    SET GLOBAL `foreign_key_checks`=1;
    SET @@sql_log_bin=sql_logging;
    END$$
    
    DELIMITER ;
    
  • 相关阅读:
    微信redirect_uri域名与后台配置不一致,错误代码10003
    windows安装centos7子系统
    c++中的var_dump
    egret3.x升级5.2
    PHP更改自动加载的顺序
    重定向如何携带cookie
    elasticsearch和mysql排序问题
    npm错误:Error: listen EADDRNOTAVAIL
    Spring Boot WebFlux 集成 Mongodb 数据源操作
    泥瓦匠:程序猿为啥要坚持写原创技术博客?
  • 原文地址:https://www.cnblogs.com/zping/p/11989994.html
Copyright © 2020-2023  润新知