今天和Oracle的一个资深前辈聊了下,聊了不少技术的问题,他也来了兴致,随机提了几个问题来问我,发现看似简单的问题还是有不少
今天和Oracle的一个资深前辈聊了下,聊了不少技术的问题,,他也来了兴致,随机提了几个问题来问我,发现看似简单的问题还是有不少的干货,很多东西似懂非懂其实还是没有深入理解,限于篇幅,整理了一部分的问题,有些问题回答的对,但是感觉理解还是不够清晰深入。
log buffer
log buffer的作用
logbuffer的作用主要有两部分,生成重做记录,另一部分就是把重做记录写入重做日志文件。
commit操作的时候,是否会刷新log buffer?
其实每一个commit就会触发一次改动向量,完成了一次事务的更新。
PGA
pga的作用
pga的全称是program global area,它是一个内存区域,该区域中包含了于某个特定服务器进程 相关的数据和控制信息。对于每个session来说,其执行的sql语句锁传入的绑定变量会存储在pga中,需要执行比较复杂的sql语句时,排序和hash join连接这类的session所占用的内存空间也来自于PGA.
进程之间是否会共享PGA?
pga所占用的内存区域只能被其所属的进程访问,而不能被其它进程访问,所以pga中也不需要latch这样的内存结构来保护其中的信息。
buffer cache
buffer cache中的算法
buffer cache中用到的算法有hash算法和LRU算法。
当前台进程发出一个select或者dml语句的时候,oracle会根据执行计划找到符合条件的数据块,然后会根据请求数据块的地址以及数据块的类型作为参数,运用hash算法找到数据块所处的hash bucket,即确定数据块是在那个hash chain上。
LRU算法即最近最少使用的buffer header链表,LRU链表串联起来的buffer header都执行可用数据块,buffer按照被使用的先后顺序挂在LRUlianbiao shang ,先使用的buffer挂在LRU链表的后面,后被使用的buffer则挂在LRU链表的前面。
buffer cache中数据块的状态
脏数据块,空闲数据块,干净数据块,钉住的数据块。对于空闲数据块和干净数据块,都统称为可用数据块。因为其中的内容可以被新的数据内容覆盖。
shared pool
数据字典的信息存储在哪里?
数据字典的信息存储在shared pool中的dictionary cache中。dictionary cache中存放了执行sql语句的过程中,所参照的数据字典的信息,包含sql语句所涉及的表名,表列,权限信息等,dictionary cache中的信息都是以数据行的形式存放的。所以也可以叫做row cache.
CKPT
进程CKPT在哪里找到对应的信息。
CKPT即检查点为止(checkpoint position),检查点的位置记录在控制文件中,在检查点队列上串起来的都是脏数据块所对应的buffer header,每次dbwr写脏数据块的时候,也是从检查点队列上扫描脏数据块,然后将脏数据块写入数据文件的。
数据恢复
数据恢复时的前滚与回滚的过程
如果数据库实例非正常关闭,则检查点end scn号为空,在数据恢复的时候,会从控制文件中取得检查点的位置,然后smon会到联机日志文件中找到对应的检查点位置,应用所有的重做条目,从而在buffer cache里又恢复了实例奔溃前那个时间点的状态,这个过叫做前滚。
如果前滚完毕之后,smon进程会立即打开数据库,但是这个时候数据库中还含有哪些处于中间状态的,没有提交也没有回滚的数据库,也就是脏数据块,因为没有被提交,所以需要被回滚,打开数据库以后,smon会在后台做回滚的操作。
rman
rman配置修改备份文件路径的方法
可以通过em,grid control中的图形界面来修改rman中的备份文件的路径,或者使用config命令方式来设定。
调优
自己sql调优常用的几个包是?
dbms_sqltune,dbms_sql_advisor
通过这些也发现自己对数据库有了一定的认识,但是还是需要不断的深化。可能自己碰到好多问题的时候都是囫囵吞枣,一问得细节一点就卡壳。人就是这样的过程中不断的提升自我,也从侧面反映出自己近期有点松懈,没有能够投入更加高效的精力来,努力努力,有则改进,无则加冕,生活本属不易,不能得过且过。:)
本文永久更新链接地址:

Mastering the method of adding MySQL users is crucial for database administrators and developers because it ensures the security and access control of the database. 1) Create a new user using the CREATEUSER command, 2) Assign permissions through the GRANT command, 3) Use FLUSHPRIVILEGES to ensure permissions take effect, 4) Regularly audit and clean user accounts to maintain performance and security.

ChooseCHARforfixed-lengthdata,VARCHARforvariable-lengthdata,andTEXTforlargetextfields.1)CHARisefficientforconsistent-lengthdatalikecodes.2)VARCHARsuitsvariable-lengthdatalikenames,balancingflexibilityandperformance.3)TEXTisidealforlargetextslikeartic

Best practices for handling string data types and indexes in MySQL include: 1) Selecting the appropriate string type, such as CHAR for fixed length, VARCHAR for variable length, and TEXT for large text; 2) Be cautious in indexing, avoid over-indexing, and create indexes for common queries; 3) Use prefix indexes and full-text indexes to optimize long string searches; 4) Regularly monitor and optimize indexes to keep indexes small and efficient. Through these methods, we can balance read and write performance and improve database efficiency.

ToaddauserremotelytoMySQL,followthesesteps:1)ConnecttoMySQLasroot,2)Createanewuserwithremoteaccess,3)Grantnecessaryprivileges,and4)Flushprivileges.BecautiousofsecurityrisksbylimitingprivilegesandaccesstospecificIPs,ensuringstrongpasswords,andmonitori

TostorestringsefficientlyinMySQL,choosetherightdatatypebasedonyourneeds:1)UseCHARforfixed-lengthstringslikecountrycodes.2)UseVARCHARforvariable-lengthstringslikenames.3)UseTEXTforlong-formtextcontent.4)UseBLOBforbinarydatalikeimages.Considerstorageov

When selecting MySQL's BLOB and TEXT data types, BLOB is suitable for storing binary data, and TEXT is suitable for storing text data. 1) BLOB is suitable for binary data such as pictures and audio, 2) TEXT is suitable for text data such as articles and comments. When choosing, data properties and performance optimization must be considered.

No,youshouldnotusetherootuserinMySQLforyourproduct.Instead,createspecificuserswithlimitedprivilegestoenhancesecurityandperformance:1)Createanewuserwithastrongpassword,2)Grantonlynecessarypermissionstothisuser,3)Regularlyreviewandupdateuserpermissions

MySQLstringdatatypesshouldbechosenbasedondatacharacteristicsandusecases:1)UseCHARforfixed-lengthstringslikecountrycodes.2)UseVARCHARforvariable-lengthstringslikenames.3)UseBINARYorVARBINARYforbinarydatalikecryptographickeys.4)UseBLOBorTEXTforlargeuns


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

SublimeText3 Chinese version
Chinese version, very easy to use

mPDF
mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

SecLists
SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

MinGW - Minimalist GNU for Windows
This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.
