Oracle 為慶祝 MySQL 30 周年,截止到 2025.07.31 之前。所有人均可以免費考取原價245美元的MySQL OCP 認證。
從今天開始,將英文題庫免費公布出來,并進行解析,幫助大家在一個月之內輕松通過OCP認證。
本期公布試題26~30
試題26:
The data in this instance transient;no backup or replication will be required.It is currently under performing.The database size is static and including indexes is 19G Total system memory is 32G After profiling the system,you highlight these MySQL status and global variables:
Com_rollback 85408355 Com_commit 1234342
Innodb_buffer_pool_pages_free 163840
mysqld Buffer_pool_size=20G
Innodb_flush_log_at_trx_commit=2
Disable-log-bin
The OS metrics indicate that disk is a bottleneck.Other variables retain their default values.Which two changes will provide the most benefit to the instance? F)innodb_log_file_size=1G [正確]
C)innodb_flush_log_at_trx_commit=1 [錯誤]
E)max_connections=10000 [錯誤]
D)innodb_doublewrite=0 [正確]
B)buffer_pool_size=24G [錯誤]
A)sync_binlog=0 [錯誤]
解析
題目描述了一個 臨時性、無備份、無復制需求的 MySQL 實例,當前性能較差,并給出以下關鍵信息:數據庫大小:19GB(含索引),數據量穩定(不再增長)。系統內存:32GB,但當前 innodb_buffer_pool_size 僅配置為 20GB。
事務回滾率極高:Com_rollback(85,408,355)遠高于 Com_commit(1,234,342),表明事務沖突或邏輯錯誤頻繁。當前配置:
innodb_flush_log_at_trx_commit=2(犧牲持久性換取性能,事務提交時日志不立即刷盤)。
disable-log-bin(未啟用二進制日志,無需考慮復制或恢復)。
innodb_buffer_pool_pages_free=163840(空閑緩沖池頁數,計算得約 2.5GB 未使用,說明 buffer_pool_size 未充分利用)。The OS metrics indicate that disk is a bottleneck.
磁盤成為瓶頸(OS 指標顯示 I/O 壓力大)。哪兩項更改將為實例提供最大的好處?F)innodb_log_file_size=1G [正確]
innoDB日志文件(ib_logfile0/1)默認較小,頻繁切換會引發大量磁盤I/O。
增大到1G可顯著減少日志切換頻率,緩解磁盤壓力。C)innodb_flush_log_at_trx_commit=1 [錯誤]
innodb_flush_log_at_trx_commit=1
設置為1會要求事務提交時日志立即刷盤,加劇磁盤I/O,與優化目標相反。E)max_connections=10000 [錯誤]
max_connections=10000
連接數與當前磁盤瓶頸無關,且過高會導致資源浪費。D)innodb_doublewrite=0 [正確]
雙寫緩沖(Doublewrite)是InnoDB防止數據頁損壞的機制,但會額外寫入磁盤。
臨時實例可關閉(題目聲明無需備份/持久性),提升寫入性能。B)buffer_pool_size=24G [錯誤]
當前20GB緩沖池已足夠緩存19GB數據,增大后OS和其他進程可能內存不足。A)sync_binlog=0 [錯誤]
二進制日志已禁用(disable-log-bin),此參數無意義。
試題27:
Choose two.User `fwuser`@`localhost` is registered with the MySQL Enterprise Firewall and has been
granted privileges for the SAKILA database.Examine these commands that you executed and the
results:mysql> SELECT MODE FROM INFORMATION_SCHEMA.MYSQL_FIREWALL_USERSWHERE
USERHOST = 'fwuser@localhost' ;(見下圖)
You then execute this command:mysql> CALL
mysql.sp_set_firewall_mode('fwuser@localhost' , 'RESET') ; Which two are true? G)The fwuser@localhost account mode is set to OFF. [正確]
D)The mysql.firewall_users table is truncated. [錯誤]
C)The whitelist of the fwuser@localhost account is truncated. [正確]
A)The fwuser@localhost account is removed from the mysql.user table. [錯誤]
B)The information_schema.MYSQL_FIREWALL_WHITELIST table is truncated. [錯誤]
F)The fwuser@localhost account mode is set to DETECTING. [錯誤]
E)The firewall resets all options to default values. [錯誤]
sp_set_firewall_mode('user', 'RESET')
1. 用戶模式設為 OFF
2. 清空該用戶白名單
不涉及的操作
用戶刪除、全局配置變更、其他用戶數據G)The fwuser@localhost account mode is set to OFF. [正確]
執行 CALL mysql.sp_set_firewall_mode('fwuser@localhost', 'RESET') 后,防火墻模式會從當前狀態(如圖中的 DETECTING)重置為 OFF。
OFF 模式:防火墻對該用戶完全禁用,不檢測或攔截任何SQL語句。D)The mysql.firewall_users table is truncated. [錯誤]
mysql.firewall_users 表被清空
錯誤原因:RESET 僅清空白名單表(firewall_whitelist),不會操作 firewall_users 表。C)The whitelist of the fwuser@localhost account is truncated. [正確]
RESET 操作會清空該用戶的白名單規則(即刪除 mysql.firewall_whitelist 表中相關記錄)。
注意:僅影響當前用戶的白名單,其他用戶或全局配置不受影響。A)The fwuser@localhost account is removed from the mysql.user table. [錯誤]
fwuser@localhost 賬戶從 mysql.user 表移除
錯誤原因:防火墻操作不影響用戶賬戶本身,僅管理防火墻規則。B)The information_schema.MYSQL_FIREWALL_WHITELIST table is truncated. [錯誤]
information_schema.MYSQL_FIREWALL_WHITELIST 表被清空
錯誤原因:RESET 操作的是底層 mysql.firewall_whitelist 表,而非信息模式視圖。F)The fwuser@localhost account mode is set to DETECTING. [錯誤]
賬戶模式被設置為 DETECTING
錯誤原因:RESET 會將模式設為 OFF,而非 DETECTING(檢測模式需手動啟用)。E)The firewall resets all options to default values. [錯誤]
防火墻所有選項重置為默認值
錯誤原因:RESET 僅針對當前用戶的白名單和模式,不影響全局防火墻配置。
試題28:
Choose two.Examine this statement and output:
mysql> SHOW GRANTS FOR jsmith;
Grants for jsmith@%GRANT USAGE ON *.* TO 'jsmith@'%'
GRANT UPDATE (Name) ON 'world.country' TO 'jsmith'@'%';
2 rows in set (0.00 sec)
Which two SQL statements can jsmith execute? D)UPDATE world.country SET Name='all'; [正確]
B)UPDATE world.country SET Name='one' LIMIT 1; [正確]
C)UPDATE world.country SET Name=' first ' ORDER BY Name LIMIT 1; [錯誤]
A)UPDATE world.country SET Name=CONCAT ('New ' ,Name) ; [錯誤]
E)UPDATE world.country SET Name=' new' WHERE Name='old'; [錯誤]
解析
本題考查表的update、select權限
用戶 jsmith 被授予對 world.country 表 Name 列的更新權限(GRANT UPDATE (Name) ON world.country)。
因此 正確選項D、BC) UPDATE world.country SET Name='first' ORDER BY Name LIMIT 1;
錯誤原因:雖然語法有效,但 ORDER BY 需要 SELECT 權限(用戶未被授予),執行會報權限錯誤。A) UPDATE world.country SET Name=CONCAT('New ', Name);
錯誤原因:CONCAT 函數需讀取原 Name 值,隱式需要 SELECT 權限(用戶僅有 UPDATE 權限)。E) UPDATE world.country SET Name='new' WHERE Name='old';
錯誤原因:WHERE 條件需檢查 Name 列值,隱式需要 SELECT 權限。
試題29:
Choose twoThere are five MySQL instances configured with a working group replication. Examine
the output of the group members:mysql> SELECT MEMBER_ID, MEMBER_STATE
FROMperformance_schema.replication_group_members;(見下圖)Which two statements are true
about network partitioning in the cluster?
C)The cluster will shut down to preserve data consistency. [錯誤]
D)There could be both a 2 node and 3 node group replication still running, so shutting down group
replication and diagnosing the issue is recommended. [正確]
A)The group replication will buffer the transactions on the online nodes until the unreachable nodes
return online. [錯誤]
E)The cluster has built-in high availability and updates group_replication_ip_whitelist to remove the
unreachable nodes. [錯誤]
B)A manual intervention to force group members to be only the working two instances is required.
[正確]
解析
這是一個有5個實例的MGR高可用集群
C)The cluster will shut down to preserve data consistency. [錯誤]
集群將自動關閉以保持數據一致性
錯誤原因:Group Replication 不會自動關閉,分裂的子組可能繼續運行(需手動干預)。D)There could be both a 2 node and 3 node group replication still running, so shutting down group replication and diagnosing the issue is recommended. [正確]
可能存在一個 2 節點和一個 3 節點的 Group Replication 仍在運行,建議關閉 Group Replication 并診斷問題2 個節點為 ONLINE(在線),3 個節點為 UNREACHABLE(不可達)。
若網絡分裂為兩部分(如 2 節點和 3 節點各自獨立),可能形成“腦裂”(Split-Brain),雙方均認為自己是多數派(quorum)。A)The group replication will buffer the transactions on the online nodes until the unreachable nodes return online. [錯誤]
Group Replication 會在在線節點上緩沖事務,直到不可達節點恢復
錯誤原因:事務不會緩沖,若節點失去 quorum(多數派),寫入會直接失敗E)The cluster has built-in high availability and updates group_replication_ip_whitelist to remove the unreachable nodes. [錯誤]
集群內置高可用性,并自動更新 group_replication_ip_whitelist 移除不可達節點錯誤原因:
group_replication_ip_whitelist 僅控制允許連接的 IP,不會動態修改。B)A manual intervention to force group members to be only the working two instances is required. [正確]
需要手動干預,強制將集群成員設置為僅剩的兩個工作實例。
試題30:
Choose two.Which two statements are true about InnoDB data-at-rest encryption?
A)It supports all indexes transparently. [正確]
B)It decrypts data for use in memory: [正確]
D)It does not support the transportable tablespaces feature. [錯誤]
E)It enforces encryption from disk to memory and over network transmission. [錯誤]
C)It supports only non-blob datatypes. [錯誤]
解析
A)It supports all indexes transparently. [正確] InnoDB 靜態加密會自動加密表空間文件(.ibd)和重做日志(redo log),包括所有索引數據(如 B+樹索引、全文索引等)。透明性:應用無需修改查詢邏輯,索引操作(如 WHERE 條件、ORDER BY)仍正常執行。B)It decrypts data for use in memory: [正確]
數據在內存中使用時會解密加密僅針對磁盤存儲(靜態數據),數據加載到內存前會自動解密,確保查詢性能不受影響。安全性:內存中為明文,但依賴操作系統的內存保護機制(如 Linux 的 mlock)。D)It does not support the transportable tablespaces feature. [錯誤]
不支持可傳輸表空間(Transportable Tablespaces)
錯誤原因:InnoDB 加密支持可傳輸表空間,但需在導出/導入時處理加密元數據(如密鑰)。E)It enforces encryption from disk to memory and over network transmission. [錯誤]
強制加密從磁盤到內存及網絡傳輸
錯誤原因:
靜態加密僅針對磁盤數據,內存和網絡傳輸不加密(需額外配置 TLS 或應用程序加密)。C)It supports only non-blob datatypes. [錯誤]
僅支持非 BLOB 數據類型
錯誤原因:InnoDB 加密支持所有數據類型,包括 BLOB、TEXT 等大對象。