Skip to content
pvmehta.com

pvmehta.com

  • Home
  • About Me
  • Toggle search form
  • remove archfiles only when it is applied to DR rm_archfiles.sh Linux/Unix
  • Facts about SCN and Rollback Segment Oracle
  • Rename Tablespace Oracle
  • Removing Ctrl-M from end of line using vi Linux/Unix
  • How does one overcome the Unix 2 Gig file limit? Linux/Unix
  • DBMS_Shared_pool pinning triggers Oracle
  • tblwopk.sql /* Find Tables Without PK */ Oracle
  • create PLAN_TABLE command. Oracle
  • All Hints for Oracle Databases Oracle
  • Creating never expiring DB user accounts in Oracle Oracle
  • True Session Wait Activity in Oracle 10g Verygood Oracle
  • catting.sh Linux/Unix
  • sid_wise_cursor.sql find open cursor basis on username or SID Oracle
  • How to choose Driver table in SQL statement Oracle
  • How does one SELECT a value from a table into a Unix variable? From SQL to Shell Linux/Unix

TABLE SIZING WITH DB_BLOCK ARCHITECTURE Reference : Metalink note : 10640.1

Posted on 14-Oct-2005 By Admin No Comments on TABLE SIZING WITH DB_BLOCK ARCHITECTURE Reference : Metalink note : 10640.1

===================================================================

STEP-I First, calculate the total block header size:

===================================================================

block header = fixed header + variable transaction header + table directory + row directory

where:

fixed header = 57 bytes (the 4 bytes at the end of the block have already been taken account of in the 24 bytes for the cache header)

variable transaction header = 23 * i where i is the value of INITRANS for the table, or can grow dynamically up to MAXTRANS.

table directory = 4 * n where n is the number of tables. n = 1 for non-clustered tables.

row directory = 2 * x where x is the number of rows in the block.

Using the above formula, the initial block header size for a non-clustered table with INITRANS = 1 is:

block header = 57 + 23 + 4 + 2x = (84 + 2x) bytes

The space reserved for data within the block, as specified by PCTFREE, is calculated as a percentage of the block size minus the block header.

available data space = (block size – total block header) – ((block size – total block header) * (PCTFREE/100))

For example, with PCTFREE = 10 and a block size of 2048, the total space for new data in a block is:

available data space = (2048 – (84 + 2x)) – ((2048 – (84 + 2x)) *(10/100))

= (1964 – 2x) – ((2048 – 84 – 2x) * (10/100))

= (1964 – 2x) – (1964 – 2x) * 0.1

= (1964 – 2x – 196 + 0.2x) bytes

= (1768 – 1.8x) bytes

==================================================================================

Step II Now, calculate the combined data space required for an average row.

==================================================================================

Calculating this depends on the following:

1. The number of columns in the table definition.

2. The datatypes used for each column.

3. The average value size for variable length columns.

A test database similar to the production database will be helpful here. To calculate the combined data space for an average row in a table, use the following query:

SELECT AVG(NVL(VSIZE(col1), 1)) +

AVG(NVL(VSIZE(col2), 1)) +

… +

AVG(NVL(VSIZE(coln), 1)) “SPACE OF AVERAGE ROW”

FROM table_name;

col1, col2, … , coln are the column names of the table and table_name is the table being evaluated.

Oracle, SQL scripts

Post navigation

Previous Post: FGA Part-I
Next Post: My Test Case On 21-OCT-2005

Related Posts

  • Find nth max and min. Oracle
  • Very Good Oralce Internal Tuning Book Oracle
  • find_longsql.sql Oracle
  • metalink all dynamic view reference notes. Oracle
  • Building Our Own Namespaces with “Create Context” Oracle
  • Jai Shree Ram Oracle

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Categories

  • AWS (2)
  • Azure (1)
  • Linux/Unix (149)
  • Oracle (388)
  • PHP/MYSQL/Wordpress (10)
  • Power-BI (0)
  • Python/PySpark (7)
  • RAC (17)
  • rman-dataguard (26)
  • shell (149)
  • SQL scripts (337)
  • Uncategorized (0)
  • Videos (0)

Recent Posts

  • findinfo.sql (SQL for getting CPU and Active session info)27-May-2025
  • SQL Tracker by SID sqltrackerbysid.sql22-Apr-2025
  • How to connect to Oracle Database with Wallet with Python.21-Mar-2025
  • JSON/XML Types in Oracle18-Mar-2025
  • CPU Core related projections12-Mar-2025
  • Exadata Basics10-Dec-2024
  • Reading config file from other folder inside class24-Sep-2024
  • Python class import from different folders22-Sep-2024
  • Transfer SQL Profiles from One database to other database.05-Sep-2024
  • Load testing on Oracle 19C RAC with HammerDB18-Jan-2024

Archives

  • 2025
  • 2024
  • 2023
  • 2010
  • 2009
  • 2008
  • 2007
  • 2006
  • 2005
  • how to find OS block size Oracle
  • Validating ORACLE_SID againt oratab file. Linux/Unix
  • age_alert.ksh aging out alert.log Linux/Unix
  • how to find VIP from ifconfig Linux/Unix
  • find_log_switch.sql Find log switches in graphical manner Oracle
  • xargs use Linux/Unix
  • Composite Index creation tip from Vivek Oracle
  • refre.sql Oracle

Copyright © 2025 pvmehta.com.

Powered by PressBook News WordPress theme