search
HomeDatabaseMysql TutorialOracle体系结构学习笔记

Oracle体系结构学习笔记,oracle database 最重要的是online redo log,ldquo;写rdquo;:检查点进程计算工作负载,来定检查点,

体系结构和备份恢复原理
1 Oracle database 最重要的是online redo log
  类比法
  controlfile    :公司高管
  datafile       :生产车间
  online redo log:财务处
  注释:
  system表空间是第一生产车间;
  当公司高管换了,财务处也需要换;

2 shared pool主要包括:
  library cache:放代码(sql,pl/sql,java)
  data dictionary cache:放数据字典
  注释:
  在空间分配上,数据字典是男孩,代码是女孩,oracle server有重男轻女思想,若cache命中率低,要看的是女孩,而非男孩。因为会先给男孩喂奶水。
  最近最少使用到代码会被销隐掉,否则,不断的代码进来,shared pool会内存不足。

3 large pool
  下列场景需要用到large pool:
   用rman备份与恢复;
   并行sql;
   异步I/O;
   共享服务器模式;
   注释:
   large pool是shared pool的助理,若没有large pool,则会池迁移到shared pool。

4 java pool
  是个跑马场,不是放java代码的地方

5 database buffer cache和redo log buffer
  1)二者关系:
 redo log buffer         画家(描述者)
 database buffer cache   模特(被描述者)
  2)LGWR只能有一个;DBWR可以有多个
  3)oracle爱写日志,不爱写数据块。因为日志的单位是项(200个字节左右),而数据块的单位是块。
  4)redo log buffer要么全写,要么全不写;而database buffer cache则悠着点,一次写一点
  5)什么时候写日志?
  每3秒写
 1/3满写
 commit的时候写
 n M脏数据的时候写
 DBWR写之前写
  6)什么时候写数据块?
 完全检查点事件发生
 超时发生(增量检查点)
 脏块达到域值(增量检查点)
 没有free buffer的时候(对上面一条到补充)

6 oracle是个交易系统,,其交易发生在database buffer cache里。
  具体交易:
  “读”:server process去data dictionary cache查询,将需要的读到database buffer cache,然后,在PGA构造游标(结果集的指针),每一根指针都指向一个rowid,如果需要排序,连接,一致性读,则只需要对指针进行操作。所以,PGA是用户最直接的使用体验。
  “改”:  申请TADDR
   记日志
   动两边事务槽,加行头锁
  “写”:检查点进程计算工作负载,来定检查点,在检查点时,发生检查点事件,当检查点事件发生时逼着DBWRn按块第一次变脏的顺序写出一部份,由于这一部分脏块的写出,会在日志文件产生检查点位置。

7 RBA指针后有日志项,原因有二:
  1)整个表空间级下线
  2)按块第一次变脏的顺序写

8 用户不直接和oracle server打交道,而是和server process扛上了。
  类比:
  server process      导购小姐
  user   process      客人

9 “一根骨头挂点肉”
  这俗语可以形容server process 和PGA的关系
  骨头:server process
  肉  :PGA
  “一条绳上的两个蚂蚱”
  蚂蚱:SADDR,TADDR
  这话是说,新值在写的时候,旧值会跟着被写,同呼吸,共命运。所以,读上来8k,写下去便是16k,总共I/O为24k。

10 透过现象看本质
   提交的本质:释放锁,写日志,事务槽进入倒计时
   正常关机的本质:
     1)关闭JAVA进程(oracle大战java)
     2)写检查点
 a)将current_scn冻结
        b)把data block写下
 c)让checkpoint_change#等于current_scn
   注释:
   select resetlogs_change# a,checkpoint_change# b,current_scn c
   from v$database
   其中,a   a:建库的时间原点
   b:写数据块的界,写后,内存中的所有数据块多比b来得大。所以,增量检查点这个会被延迟标识,因为,还没有全部下来。

11 system表空间
   1)存放数据字典表
   2)包,过程,函数和触发器等pl/sql对象

12 sysaux表空间
   1)90%用来收集工作负载
   2)10%存放sysman到东西
   类比:
   生活中,水表,电表,煤气表,这些表上面的度数,都是“逝者如斯夫”,为了比较,合理开支,需要抄表。

13 buffer的四种状态
   free:写下去的时候
   clean:刚读上来
   pinned:特殊的clean,被加了latch,正要用
   dirty:被改了

14 RBA指针的碎碎念
   方向:总是无缝下移
   出生地:控制文件
   指向地:日志文件
   过帐:对应的数据块已写到数据文件中
   active :被RBA覆盖的日志(RBA只有一根)
   完全检查点会直接把RBA干到重做日志组的最后一条

15 断电本质:SGA突然没有了,实力崩溃
   与断电本质一致的是:
   干掉SMON进程(kill -9 PID)
   shutdown abort

16 在mount阶段,由SMON去读控制文件,并比较:
   1)上次关机的SCN             A
      上次关机的checkpoint      B
   2)日志组最后一条的记录       C
      RBA指针的位置             D
   若正常关机,则 A=B C=D
   若不正常关机,则 A>B  D>C
   这时,就需要派SMON去前滚,按重做日志的记录在内存中重做一遍,直到C=D。

更多Oracle相关信息见Oracle 专题页面 ?tid=12

linux

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
What Are the Limitations of Using Views in MySQL?What Are the Limitations of Using Views in MySQL?May 14, 2025 am 12:10 AM

MySQLviewshavelimitations:1)Theydon'tsupportallSQLoperations,restrictingdatamanipulationthroughviewswithjoinsorsubqueries.2)Theycanimpactperformance,especiallywithcomplexqueriesorlargedatasets.3)Viewsdon'tstoredata,potentiallyleadingtooutdatedinforma

Securing Your MySQL Database: Adding Users and Granting PrivilegesSecuring Your MySQL Database: Adding Users and Granting PrivilegesMay 14, 2025 am 12:09 AM

ProperusermanagementinMySQLiscrucialforenhancingsecurityandensuringefficientdatabaseoperation.1)UseCREATEUSERtoaddusers,specifyingconnectionsourcewith@'localhost'or@'%'.2)GrantspecificprivilegeswithGRANT,usingleastprivilegeprincipletominimizerisks.3)

What Factors Influence the Number of Triggers I Can Use in MySQL?What Factors Influence the Number of Triggers I Can Use in MySQL?May 14, 2025 am 12:08 AM

MySQLdoesn'timposeahardlimitontriggers,butpracticalfactorsdeterminetheireffectiveuse:1)Serverconfigurationimpactstriggermanagement;2)Complextriggersincreasesystemload;3)Largertablesslowtriggerperformance;4)Highconcurrencycancausetriggercontention;5)M

MySQL: Is it safe to store BLOB?MySQL: Is it safe to store BLOB?May 14, 2025 am 12:07 AM

Yes,it'ssafetostoreBLOBdatainMySQL,butconsiderthesefactors:1)StorageSpace:BLOBscanconsumesignificantspace,potentiallyincreasingcostsandslowingperformance.2)Performance:LargerrowsizesduetoBLOBsmayslowdownqueries.3)BackupandRecovery:Theseprocessescanbe

MySQL: Adding a user through a PHP web interfaceMySQL: Adding a user through a PHP web interfaceMay 14, 2025 am 12:04 AM

Adding MySQL users through the PHP web interface can use MySQLi extensions. The steps are as follows: 1. Connect to the MySQL database and use the MySQLi extension. 2. Create a user, use the CREATEUSER statement, and use the PASSWORD() function to encrypt the password. 3. Prevent SQL injection and use the mysqli_real_escape_string() function to process user input. 4. Assign permissions to new users and use the GRANT statement.

MySQL: BLOB and other no-sql storage, what are the differences?MySQL: BLOB and other no-sql storage, what are the differences?May 13, 2025 am 12:14 AM

MySQL'sBLOBissuitableforstoringbinarydatawithinarelationaldatabase,whileNoSQLoptionslikeMongoDB,Redis,andCassandraofferflexible,scalablesolutionsforunstructureddata.BLOBissimplerbutcanslowdownperformancewithlargedata;NoSQLprovidesbetterscalabilityand

MySQL Add User: Syntax, Options, and Security Best PracticesMySQL Add User: Syntax, Options, and Security Best PracticesMay 13, 2025 am 12:12 AM

ToaddauserinMySQL,use:CREATEUSER'username'@'host'IDENTIFIEDBY'password';Here'showtodoitsecurely:1)Choosethehostcarefullytocontrolaccess.2)SetresourcelimitswithoptionslikeMAX_QUERIES_PER_HOUR.3)Usestrong,uniquepasswords.4)EnforceSSL/TLSconnectionswith

MySQL: How to avoid String Data Types common mistakes?MySQL: How to avoid String Data Types common mistakes?May 13, 2025 am 12:09 AM

ToavoidcommonmistakeswithstringdatatypesinMySQL,understandstringtypenuances,choosetherighttype,andmanageencodingandcollationsettingseffectively.1)UseCHARforfixed-lengthstrings,VARCHARforvariable-length,andTEXT/BLOBforlargerdata.2)Setcorrectcharacters

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

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

Hot Article

Hot Tools

SublimeText3 Linux new version

SublimeText3 Linux new version

SublimeText3 Linux latest version

SecLists

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.

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

Powerful PHP integrated development environment

DVWA

DVWA

Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor