Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

The size of the data file OS block

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

In the previous BLOG, I talked about how to calculate the size of the data file, ls-l / 8192-1. In fact, the 8192 here is not correct, but in a general case, this is the official document given by MOS about the size of the OS block under each platform.

Welcome to join the ORACLE Super Group: 17115662 solve all kinds of ORACLE problems free of charge. BLOG will migrate to http://www.htz.pw in the future.

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

Modification time: 2011-2-15

Type: HOWTO

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 + (308192) = 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 = 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

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report