Skip to content
pvmehta.com

pvmehta.com

  • Home
  • About Me
  • Toggle search form
  • How to know Number of CPUs on Sun Box Linux/Unix
  • Privileges Required to Create Procedures and Functions that uses objects from other schema. Oracle
  • Oracle Data Direct to TAPE Oracle
  • Parallel DML Oracle
  • Transfer SQL Profiles from One database to other database. Oracle
  • Establishing trusted relationship between dbmonitor( central monitoring) and monitoring targets. Linux/Unix
  • To see only files and/or folders using LS command Linux/Unix
  • check_copy_progress.sh Linux/Unix
  • Metalink Note: Note:250655.1 : ADDM Basics USING THE AUTOMATIC DATABASE DIAGNOSTIC MONITOR Oracle
  • Identical Dblink Issue… Oracle
  • Complete Git Tutorial for Beginners GIT
  • RMAN : Consistent Backup, Restore and Recovery using RMAN Oracle
  • Temporary tablespace explaination Oracle
  • CTAS with LONG Column for 7.x and 8 and 8i Oracle
  • MYSQL for Oracle DBA MYSQL

Absolute file number and relative file number

Posted on 19-Aug-2005 By Admin No Comments on Absolute file number and relative file number

Interpreting Wait Event “file#” and “block#” parameters

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

This reference note describes how to interpret file# and block# parameters from wait events (eg: obtained from or from the WAIT trace lines in trace files). The text uses:

&AFN to represent the absolute file number (file#)

&BLOCKNO to represent the block number (block#)

IMPORTANT: The details here assume that file# is an absolute file number.

file#

=====

The name of the file can be displayed with the following SQL:

SELECT tablespace_name, file_name

FROM dba_data_files

WHERE file_id = &AFN

;

If the file number does not appear in with this select in Oracle8i / 9i AND file# is greater than the DB_FILES parameter value then the file is probably a TEMPFILE. In this case the filename can be found using:

SELECT tablespace_name, file_name

FROM dba_temp_files f, v$parameter p

WHERE p.name=’db_files’

AND f.file_id+p.value = &AFN

;

block#

======

If the file is NOT a TEMPFILE then the following query should show the name and type of the segment:

SELECT owner , segment_name , segment_type

FROM dba_extents

WHERE file_id = &AFN

AND &BLOCKNO BETWEEN block_id AND block_id + blocks -1

;

In Oracle8 onwards add PARTITION_NAME to the select list above to obtain details of the partition (if any).

If the block# is 1 then this is typically a datafile header and the query above will return no rows.

For INDEX segments it is often desirable to know which table the index is on. Eg:

SELECT table_owner, table_name

FROM dba_indexes

WHERE owner=’&OWNER’

AND index_name=’&SEGMENT_NAME’

;

Absolute File Number

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

In Oracle7 all file# values can be treated as the absolute file number for the queries in this note.

In Oracle8 onwards each datafile has a relative file number and an absolute file number. The relative file number is relative to the tablespace which owns the datafile. The following query will show the absolute and relative file numbers for datafiles in the database:

SELECT tablespace_name, file_id “AFN”, relative_fno “RFN”

FROM dba_data_files;

In Oracle8i onwards a database can also contain TEMPFILES. The following query will show the absolute and relative file numbers for tempfiles in the database:

SELECT tablespace_name, file_id + value “AFN”, relative_fno “RFN”

FROM dba_temp_files, v$parameter

WHERE name=’db_files’;

It is important to use the correct (absolute) file number in the queries in this note.

Oracle, SQL scripts

Post navigation

Previous Post: Important Script Method for tuning
Next Post: True Session Wait Activity in Oracle 10g Verygood

Related Posts

  • pvmehta.com SQL scripts
    Find which sessions is accessing object that prevent your session to have exclusive locks in Oracle Oracle
  • Index Range Scan Oracle
  • ORA-1841 Error Connecting to Upgraded Database After Set PASSWORD_LIFE_TIME Oracle
  • sesswait.sql Oracle
  • V$CONTROLFILE_RECORD_SECTION reference notes. Oracle
  • When to rebuld B-tree index Oracle

Leave a Reply Cancel reply

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

Categories

  • Ansible (0)
  • AWS (2)
  • Azure (1)
  • Django (0)
  • GIT (1)
  • Linux/Unix (149)
  • MYSQL (5)
  • Oracle (393)
  • PHP/MYSQL/Wordpress (10)
  • POSTGRESQL (1)
  • Power-BI (0)
  • Python/PySpark (7)
  • RAC (17)
  • rman-dataguard (26)
  • shell (149)
  • SQL scripts (342)
  • SQL Server (6)
  • Uncategorized (0)
  • Videos (0)

Recent Posts

  • Complete Git Tutorial for Beginners25-Dec-2025
  • Postgres DB user and OS user.25-Dec-2025
  • Trace a SQL session from another session using ORADEBUG30-Sep-2025
  • SQL Server Vs Oracle Architecture difference25-Jul-2025
  • SQL Server: How to see historical transactions25-Jul-2025
  • SQL Server: How to see current transactions or requests25-Jul-2025
  • T-SQL Vs PL/SQL Syntax25-Jul-2025
  • Check SQL Server edition25-Jul-2025
  • Checking SQL Server Version25-Jul-2025
  • Oracle vs MYSQL Architecture differences (For DBAs)24-Jul-2025

Archives

  • 2025
  • 2024
  • 2023
  • 2010
  • 2009
  • 2008
  • 2007
  • 2006
  • 2005
  • longtx.sql Oracle
  • set_env_dba Linux/Unix
  • Rename Oracle Instance Name Oracle
  • fuser to check who is using diretory Linux/Unix
  • replacing ^M character when passing files from Windows to Unix Linux/Unix
  • block_ident.sql Oracle
  • handling filenname with space Linux/Unix
  • fkwoind.sql fkwoindex.sql Oracle

Copyright © 2026 pvmehta.com.

Powered by PressBook News WordPress theme