重庆思庄Oracle、Redhat认证学习论坛

标题: 1z0-883 第一题 [打印本页]

作者: jikcheng    时间: 2014-12-22 11:07
标题: 1z0-883 第一题
QUESTION NO: 1  
A simple master-to-slave replication is currently being used. The following information is extracted from the SHOW SLAVE STATUS output:
 
 
Last_SQL_Error: Error 'Duplicate entry '8' for key 'PRIMARY' ' on query. Default database: 'mydb'. Query: 'insert into mytable VALUES ('8' , 'George') '
 
Skip_Counter: 0
 
Retrieved _Gtid_Set: 38f32e23480a7-32a1-c323f78067fd37821: 1-8 Auto _Position: 1
 
You execute a “SHOW CREATE TABLE mytable” on the slave:
 
 
 
CREATE TABLE ‘mytable’ (
 
‘ID’ int(11) NOT NULL DEFAULT ‘0’,
 
‘name’ char(10) DEFAULT NULL, PRIMARY KEY (‘ID’)
)
 
 
 http://
The table mytable on the slave contains the following:
 
 
 


 
 
 
You have issued a STOP SLAVE command. One or more statements are required before you can issue a START SLAVE command to resolve the duplicate key error.
 
 
Which statement should be used?
 
 
一个简单的主机到从复制当前正在使用。以下信息由SHOW SLAVE STATUS输出中提取:
 
A.  SET GLOBAL SQL_SKIP_SLAVE_COUNTER=1
B.  SET GTID_NEXT=”CONSISTENCY”; BEGIN; COMMIT;
SET GTID_NEXT=” AUTOMATIC’;
C.  SET GLOBAL enforce_gtid_consistency=ON
D. SET GTID_EXECUTED=”38f32e23480a7-32a1-c323f78067fd37821 : 9”; E. SET GTID_NEXT=”38f32e23480a7-32a1-c323f78067fd37821 : 9”; BEGIN; COMMIT;
SET GTID_NEXT=”AUTOMATIC”;
 
 

[此贴子已经被作者于2014-12-22 11:40:54编辑过]

作者: jikcheng    时间: 2014-12-22 11:15
一个简单的 主机到从机复制环境被应用,show slave status 显示出来以下信息。Last_SQL_Error: Error 'Duplicate entry '8' for key 'PRIMARY' ' on query. Default database: 'mydb'. Query: 'insert into mytable VALUES ('8' , 'George') '
 
Skip_Counter: 0
 
Retrieved _Gtid_Set: 38f32e23480a7-32a1-c323f78067fd37821: 1-8 Auto _Position: 1
你执行“show create table mytable” on the slave ;
CREATE TABLE ‘mytable’ (
 
‘ID’ int(11) NOT NULL DEFAULT ‘0’,
 
‘name’ char(10) DEFAULT NULL, PRIMARY KEY (‘ID’)

)


你执行一个 stop 从机的命令,你需要执行哪个 一个或多个语句需要在你start slave 命令来解决复制键的错误。



[此贴子已经被作者于2014-12-22 11:41:12编辑过]

作者: jikcheng    时间: 2014-12-22 11:15
Answer: A 
Explanation:题目A 应该是sql_slave_skip_counter 这个参数。
sql_slave_skip_counter
System Variable Name sql_slave_skip_counter
Variable Scope Global
Dynamic Variable Yes
Permitted Values
Type numeric
The number of events from the master that a slave server should skip.
This option is incompatible with GTID-based replication, and must not be set to a nonzero value when --
gtid-mode=ON. In MySQL 5.6.10 and later, trying to do so is specifically disallowed. (Bug #15833516)
If you need to skip transactions when employing GTIDs, use gtid_executed from the master instead.
See Injecting empty transactions, for information about how to do this.
Important
If skipping the number of events specified by setting this variable would cause
the slave to begin in the middle of an event group, the slave continues to skip
until it finds the beginning of the next event group and begins from that point. For
more information, see Section 13.4.2.4, “SET GLOBAL sql_slave_skip_counter

Syntax”.
[此贴子已经被作者于2014-12-22 11:41:37编辑过]





欢迎光临 重庆思庄Oracle、Redhat认证学习论坛 (http://bbs.cqsztech.com/) Powered by Discuz! X3.2