块修复是最简单的恢复,在数据库正常操作过程中由系统自动做的,用户几乎感觉不到。
块修复是最简单的恢复,在数据库正常操作过程中由系统自动做的,,用户几乎感觉不到。
系列文章:Oracle恢复内部原理 ?where=nkey&keyword=19824
7.1 块修复初始化和操作
前台进程在修改一个缓冲区的时候调用重做程序在该缓冲区上应用改变向量时因为前台进程僵死或者触发一个错误而导致缓冲区的状态不一致,块修复就是用来修复这种缓冲区的状态。修复的过程包括:(i)从磁盘上读取该块;(ii)用当前线程的重做日志重新构建该缓冲区的一致版本;(iii)将修复的块写回磁盘。如果块修复第一次失败了,会再尝试第二次,然后将该块标识为逻辑损坏(将该块的序号置为0),然后触发一个块损坏的错误。
块修复使用当前线程的重做日志构建缓冲区是可行的,因为:
1.块修复不能使用其他线程的重做日志或者当前线程最后一次检查点之前的重做日志。
2.直到当前线程检查点超出日志,联机日志才不会重用。
3.数据缓冲区中的都不需要从最后一次线程检查点之前的重做日志进行恢复。
7.2 缓冲区头部RBA 字段
缓冲区头(一个内存数据结构)包含下面这些跟块修复有关的字段:
Low-RBA和High-RBA:Low-RBA是从该数据块最后一次块清除操作以来应用的第一个重做日志的地址,High-RBA是该数据块最新的变更对应重做日志的地址。二者结合起来描述了将该数据块从磁盘上的版本变成最新的版本所需要的重做日志范围。
Recovery-RBA:当执行块修复的是PMON进程时且完成所有的块修复可能需要很长时间就用Recover-RBA来记录进度的。
7.3 PMON 和前台进程调用
如果前台进程在回调重做日志程序时前台进程报错,将由前台进程执行块修复;如果前台进程不是报错而是僵死了,将由PMON进程执行块修复。
块修复可能需要大量的时间和I/O。不过PMON进程可以有充足的时间做块修复而忽略其他紧急任务。因此对每次PMON执行块修复使用重做日志的量有个限制(一个常量指定了每次PMON调用可以使用的重做日志块的数量)。每次PMON执行块修复应用完最大的重做日志后,都会更新数据缓冲区的 Recovery-RBA字段以记录它的进度。当Recovery-RBA值达到High-RBA的值后,针对这个块的块修复过程结束。

MySQLstringtypesimpactstorageandperformanceasfollows:1)CHARisfixed-length,alwaysusingthesamestoragespace,whichcanbefasterbutlessspace-efficient.2)VARCHARisvariable-length,morespace-efficientbutpotentiallyslower.3)TEXTisforlargetext,storedoutsiderows,

MySQLstringtypesincludeVARCHAR,TEXT,CHAR,ENUM,andSET.1)VARCHARisversatileforvariable-lengthstringsuptoaspecifiedlimit.2)TEXTisidealforlargetextstoragewithoutadefinedlength.3)CHARisfixed-length,suitableforconsistentdatalikecodes.4)ENUMenforcesdatainte

MySQLoffersvariousstringdatatypes:1)CHARforfixed-lengthstrings,2)VARCHARforvariable-lengthtext,3)BINARYandVARBINARYforbinarydata,4)BLOBandTEXTforlargedata,and5)ENUMandSETforcontrolledinput.Eachtypehasspecificusesandperformancecharacteristics,sochoose

TograntpermissionstonewMySQLusers,followthesesteps:1)AccessMySQLasauserwithsufficientprivileges,2)CreateanewuserwiththeCREATEUSERcommand,3)UsetheGRANTcommandtospecifypermissionslikeSELECT,INSERT,UPDATE,orALLPRIVILEGESonspecificdatabasesortables,and4)

ToaddusersinMySQLeffectivelyandsecurely,followthesesteps:1)UsetheCREATEUSERstatementtoaddanewuser,specifyingthehostandastrongpassword.2)GrantnecessaryprivilegesusingtheGRANTstatement,adheringtotheprincipleofleastprivilege.3)Implementsecuritymeasuresl

ToaddanewuserwithcomplexpermissionsinMySQL,followthesesteps:1)CreatetheuserwithCREATEUSER'newuser'@'localhost'IDENTIFIEDBY'password';.2)Grantreadaccesstoalltablesin'mydatabase'withGRANTSELECTONmydatabase.TO'newuser'@'localhost';.3)Grantwriteaccessto'

The string data types in MySQL include CHAR, VARCHAR, BINARY, VARBINARY, BLOB, and TEXT. The collations determine the comparison and sorting of strings. 1.CHAR is suitable for fixed-length strings, VARCHAR is suitable for variable-length strings. 2.BINARY and VARBINARY are used for binary data, and BLOB and TEXT are used for large object data. 3. Sorting rules such as utf8mb4_unicode_ci ignores upper and lower case and is suitable for user names; utf8mb4_bin is case sensitive and is suitable for fields that require precise comparison.

The best MySQLVARCHAR column length selection should be based on data analysis, consider future growth, evaluate performance impacts, and character set requirements. 1) Analyze the data to determine typical lengths; 2) Reserve future expansion space; 3) Pay attention to the impact of large lengths on performance; 4) Consider the impact of character sets on storage. Through these steps, the efficiency and scalability of the database can be optimized.


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 Mac version
God-level code editing software (SublimeText3)

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.

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool

Zend Studio 13.0.1
Powerful PHP integrated development environment

SublimeText3 Linux new version
SublimeText3 Linux latest version
