MySQL 8.0 OCP 1Z0-908 题目解析(25)
题目97
Choose the best answer.
Consider this shell output and executed commands:
[root@oel7 ~]# ps aux | grep mysqld
mysql 2076 3.5 24.6 1386852 372572 ? Ssl 12:01 0:01 /usr/sbin/mysqld
[root@oel7 ~]# kill -15 2076
Which statement is true about MySQL server shutdown?
○ A) kill -15 and kill -9 are effectively the same forced shutdown that risk committed transactions not written to disk.
○ B) mysqld_safe prohibits commands that would harm the operation of the server. An error would be returned by the kill command.
○ C) kill -15 carries out a normal shutdown process, such as mysqladmin shutdown.
○ D) kill -15 should be avoided. Use other methods such as mysqladmin shutdown or systemctl stop mysqld.
翻译
选择最佳答案。
查看以下 shell 输出和执行的命令:
[root@oel7 ~]# ps aux | grep mysqld
mysql 2076 3.5 24.6 1386852 372572 ? Ssl 12:01 0:01 /usr/sbin/mysqld
[root@oel7 ~]# kill -15 2076
关于 MySQL 服务器关闭,哪个陈述是正确的?
○ A) kill -15
和 kill -9
实际上是相同的强制关闭,会有已提交事务未写入磁盘的风险。
○ B) mysqld_safe
禁止会损害服务器操作的命令。kill
命令会返回错误。
○ C) kill -15
执行正常的关闭流程,类似于 mysqladmin shutdown
。
○ D) 应避免使用 kill -15
。使用其他方法如 mysqladmin shutdown
或 systemctl stop mysqld
。
解析和答案
- 选项A:
kill -15
是正常终止信号,kill -9
是强制终止,二者不同,kill -15
不会有已提交事务未写盘的高风险(会触发正常关闭流程 ),A错误。 - 选项B:
mysqld_safe
不会阻止kill -15
(正常关闭信号 ),kill
命令也不会返回错误,B错误。 - 选项C:
kill -15
会向进程发送终止信号,MySQL 收到后会执行正常关闭流程(如刷新日志、关闭表等 ),类似于mysqladmin shutdown
,C正确。 - 选项D:
kill -15
是合理的正常关闭方式,无需避免,D错误。
所以答案是C。
知识点总结
- MySQL 服务器关闭信号:理解
kill
命令不同信号的作用,kill -15
(SIGTERM )会触发 MySQL 正常关闭流程,服务器会有序完成事务提交、日志刷新、资源释放等操作。掌握正常关闭信号的使用,在需要手动关闭 MySQL 时,优先选择kill -15
或更友好的工具(如mysqladmin shutdown
、systemctl
),保障数据完整性和服务器正常关闭。 - 数据库运维操作:在数据库日常运维中,正确的关闭操作对数据安全至关重要。知晓
kill -15
等信号的含义和效果,能够避免因错误的关闭方式(如kill -9
)导致数据丢失或损坏。合理选择关闭方法,确保 MySQL 服务器安全、稳定地停止运行,维护数据库的可靠性。
题目98
Choose three.
Which three sets of item information are visible in the mysql
system database?
□ A) time zone information and definitions
□ B) help topics
□ C) plugins
□ D) audit log events
□ E) performance monitoring information
□ F) rollback segments
□ G) information about table structures
翻译
选择三项。
在 mysql
系统数据库中,可见哪三组项目信息?
□ A) 时区信息和定义
□ B) 帮助主题
□ C) 插件
□ D) 审计日志事件
□ E) 性能监控信息
□ F) 回滚段
□ G) 表结构信息
解析和答案
- 选项A:
mysql
数据库中有时区相关表(如time_zone
)存储时区信息和定义,A正确。 - 选项B:
mysql.help_topic
等表存储帮助主题信息,B正确。 - 选项C:
mysql.plugin
表存储插件相关信息,C正确。 - 选项D:审计日志事件通常不在
mysql
数据库,而是在其他位置(如文件或特定审计表 ),D错误。 - 选项E:性能监控信息主要在
performance_schema
数据库,不在mysql
,E错误。 - 选项F:回滚段信息不是存储在
mysql
数据库,F错误。 - 选项G:表结构信息存储在
information_schema
或表空间,不在mysql
数据库,G错误。
所以答案是A、B、C。
知识点总结
- mysql 系统数据库内容:了解
mysql
系统数据库存储的信息,包含时区定义、帮助主题、插件信息等。掌握这些内容的存储位置,在需要查询时区设置、帮助文档、插件状态时,能够准确访问mysql
数据库中的对应表,辅助数据库配置和运维操作。 - 数据库系统表作用:不同的系统数据库(如
mysql
、information_schema
、performance_schema
)分工不同。mysql
主要存储用户、权限、时区、插件等基础配置信息;information_schema
提供元数据访问;performance_schema
用于性能监控。熟悉各系统数据库的作用,可高效进行数据库管理和问题排查。
题目99
Choose two.
Which two statements are true about the data dictionary object cache?
□ A) The dictionary object caches use a Least Recently Used (LRU) algorithm to manage entries in each cache.
□ B) Character set and collation definition objects are not cached.
□ C) All dictionary object caches have a hard-coded size.
□ D) If the dictionary object cache becomes full, MySQL server will be unable to create any more tables/objects.
□ E) tablespace_definition_cache sets the number of tablespace objects that can be stored in the dictionary object cache.
翻译
选择两项。
关于数据字典对象缓存,哪两个陈述是正确的?
□ A) 字典对象缓存使用最近最少使用(LRU )算法来管理每个缓存中的条目。
□ B) 字符集和排序规则定义对象不会被缓存。
□ C) 所有字典对象缓存都有硬编码的大小。
□ D) 如果字典对象缓存已满,MySQL 服务器将无法再创建任何表/对象。
□ E) tablespace_definition_cache
设置可存储在字典对象缓存中的表空间对象数量。
解析和答案
- 选项A:MySQL 的数据字典对象缓存确实使用 LRU 算法管理条目,A正确。
- 选项B:字符集和排序规则定义对象属于数据字典内容,会被缓存,B错误。
- 选项C:字典对象缓存大小可配置(如通过相关系统变量 ),不是硬编码,C错误。
- 选项D:缓存满时会根据 LRU 算法淘汰旧条目,仍可创建新表/对象,D错误。
- 选项E:
tablespace_definition_cache
用于设置字典对象缓存中可存储的表空间对象数量,E正确。
所以答案是A、E。
知识点总结
- 数据字典对象缓存机制:了解 MySQL 数据字典对象缓存的管理方式,使用 LRU 算法维护缓存条目,部分缓存大小可通过系统变量(如
tablespace_definition_cache
)配置。掌握这些机制,有助于理解数据库在处理元数据操作(如表创建 )时的性能表现,合理调整缓存相关参数,优化元数据访问效率,提升数据库整体性能。 - 数据库性能优化:在数据库性能优化中,元数据缓存是重要环节。通过调整数据字典对象缓存的相关配置,可影响元数据的访问速度和存储容量。合理设置缓存大小和利用 LRU 算法,能够减少元数据查询的磁盘 I/O,加快表创建、结构修改等操作的执行速度,提升数据库的响应性能。
题目100
Choose the best answer.
You are using an existing server with a new configuration. MySQL Server fails to start.
Examine this snapshot of the error log:
190925 12:49:05 InnoDB: Initializing buffer pool, size = 3.0G
190925 12:49:05 InnoDB: Completed initialization of buffer pool
InnoDB: Error: log file ./ib_logfile0 is of different size 0 5242880 bytes
InnoDB: than specified in the .cnf file 0 26214400 bytes!
190925 12:49:05 [ERROR] Plugin 'InnoDB' init function returned error.
190925 12:49:05 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
190925 12:49:05 [ERROR] Aborting
190925 12:49:05 [Note] /usr/sbin/mysqld: Shutdown complete
Which action would allow the server to start?
○ A) Execute mysqladmin flush-logs.
○ B) Create a new ib_logfile0 file of size 26214400.
○ C) Remove ib_logfile0 and ib_logfile1 files from the file system.
○ D) First run mysqld --initialize to refresh the size of ib_logfile.
翻译
选择最佳答案。
你在现有服务器上使用新配置,MySQL 服务器无法启动。
查看错误日志的快照:
190925 12:49:05 InnoDB: Initializing buffer pool, size = 3.0G
190925 12:49:05 InnoDB: Completed initialization of buffer pool
InnoDB: Error: log file ./ib_logfile0 is of different size 0 5242880 bytes
InnoDB: than specified in the .cnf file 0 26214400 bytes!
190925 12:49:05 [ERROR] Plugin 'InnoDB' init function returned error.
190925 12:49:05 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
190925 12:49:05 [ERROR] Aborting
190925 12:49:05 [Note] /usr/sbin/mysqld: Shutdown complete
哪个操作可以让服务器启动?
○ A) 执行 mysqladmin flush-logs
。
○ B) 创建一个大小为 26214400 的新 ib_logfile0
文件。
○ C) 从文件系统中删除 ib_logfile0
和 ib_logfile1
文件。
○ D) 首先运行 mysqld --initialize
来刷新 ib_logfile
的大小。
解析和答案
- 选项A:
mysqladmin flush-logs
用于刷新日志,不能解决日志文件大小不匹配问题,A错误。 - 选项B:直接创建新文件可能导致数据不一致(因为
ib_logfile1
大小也可能不匹配,且日志文件是成对存在 ),B错误。 - 选项C:InnoDB 日志文件(
ib_logfile0
和ib_logfile1
)大小需与配置一致,删除旧的不匹配的日志文件后,MySQL 启动时会重新创建符合配置大小的日志文件,C正确。 - 选项D:
mysqld --initialize
用于初始化新的数据库实例,会清除现有数据,不适合现有服务器,D错误。
所以答案是C。
知识点总结
- InnoDB 日志文件问题处理:当 InnoDB 日志文件大小与配置不一致导致服务器无法启动时,删除旧的日志文件(
ib_logfile0
和ib_logfile1
)是可行的解决方法。MySQL 启动时会自动创建符合配置大小的新日志文件,保障 InnoDB 正常初始化。掌握该处理方式,能够在遇到日志文件大小不匹配问题时,快速恢复服务器启动,减少停机时间。 - 数据库启动故障排查:在排查 MySQL 启动故障时,错误日志是关键依据。针对 InnoDB 相关错误,需关注日志文件、缓冲池等配置。通过分析错误日志信息,定位问题根源(如日志文件大小不匹配 ),采取针对性措施(如删除旧日志文件 ),恢复数据库正常启动,保障业务连续性。