对于数据库的操作,经常需要暂时停止对bin-log日志的写入,那就需要这个命令:set sql_log_bin=on/off
参考:dev.mysql.com/doc/refman/5.5/en/set-sql-log-bin.html
13.4.1.3 SET sql_log_bin Syntax
SET sql_log_bin = {0|1}
The sql_log_bin
variable controls whether logging to the binary log is done. The default value is 1 (do logging). To change logging for the current session, change the session value of this variable. The session user must have theSUPER
privilege to set this variable. Set this variable to 0 for a session to temporarily disable binary logging while making changes to the master which you do not want to replicate to the slave.
As of MySQL 5.5, sql_log_bin
can be set as a global or session variable. Setting sql_log_bin
globally is only detected when a new session is started. Any sessions previously running are not impacted when settingsql_log_bin
globally.
Warning
Incorrect use of sql_log_bin
with a global scope means any changes made in an already running session are stillbeing recorded to the binary log and therefore replicated. Exercise extreme caution using sql_log_bin
with a global scope as the above situation could cause unexpected results including replication failure.
Beginning with MySQL 5.5.5, it is no longer possible to set @@session.sql_log_bin
within a transaction or subquery. (Bug #53437)
查看更多关于【数据库其他】的文章
去重复的sql(Oracle) 去重复的英文
1.利用group by 去重复2.可以利用下面的sql去重复,如下 1) select id,name,sex from (select a.*,row_number() over(partition by a.id,a.set order by name) su from test a ) where su=1 2)select id,name,sex from (select a.*,row_number() over(p
0评论2023-02-10893
Oracle SQL七次提速技巧
以下SQL执行时间按序号递减。1,动态SQL,没有绑定变量,每次执行都做硬解析操作,占用较大的共享池空间,若共享池空间不足,会导致其他SQL语句的解析信息被挤出共享池。create or replace procedure proc1as beginfor i in 1..100000 loop execute imme
0评论2023-02-10755
SQL ORACLE case when函数用法
case when 用法(1)简单case函数:格式: case 列名 when 条件值1 then 选项1 when 条件值1 then 选项2...... else 默认值 end例如: select case job_level when '1' then '1111' when '2' then '2222' when '3' then '3333
0评论2023-02-10564
mysql下如何执行sql脚本 执行SQL脚本
1.编写sql脚本,假设内容如下: create database dearabao; use dearabao; create table niuzi (name varchar(20)); 保存脚本文件,假设我把它保存在F盘的hello world目录下,于是该文件的路径为:F:\hello world\niuzi.sql2.执行sql脚本,可以有2种方法:
0评论2023-02-10699
MySQL 5.7版本sql_mode=only_full_group_by问题
用到GROUP BY 语句查询时com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Expression #2 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'col_user_6.a.START_TIME' which is not functionally dependent on colu
0评论2023-02-10973
ORACLE中通过SQL语句(alter table)来增加、删除、修改字段
1.添加字段:alter table 表名 add (字段 字段类型) [ default '输入默认值'] [null/not null] ;2.添加备注:comment on column 库名.表名.字段名 is '输入的备注'; 如: 我要在ers_data库中 test表 document_type字段添加备注 comm
0评论2023-02-10584
MySQL与Oracle 差异比较之六触发器
触发器编号类别ORACLEMYSQL注释1创建触发器语句不同create or replace trigger TG_ES_FAC_UNIT before insert or update or delete on ES_FAC_UNIT for each rowcreate trigger `hs_esbs`.`TG_INSERT_ES_FAC_UNIT` BEFORE INSERT on `hs_esbs`.`es_fac_u
0评论2023-02-10914
mysql where条件:某时间字段为今天的sql语句
1.查询:注册时间为今天的所有用户数:select count(*) from customer where TO_DAYS(createtime) = TO_DAYS(NOW())2.获取当前时间到凌晨24点还有多长时间:(Java中可用于判断某时间是否为今天)final Calendar cal = Calendar.getInstance(); ca
0评论2023-02-10717
mysql中的sql
变量用户变量: 在用户变量前加@系统变量: 在系统变量前加@@运算符算术运算符有: +(加), -(减), * (乘), / (除) 和% (求模) 五中运算位运算符有:(位于), | (位或), ^ (位异或), ~ (位取反),(位右移),(位左移)比较运算符有: = (等于),(大于),(小于), = (大
0评论2023-02-10936
Oracle的HINT可以强制指定SQL的执行计划,比如选择索引、表的连接顺序以及表的连接方式等等。(转)
在Oracle中查看所有的表: select * from tab/dba_tables/dba_objects/cat; 看用户建立的表 : select table_name from user_tables; //当前用户的表 select table_name from all_tables; //所有用户的表 select table_name from dba_tables; //包
0评论2023-02-10857
Oracle sql 子字符串长度判断
Oracle sql 子字符串长度判断 select t.* from d_table t WHEREsubstr(t.col,1,1)='8' and instr(t.col,'/')0 and length(substr(t.col,1,instr(t.col,'/')))5; 字符串的前两位都是数字:select * from d_table t WHERE regexp_like(substr(t.col,1,2), '^[
0评论2023-02-10759
Oracle、MySql、Sql Server比对
MySql:廉价(部分免费):当前,MySQL採用双重授权(DualLicensed),他们是GPL和MySQLAB制定的商业许可协议。假设你在一个遵循GPL的***(开源)项目中使用MySQL,那么你能够遵循GPL协议免费使用MySQL。否则,你须要购买MySQLAB制定的那个商业许可协议。Windows $
0评论2023-02-10441
Oracle 存储过程,临时表,动态SQL测试
--创建事务级别的结果临时表create global temporary table tmp_yshy( c1 varchar2(100), c2 varchar2(100))on commit delete rows;--创建事务级别的存储sql语句的临时表create global temporary table tmp_sql( c1 varchar2(4000))on commit delete rows;测
0评论2023-02-10508