Skip to content
pvmehta.com

pvmehta.com

  • Home
  • About Me
  • Toggle search form
  • Adding or Dropping Online Redo Log Files When Physical Standby in place Oracle
  • good note for shared pool tunnig Oracle
  • Jai Shree Ram PHP/MYSQL/Wordpress
  • OEM-troubleshooting on 20-MAY-08 Oracle
  • Distributed Transaction Troubleshooting. Oracle
  • handling filenname with space Linux/Unix
  • Some useful Unix Commands Linux/Unix
  • Good Site for Oracle Internals Oracle
  • Oracle GoldenGate lag monitoring shell script Linux/Unix
  • Goldengate Tutorial Oracle
  • MYSQL and Oracle Comparison for Oracle DBA MYSQL
  • Committing distributed transaction using commit force Oracle
  • Facts about SCN and Rollback Segment Oracle
  • S3 Basic info AWS
  • Another Tuning Article for subheap of shared pool Oracle

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

  • myfile Oracle
  • Goldengate document from Porus Oracle
  • compile_inv.sql Oracle
  • Committing distributed transaction using commit force Oracle
  • Oracle Recommended Patches — Oracle Database ID 756671.1 Oracle
  • Rman Notes -1 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
  • Adding a new disk and mount it automatically. on VMWARE LINUX Linux/Unix
  • How to collect CPU usage on Linux using Shell script Linux/Unix
  • Oracle 10g for solaris 10 Oracle
  • fkwoind.sql fkwoindex.sql Oracle
  • Day to day MYSQL DBA operations (Compared with Oracle DBA) MYSQL
  • DBA_HIST_SQLSTAT contents Oracle
  • oracle tips… from http://www.bijoos.com/oracle/douknow.htm Oracle
  • Oracle Release Explaination Oracle

Copyright © 2026 pvmehta.com.

Powered by PressBook News WordPress theme