数据文件OS块的大小

简介:

在前一个BLOG里面说到了怎么计算数据文件的大小,ls –l /8192-1,其实这里的8192是不正确的,只是通用情况下是这样的,下面是MOS给的官方文档,关于每种平台下面的OS块的大小

欢迎大家加入ORACLE超级群:17115662 免费解决各种ORACLE问题,以后BLOG将迁移到http://www.htz.pw

How an Oracle block# is mapped to a file offset (in bytes or OS blocks) (文档 ID 761734.1)

 

修改时间:2011-2-15

clip_image001

类型:HOWTO

clip_image001

In this Document

  Goal

  Solution

     Generic Platform Formula:

     Alternate Platform Specific Formula (i.e. AIX and HP Tru64):

 

APPLIES TO:

Oracle Server - Enterprise Edition - Version: 10.2.0.1 to 11.1.0.8 - Release: 10.2 to 11.1

Oracle Server - Enterprise Edition - Version: 10.2.0.1 to 11.1.0.8   [Release: 10.2 to 11.1]

Information in this document applies to any platform.

 

GOAL

 

This document is about how an Oracle block number is mapped to a file offset (in bytes or OS blocks) for Generic OS platforms and includes an alternate formula for specific OS platforms like AIX and HP Tru64. These are the only 2 platforms where the Volume Manager reserves space for Metadata in the Oracle datafile.

 

For Oracle 10g and 10gR2 there are only two platforms with logical volume Metadata on raw devices: AIX and HP Tru64.

 

HP Tru64 is no longer supported on Oracle 11g, so AIX is the only one in 11g.

 

SOLUTION

 

Every Oracle file has an Operating System file header block ("BLOCK 0") created and maintained by Oracle, which is the size of a standard Oracle block. If multiple block sizes are being used then V$DATAFILE.BLOCK_SIZE should be queried for the file# in question. 

 

"BLOCK 0" can be know as the "Oracle OS Header Block" or "Database Block# 0".

 

"BLOCK 1" is the Oracle Header Block that contains generic information for the File.

 

From the documentation: V$DATAFILE.BLOCK1_OFFSET is the "Offset from the beginning of the file to where the Oracle generic information begins.". 

 

"BLOCK 1" offset = v$datafile.block1_offset

 

V$DATAFILE.BLOCK1_OFFSET do not make much sense for ASM. The value displayed is UB4MAXVAL (4-byte unsiged int max) for ASM when it cannot be computed. 

Generic Platform Formula:

A general formula to locate the byte offset in any platform is:

 

block1_offset = v$datafile.block1_offset

oracle_block_size = v$datafile.block_size

 

offset = block1_offset + (oracle_block_number  - 1) * oracle_block_size

Another way to calculate this offset is using the platform specific information:

 

Alternate Platform Specific Formula (i.e. AIX and HP Tru64):

 

Platform specific formula for a file offset to locate an Oracle block in a RAW Device:

 

 

offset = raw_device_block0_offset + (oracle_block_number * oracle_block_size)

AIX:

On AIX raw device, the logical volume metadata uses 4096 bytes. That would be the block0_offset on this platform. On HP Tru64 it is 65536 bytes. 

 

raw_device_block0_offset = 4096

file_system_block0_offset = 0

 

Example:

 

Calculate the byte offset using the platform specific formula for block 30 in a RAW Device in AIX

 

oracle_block_size = 8192 (v$datafile.block_size)

oracle_block_number = 30

AIX raw_device_block0_offset = 4096

 

offset = 4096 + (30*8192) = 249856

 

Notes:

 

The above formulas are given in bytes.

file_system_block#_offset refers to any file systems like veritas, zfs, etc.

raw_device_block0_offset is the byte offset to locate the Oracle "BLOCK 0" in a raw device.

file_system_block0_offset is the byte offset to locate the Oracle "BLOCK 0" in a file system.

 

Formula To produce an offset in 4096 blocks in a RAW device in AIX:

 

 

offset <in 4096 blocks> = 1 + (oracle_block_number*(oracle_file_block_size/4096))

 

HP Tru64:

 

For HP Tru64 use:

 

raw_device_block0_offset = 65536

file_system_block0_offset = 0




     本文转自7343696 51CTO博客,原文链接:http://blog.51cto.com/luoping/1425166,如需转载请自行联系原作者



相关文章
|
1月前
|
存储 Java iOS开发
MacOS环境-手写操作系统-43-dir命令的实现 和 文件写入
MacOS环境-手写操作系统-43-dir命令的实现 和 文件写入
29 0
|
5月前
|
缓存 Linux Windows
初识Linux操作系统(根目录下的重要文件)(命令提示符的含义)
Linux系统基于&quot;一切皆文件&quot;的理念,重要文件分布在如/root(root用户目录)、/home(普通用户目录)、/etc(应用配置)、/dev(设备文件)、/boot(内核及启动文件)、/proc(动态系统信息)、/lib64(库文件)、/opt(软件存放)、/tmp(临时文件)。&quot;[root@localhost ~]#&quot;代表管理员在root目录,&quot;$&quot;代表普通用户。创建新用户用`useradd`命令。调节终端字体大小:Ctrl+Shift++增大,Ctrl+减号缩小。绝对路径从根目录开始,相对路径从当前目录开始。
|
5月前
|
Unix 关系型数据库 API
Python OS 文件/目录方法
Python OS 文件/目录方法
|
5月前
|
Java 开发工具 Android开发
详细解读Android开发DNK开发将.c文件打包成os
详细解读Android开发DNK开发将.c文件打包成os
31 0
|
5月前
|
消息中间件 Java Kafka
实时计算 Flink版操作报错合集之RocksDB在尝试打开更多文件时达到了操作系统允许的最大打开文件数限制,该怎么办
在使用实时计算Flink版过程中,可能会遇到各种错误,了解这些错误的原因及解决方法对于高效排错至关重要。针对具体问题,查看Flink的日志是关键,它们通常会提供更详细的错误信息和堆栈跟踪,有助于定位问题。此外,Flink社区文档和官方论坛也是寻求帮助的好去处。以下是一些常见的操作报错及其可能的原因与解决策略。
116 0
|
6月前
|
Ubuntu Linux iOS开发
LabVIEW在不同操作系统上使VI、可执行文件或安装程序
LabVIEW在不同操作系统上使VI、可执行文件或安装程序
216 3
|
6月前
|
Python
在Python中,利用`os模块`的`path.exists()`函数可判断文件是否存
【5月更文挑战第12天】在Python中,利用`os模块`的`path.exists()`函数可判断文件是否存在,该函数对路径进行检查,存在则返回True,不存在则返回False。示例代码展示了如何检查'example.txt'文件是否存在并相应打印消息。此外,`os.path.isfile()`用于确认路径是否为文件,仅当是文件时返回True,否则返回False,同样配以示例说明其用法。
224 2
|
6月前
|
Linux Shell
Linux操作系统下查找大文件或目录的技巧
Linux操作系统下查找大文件或目录的技巧
47 2
|
6月前
|
Go API 开发者
Golang深入浅出之-文件与目录操作:os与path/filepath包
【4月更文挑战第26天】Go语言标准库`os`和`path/filepath`提供文件读写、目录操作等功能。本文涵盖`os.Open`, `os.Create`, `os.Mkdir`, `filepath.Join`等API的使用,强调了文件关闭、路径处理、并发写入和权限问题的处理,并给出实战代码示例,帮助开发者高效、安全地操作文件与目录。注意使用`defer`关闭文件,`filepath`处理路径分隔符,以及通过同步机制解决并发写入冲突。
305 2
|
6月前
|
Python
Python OS 文件/目录方法
Python OS 文件/目录方法
下一篇
无影云桌面