Skip to content
pvmehta.com

pvmehta.com

  • Home
  • About Me
  • Toggle search form
  • Transfer SQL Profiles from One database to other database. Oracle
  • Wait Based Tuning Step by step with SQL statement Oracle
  • RAC 11g with vmware Oracle
  • This is from Temi Oracle
  • Follwoing korn shell is used to move files from source folder to destination folder and gzip it in destination folder. mv_iotto.ksh Linux/Unix
  • move_arch_files.ksh Linux/Unix
  • Multiple listeners Oracle
  • Oracle Release Explaination Oracle
  • get_vmstat.ksh Linux/Unix
  • DETERMINING WHICH INSTANCE OWNS WHICH SHARED MEMORY & SEMAPHORE SEGMENTS Oracle
  • Removing Ctrl-M from end of line using vi Linux/Unix
  • PHP code to add WordPress posts in bulk programmatically PHP/MYSQL/Wordpress
  • Good links for x$ tables in oracle. Oracle
  • Rman Notes -1 Oracle
  • find_arc.sql 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

  • Identical Dblink Issue… Oracle
  • Very clear article about oracle dataguard Oracle
  • Find_table_size.sql Oracle
  • Free conference number from http://www.freeconference.com Oracle
  • Standby Database Behavior when a Datafile is Resized on the Primary Database Note:123883.1 Oracle
  • find_cons.sql 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 (400)
  • PHP/MYSQL/Wordpress (10)
  • POSTGRESQL (1)
  • Power-BI (0)
  • Python/PySpark (7)
  • RAC (18)
  • rman-dataguard (26)
  • shell (150)
  • SQL scripts (348)
  • SQL Server (6)
  • Uncategorized (3)
  • Videos (0)

Recent Posts

  • Running PDB on single node in RAC09-Apr-2026
  • find_arc.sql09-Apr-2026
  • pvm_pre_change.sql08-Apr-2026
  • find_encr_wallet.sql08-Apr-2026
  • find_pdbs.sql08-Apr-2026
  • Creating a Container Database using dbaascli08-Apr-2026
  • track_autoupgrade_copy_progress.sql01-Apr-2026
  • refre.sql for multitenant01-Apr-2026
  • prepfiles.sh for step by step generating pending statistics files10-Mar-2026
  • tracksqltime.sql05-Mar-2026

Archives

  • 2026
  • 2025
  • 2024
  • 2023
  • 2010
  • 2009
  • 2008
  • 2007
  • 2006
  • 2005
  • import-export with multiple files Oracle
  • How to check current redo log progress redo_progress.sql Oracle
  • online_bkup.sql Oracle
  • First Entry in RAC Oracle
  • Remove DOS CR/LFs (^M) Linux/Unix
  • chk_space_SID.ksh Linux/Unix
  • Physical Standby switchover with session active Oracle
  • Explain Plan Output 2 Oracle

Copyright © 2026 pvmehta.com.

Powered by PressBook News WordPress theme