Skip to content
pvmehta.com

pvmehta.com

  • Home
  • About Me
  • Toggle search form
  • oracle 10g on linux Linux/Unix
  • 284785.1 How to check RAC Option is currently linked into the Oracle Binary Oracle
  • Passing from Unix to PLSQL using bind variables Linux/Unix
  • 272332.1 CRS 10g Diagnostic Collection Guide Oracle
  • to see when crontab is changed. Linux/Unix
  • move_arch_files.ksh Linux/Unix
  • Nice notes on wait events Oracle
  • Mutating Table Error while using database trigger Oracle
  • This is from Temi Oracle
  • Display the top 5 salaries for each department using single SQL Oracle
  • How to find where datafile is created dbf_info.sql Oracle
  • v$event_name Oracle
  • alter database backup controlfile to trace Oracle
  • find_string_in_database.sql Oracle
  • fuser to check who is using diretory Linux/Unix

How to Decide upto what level you can decrement your datafile size. ( Shrink Datafile)

Posted on 12-Jun-2006 By Admin No Comments on How to Decide upto what level you can decrement your datafile size. ( Shrink Datafile)

We can directly resize datafiles

TEST.SQL>SELECT FILE_NAME, BYTES FROM DBA_DATA_FILES WHERE TABLESPACE_NAME=’SYSTEM’;

FILE_NAME BYTES

—————- ———-

/…/dbsGNX.dbf 419430400

TEST.SQL>ALTER DATABASE DATAFILE ‘/…/dbsGNX.dbf’ RESIZE 390M;

Database altered.

TEST.SQL>SELECT FILE_NAME, BYTES FROM DBA_DATA_FILES WHERE TABLESPACE_NAME=’SYSTEM’;

FILE_NAME BYTES

————— ———-

/…/dbsGNX.dbf 408944640

But the minimum file size is the size of the extend the furthest in the datafile:

TEST.SQL>SELECT FILE_ID,FILE_NAME FROM DBA_DATA_FILES WHERE TABLESPACE_NAME=’SYSTEM’;

FILE_ID FILE_NAME

———- —————–

1 /…/dbsGNX.dbf

TEST.SQL>SELECT MAX(BLOCK_ID) MBID FROM DBA_EXTENTS WHERE FILE_ID=1;

MBID

———-

25129

TEST.SQL>SELECT SEGMENT_NAME,OWNER,SEGMENT_TYPE FROM DBA_EXTENTS WHERE FILE_ID=1 AND BLOCK_ID=25129;

SEGMENT_NAME OWNER SEGMENT_TYPE

——————– —————————— ——————

I_OBJAUTH2 SYS INDEX

TEST.SQL>SHOW PARAMETER BLOCK_SIZE

NAME TYPE VALUE

———————————— ——————————– ——————————

db_block_size integer 8192

TEST.SQL>SELECT 8192*25129 FROM DUAL;

8192*25129

———-

205856768

about 200M.

We can directly resize datafiles

TEST.SQL>SELECT FILE_NAME, BYTES FROM DBA_DATA_FILES WHERE TABLESPACE_NAME=’SYSTEM’;

FILE_NAME BYTES

—————– ———-

/…/dbsGNX.dbf 419430400

TEST.SQL>ALTER DATABASE DATAFILE ‘/…/dbsGNX.dbf’ RESIZE 390M;

Database altered.

TEST.SQL>SELECT FILE_NAME, BYTES FROM DBA_DATA_FILES WHERE TABLESPACE_NAME=’SYSTEM’;

FILE_NAME BYTES

—————- ———-

/…/dbsGNX.dbf 408944640

But the minimum file size is the size of the extend the furthest in the datafile:

TEST.SQL>SELECT FILE_ID,FILE_NAME FROM DBA_DATA_FILES WHERE TABLESPACE_NAME=’SYSTEM’;

FILE_ID FILE_NAME

———- ————————-

1 /…/dbsGNX.dbf

TEST.SQL>SELECT MAX(BLOCK_ID) MBID FROM DBA_EXTENTS WHERE FILE_ID=1;

MBID

———-

25129

TEST.SQL>SELECT SEGMENT_NAME,OWNER,SEGMENT_TYPE FROM DBA_EXTENTS WHERE FILE_ID=1 AND BLOCK_ID=25129;

SEGMENT_NAME OWNER SEGMENT_TYPE

——————— —————————— ——————

I_OBJAUTH2 SYS INDEX

TEST.SQL>SHOW PARAMETER BLOCK_SIZE

NAME TYPE VALUE

———————————— ——————————– ——————————

db_block_size integer 8192

TEST.SQL>SELECT 8192*25129 FROM DUAL;

8192*25129

———-

205856768

About 200M.

Reference : http://forums.oracle.com/forums/message.jspa?messageID=1058350

Oracle, SQL scripts

Post navigation

Previous Post: How to find the real execution plan and binds used in that explain plan in Oracle 10g??
Next Post: How to find Unix server conguraiton including Server Model number and underlying disk sub-system ( On Solaris)

Related Posts

  • TRUNCATE Privs Oracle
  • DBMS_UTILITY PACKAGE Oracle
  • Proc Compilation Oracle
  • Exadata Basics Oracle
  • Optimizer SORT Operations Oracle
  • Renaming Oracle Instance Name 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
  • Create type and Grant on it. Oracle
  • Oracle 10g Wait Model Oracle
  • Order by with ROWNUM Oracle
  • Jai Shree Ram PHP/MYSQL/Wordpress
  • Good links for x$ tables in oracle. Oracle
  • fkwoind.sql fkwoindex.sql Oracle
  • Vivek’s egrep commands to trace problem. (on linux x86-64) Linux/Unix
  • Good Link from metalink 1 Oracle

Copyright © 2026 pvmehta.com.

Powered by PressBook News WordPress theme