文章详情

短信预约-IT技能 免费直播动态提醒

请输入下面的图形验证码

提交验证

短信预约提醒成功

数据文件OS块的大小

2024-04-02 19:55

关注

在前一个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

数据文件OS块的大小

类型:HOWTO

数据文件OS块的大小

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

免责声明:

① 本站未注明“稿件来源”的信息均来自网络整理。其文字、图片和音视频稿件的所属权归原作者所有。本站收集整理出于非商业性的教育和科研之目的,并不意味着本站赞同其观点或证实其内容的真实性。仅作为临时的测试数据,供内部测试之用。本站并未授权任何人以任何方式主动获取本站任何信息。

② 本站未注明“稿件来源”的临时测试数据将在测试完成后最终做删除处理。有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341

软考中级精品资料免费领

  • 历年真题答案解析
  • 备考技巧名师总结
  • 高频考点精准押题
  • 资料下载
  • 历年真题
  • 2024年上半年信息系统项目管理师第二批次真题及答案解析(完整版)

    难度     813人已做
    查看
  • 【考后总结】2024年5月26日信息系统项目管理师第2批次考情分析

    难度     354人已做
    查看
  • 【考后总结】2024年5月25日信息系统项目管理师第1批次考情分析

    难度     318人已做
    查看
  • 2024年上半年软考高项第一、二批次真题考点汇总(完整版)

    难度     435人已做
    查看
  • 2024年上半年系统架构设计师考试综合知识真题

    难度     224人已做
    查看

相关文章

发现更多好内容
咦!没有更多了?去看看其它编程学习网 内容吧