MySQL 8.0 OCP 英文题库解析(二十)

Oracle 为庆祝 MySQL 30 周年,截止到 2025.07.31 之前。所有人均可以免费考取原价245美元的MySQL OCP 认证。

从今天开始,将英文题库免费公布出来,并进行解析,帮助大家在一个月之内轻松通过OCP认证。

本期公布试题181~190

试题181:

Choose the best answer.You have configured a working MySQL InnoDB Cluster in single-primary 
mode. What happens when the primary instance goes down due to a network problem? 
E)All remaining members in the cluster are automatically set to read-write mode. [错误] 
C)The cluster goes into wait mode until a new member is manually promoted as primary. [错误] 
D)The cluster detects network partitioning and shuts down to remain consistent. [错误] 
B)A new primary is automatically elected. [正确] 
A)The cluster will continue to function with read-only members. [错误]

解析

您已经配置了一个正常运行的单主模式MySQL InnoDB集群。当主实例因网络问题宕机时会发生什么?

选项:
E) 集群中所有剩余成员自动设置为读写模式 [错误]
C) 集群进入等待模式,直到手动将新成员提升为主节点 [错误]
D) 集群检测到网络分区并关闭以保持一致性 [错误]
B) 自动选举新的主节点 [正确]
A) 集群将继续以只读成员运行 [错误]

中文解析

正确答案是B) 自动选举新的主节点。

解析关键点:

    InnoDB Cluster在单主模式下具有自动故障转移能力

    当主节点故障时,集群会自动从剩余节点中选举新的主节点

    选举基于Group Replication的共识协议,考虑节点权重等因素

    整个过程自动完成,无需人工干预

其他选项错误原因:

    E) 错误,不会所有节点都变为读写模式,仍保持单主模式

    C) 错误,故障转移是自动的,不需要手动干预

    D) 错误,集群不会关闭,而是继续提供服务

    A) 错误,集群会选举新主节点,不会保持只读状态

试题182:

Choose the best answerYou have configured MySQL Enterprise Transparent Data Encryption (TDE). 
What command would you use to encrypt a table? 
D)ALTER TABLE  ENCRYPTION='Y'; [正确] 
A)UPDATE 
SET ENCRYPTION= 'Y'; [错误] C)UPDATE information_schema.tables SET encryption='Y' WHERE table_name='table'; [错误] B)ALTER INSTANCE ROTATE INNODB MASTER KEY; [错误]

解析

您已经配置了MySQL企业版透明数据加密(TDE)。您会使用什么命令来加密一个表?

选项:
D) ALTER TABLE 
ENCRYPTION='Y'; [正确] A) UPDATE
SET ENCRYPTION= 'Y'; [错误] C) UPDATE information_schema.tables SET encryption='Y' WHERE table_name='table'; [错误] B) ALTER INSTANCE ROTATE INNODB MASTER KEY; [错误] 中文解析 正确答案是D) ALTER TABLE
ENCRYPTION='Y'; 解析关键点: MySQL TDE表加密使用ALTER TABLE语句启用 ENCRYPTION='Y'选项指定表应被加密 加密操作会重写表数据,需要足够的存储空间 表加密后,所有数据文件(.ibd)会自动加密 其他选项错误原因: A) 错误,UPDATE语句用于修改数据而非表结构 C) 错误,information_schema是只读视图,不能直接更新 B) 错误,该命令用于轮换主加密密钥,不用于加密表

试题183:

Choose the best answer.A developer accidentally dropped the InnoDB table Customers from the 
Company database. There is a datadir copy from two days ago in the dbbackup directory.Which set 
of steps would restore only the missing table? 

A)Stop the MySQL Server process and restart it with the command:mysqld -
basedir=/usr/local/mysql --datadir=/dbbackup Run mysqldump on this table and restore the dump 
file. [错误] 
D)Stop the MySQL Server process, and execute:mysqlbackup --datadir=/var/lib/mysql --backup
dir=/dbbackup -- include-tables= 'Company\\. Customers' copy-back Start the mysqld process. [正
确] 
B)Stop the MySQL Server process and restart it with the command:, mysqld -
basedir=/usr/local/mysql --datadir=/var/lib/mysql Run mysqldump on this table and restore the 
dump file. [错误] 
C)Stop the MySQL Server process, copy the Customers.ibd file from the dbbackup directory, and 
start the mysqld process. [错误]

解析


正确答案是D) 停止MySQL服务器进程,并执行:mysqlbackup --datadir=/var/lib/mysql --backup-dir=/dbbackup --include-tables='Company\.Customers' copy-back,然后启动mysqld进程。

解析关键点:

    使用mysqlbackup工具可以精确恢复单个表

    --include-tables参数指定要恢复的特定表

    copy-back操作会将备份中的表数据恢复到原数据目录

    整个过程不需要重启服务器到备份目录

其他选项错误原因:

    A) 错误,重启服务器到备份目录会影响所有数据库,且mysqldump不是InnoDB表的最佳恢复方式

    B) 错误,没有使用备份数据,且mysqldump不适合部分恢复

    C) 错误,直接复制.ibd文件而不处理数据字典会导致不一致

试题184:

Choose the best answer.Examine this partial report:mysql> SHOW FULL PROCESSLIST;(下图过)
Examine this query:SELECT SUM(m.CURRENT_NUMBER_OF_BYTES_USED) AS TOTALFROM 
performance_schema.memory_summary_by_thread_by_event_name m INNER JOIN 
performance_schema.threads tON m.THREAD_ID = t.THREAD_ID WHERE t.PROCESSLIST_ID = 
10;What information does this query provide? 

D)total memory used by thread number 10 [错误] 
C)total memory used by the first 10 threads [错误] 
B)total memory used across all connections associated with the user on connection number 10 [错误] 
A)total memory used by connection number 10 [正确] 
F)total memory used by the first 10 connections [错误] 
E)total memory used across all connections associated with the user on thread number 10 [错误] 

MySQL 8.0 OCP 英文题库解析(二十)_第1张图片

解析


D) 线程号10使用的总内存 [错误]
C) 前10个线程使用的总内存 [错误]
B) 与连接号10相关联的用户在所有连接中使用的总内存 [错误]
A) 连接号10使用的总内存 [正确]
F) 前10个连接使用的总内存 [错误]
E) 与线程号10相关联的用户在所有线程中使用的总内存 [错误]
中文解析

正确答案是A) 连接号10使用的总内存。

解析关键点:

    查询通过t.PROCESSLIST_ID = 10筛选特定连接
    连接ID(10)对应SHOW PROCESSLIST中的Id列
    查询汇总了该连接所有线程的内存使用情况

    memory_summary_by_thread_by_event_name表记录每个线程的内存使用详情

其他选项错误原因:
    D) 错误,查询基于PROCESSLIST_ID而非THREAD_ID
    C) 错误,查询只针对单个连接,不是前10个线程
    B) 错误,查询不涉及用户的所有连接
    F) 错误,查询不涉及前10个连接
    E) 错误,查询不涉及用户的所有线程

试题185:

You plan to take daily full backups, which include the ndbinfo and sys (internal) databases.W hich 
command will back up the databases in parallel? 
B)mysqlpump -- include-databases=% > full -backup-$ (date +%Y%m$d) .sql [正确] 
A)mysqldump --single-transaction > full-backup-$ (date +%Y%m%d) .sql [错误] 
D)mysqldump --all -databases > full_ backup-$ (date +%Y%m%d) .sql [错误] 
C)mysqlpump --all -databases > full -backup-$ (date +%Y%m%d) .sql [错误]


解析

正确答案是
B) mysqlpump --include-databases=% > full-backup-$(date +%Y%m%d).sql

解析关键点:

    mysqlpump是MySQL 5.7+引入的备份工具,支持并行备份

    --include-databases=%参数表示备份所有数据库(包括ndbinfo和sys)

    %通配符匹配所有数据库名称

    mysqlpump默认使用多线程并行备份不同数据库

其他选项错误原因:

    A) 错误,mysqldump不支持并行备份

    D) 错误,虽然能备份所有数据库,但mysqldump是单线程的

    C) 错误,虽然mysqlpump支持并行,但--all-databases会排除内部数据库

试题186:

Examine this command, which executes successfully:mysqlbackup --user=dba --password -
port=3306 --with-timestamp --backup-dir=/export/backups backup-and-apply-logWhich 
statement is true?  
B)The database server is put into a read-only state for the duration of the backup. [错误] 
C)An offline backup of InnoDB tables is taken. [错误] 
D)The backup can be impacted when DDL operations run during the backup. [正确] 
A)The backup accesses the MySQL server files by using a pre-existing connection. [错误]

解析

检查这个成功执行的命令:

mysqlbackup --user=dba --password --port=3306 --with-timestamp --backup-dir=/export/backups backup-and-apply-log

哪个陈述是正确的?

选项:
B) 数据库服务器在备份期间被设置为只读状态 [错误]
C) 对InnoDB表进行了离线备份 [错误]
D) 备份可能受到备份期间运行的DDL操作的影响 [正确]
A) 备份通过预先存在的连接访问MySQL服务器文件 [错误]
中文解析

正确答案是
D) 备份可能受到备份期间运行的DDL操作的影响。

解析关键点:

    mysqlbackup是MySQL企业版的热备份工具
    backup-and-apply-log参数表示执行备份并立即应用日志
    这是在线备份,不会使服务器只读(B错误)
    备份期间若执行DDL(如ALTER TABLE)可能导致备份不一致
    备份通过新建连接访问服务器(A错误)

其他选项错误原因:

    B) 错误,mysqlbackup执行的是热备份,不会使服务器只读
    C) 错误,这是在线备份而非离线备份
    A) 错误,mysqlbackup会建立新连接而非使用现有连接

试题187:

Choose the best answer.Database test contains a table named city that has the InnoDB storage 
engine.(见下图)What is the content of the test folder in the data directory? 

B)city.ibd [正确] 
E)city.ibd, city.frm, and city.sdi [错误] 
D)city.ibd and city.frm [错误] 
C)city.ibd and city.sdi [错误] 
A)city.MYD, city.MYI, and city.sdi [错误] 

MySQL 8.0 OCP 英文题库解析(二十)_第2张图片

解析

    MySQL 8.0+版本中InnoDB表的文件结构:
        只有.ibd文件(表空间文件)
        不再有单独的.frm文件(表定义)
        表元数据存储在数据字典中
    对于InnoDB表:
        .ibd文件包含表数据和索引
        表结构信息存储在MySQL数据字典中
        不再需要.frm文件(MySQL 8.0移除)
    其他文件说明:
        .MYD和.MYI是MyISAM引擎文件
        .sdi文件是某些情况下用于序列化字典信息

其他选项错误原因:

    E) 错误,8.0版本不再有.frm文件
    D) 错误,同上原因
    C) 错误,.sdi文件不是标准InnoDB表文件
    A) 错误,列出的是MyISAM引擎文件

试题188:

Choose the best answer.Examine this command, which executes successfully:
$ mysqlrouter -bootstrap user@hostname:port --directory=directory_path 
Which activity is performed? 

C)MySQL Router is restarted. [错误] 
D)MySQL Router is configured based on the information in files in directory_path. [错误] 
B)MySQL Router configures all the cluster nodes based on the information retrieved from the 
InnoDB cluster metadata server. [错误] 
A)MySQL Router configures itself based on the information retrieved from the InnoDB cluster metadata server. [正确] 

解析


选项:
C) MySQL Router被重启 [错误]
D) MySQL Router基于directory_path中的文件信息进行配置 [错误]
B) MySQL Router基于从InnoDB集群元数据服务器检索的信息配置所有集群节点 [错误]
A) MySQL Router基于从InnoDB集群元数据服务器检索的信息进行自我配置 [正确]


正确答案是A) MySQL Router基于从InnoDB集群元数据服务器检索的信息进行自我配置。

解析关键点:

    --bootstrap选项用于初始化MySQL Router配置

    命令会连接指定的InnoDB集群元数据服务器(user@hostname:port)

    从元数据服务器获取集群拓扑信息

    生成Router的配置文件到指定目录(--directory)

    这是Router的初始配置过程,不是重启或节点配置

其他选项错误原因:

    C) 错误,这是初始化配置而非重启

    D) 错误,配置信息来自集群元数据而非现有文件

    B) 错误,Router只配置自己,不配置集群节点

试题189:

Choose the best answer.You issue this command:SHOW SLAVE STATUSIn the output, there is a 
value for seconds_behind_master. How is this time calculated? 
A)It is the time between the I/O thread receiving details of the master's last transaction and the time 
it was applied by the SQL thread. [正确] 
B)It is the time between the most recent transaction written to the relay logs and the time it was 
committed on the master. [错误] 
C)It is the time between the I/O thread receiving details of the master's last transaction and the time 
it was written to the relay log on the slave. [错误] 
D)It is the time between the most recent transaction applied by a SQL thread and the time it was 
committed on the master. [错误]

解析

您执行了命令:SHOW SLAVE STATUS。在输出中有一个seconds_behind_master值。这个时间是如何计算的?

选项:
A) 它是I/O线程接收到主服务器最后一个事务详情与应用该事务的SQL线程之间的时间差 [正确]
B) 它是最近一个事务写入中继日志的时间与在主服务器上提交该事务的时间差 [错误]
C) 它是I/O线程接收到主服务器最后一个事务详情与将该事务写入从服务器中继日志的时间差 [错误]
D) 它是SQL线程应用最近一个事务的时间与在主服务器上提交该事务的时间差 [错误]


正确答案是A) 它是I/O线程接收到主服务器最后一个事务详情与应用该事务的SQL线程之间的时间差。

解析关键点:
    seconds_behind_master表示从服务器落后主服务器的秒数

    计算方式:

        比较从服务器SQL线程当前正在执行的事件的时间戳
        与主服务器上该事件被记录的时间戳
        计算两者差值
    实际反映的是从服务器应用事件与主服务器产生事件的延迟

其他选项错误原因:

    B) 错误,不是基于中继日志写入时间
    C) 错误,不是基于中继日志写入时间
    D) 错误,不是基于事务提交时间

试题190:

Which command enables rule -based MySQL Auditing capabilities? 
C)mysql>INSTALL PLUGIN audit_ log; [错误] 
D)mysql>INSTALL COMPONENT audit_ log; [错误] 
B)shell> mysqld --initialize --log- raw=audit. log [错误] 
A)shell> mysql < audit_ log_ filter_ linux_ install.sql [正确]

解析

哪个命令可以启用基于规则的MySQL审计功能?

选项:
C) mysql>INSTALL PLUGIN audit_log; [错误]
D) mysql>INSTALL COMPONENT audit_log; [错误]
B) shell> mysqld --initialize --log-raw=audit.log [错误]
A) shell> mysql < audit_log_filter_linux_install.sql [正确]


正确答案是A) shell> mysql < audit_log_filter_linux_install.sql。

你可能感兴趣的:(mysql,开闭原则,数据库)