Oracle 体系结构之存储结构详解(逻辑 + 物理)

1 概述

在这里插入图片描述
说明:

1. 逻辑结构
   (1) 对应关系:'一对多'
   (2) 大小关系: 表空间 TableSpace > 
                段 Segment > 区 Extent > 数据块 Block
   
2. 物理结构
   (1) '数据文件': '系统和用户数据',默认以 'DBF' 为扩展名
   (2) '日志文件': '操作记录',默认以 'LOG' 为扩展名
   (3) '控制文件': '控制信息',默认以 'CTL' 为扩展名

扩展:Oracle 体系结构详解(存储结构 + 内存结构 + 进程结构)
理解:类似公司架构(董事长 - 部门经理 - 小员工)

2 逻辑存储结构

2.1 表空间 tablespace

表空间分类名称描述
系统表空间system数据字典 + 程序单元(包、存储过程、函数、触发器)
辅助表空间sysaux除上以外的数据字典,用以辅助系统表空间
撤销表空间undodml 操作时的 旧数据 写入 undo 段
用户表空间users默认
临时表空间temp分组、排序、聚合等(操作完成后,自动释放)
-- 查询表空间,权限由大至小
select * from dba_tablespaces;
select * from user_tablespaces;

2.2 段 segment

段类型名称描述
table段名 = 表名
表分区table partition段名 = 表名 and 分区名不为空
表子分区table subpartition段名 = 表名 and 分区名不为空且不同
索引index段名 = 索引名
索引分区index partition段名 = 索引名 and 分区名不为空
索引子分区index subpartition段名 = 索引名 and 分区名不为空且不同
聚簇cluster
lob 段lobsegment每个 lob 字段都会对应一个 lob 段,可分区
lob 分区lob partition
lob 子分区lob subpartition
lob 索引lobindex
回滚段rollback8i及以前,名称 system
撤销段type2 undo9i及以后
嵌套表nested table
-- 查询段,权限由大至小
select t.segment_name, t.* from dba_segments t;
select t.segment_name, t.* from user_segments t;

-- 查找 表
select t.table_name, t.* from dba_tab_comments t;
select t.table_name, t.* from all_tab_comments t;
select t.table_name, t.* from user_tab_comments t;

-- 查找 lob 字段
select * from dba_lobs;
select * from dba_lob_partitions;
select * from dba_lob_subpartitions;

2.3 区 extend

-- 查询 区 extend
-- 段空间使用完后,自动为该段分配一个新的 区(扩展)
select * from dba_extents;
select * from user_extents;

2.4 数据块 block

在这里插入图片描述

1. 数据块 和 操作系统块
   (1) 数据块   : '最小的逻辑单元'
   (2) 操作系统块: 读取或写入磁盘的最小单元('I/O'(3) 数据快 和 操作系统快分离的意义:'屏蔽了不同操作系统的差异'
       -- 也就是说,数据库在 Windows 或 Linux 等一样使用
   
2. 数据块的大小
   (1) 数据库创建时设置,之后无法更改,除非重新创建数据库。
   (2) 一般默认大小 '8kb'
       show parameters db_block_size -- (8192/1024 = 8 kb)

3. 行数据格式(Row Data(1) 可通过伪列 rowid 查看,共计 18select rowid, -- 18 位
		      -- 数据对象id(前 6 位)
			  dbms_rowid.rowid_object(rowid) object_id, 
		      -- 相对文件id(3 位)
		      dbms_rowid.rowid_relative_fno(rowid) relative_fno, 
		      -- 数据块id(6 位)
		      dbms_rowid.rowid_block_number(rowid) block_number, 
		      -- 行id(后 3 位)
		      dbms_rowid.rowid_row_number(rowid) row_number
	     from scott.emp;

3 物理存储结构

1. 各文件对应视图查询
   (1) '数据文件': select * from v$datafile;
   (2) '日志文件': select * from v$logfile;
   (3) '控制文件': select * from v$controlfile;

2. 其它文件
   (1) 口令文件 Passwrod File:用于存放特权用户及口令文件,如:sys
   (2) 跟踪文件 Trace File   :用于存放后台进程和服务器进程的跟踪信息
   (3) 警告文件 Alert File   :存放错误信息

默认安装目录:
在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

鱼丸丶粗面

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值