Skip to content
pvmehta.com

pvmehta.com

  • Home
  • About Me
  • Toggle search form
  • create database link syntax Oracle
  • switchover for primary database Oracle
  • Goldengate Tutorial Oracle
  • How to know current SID Oracle
  • On solaris 10, “S” link is not part of $ORACLE_HOME/bin/oracle as default. ( For 9.2.0.8) Oracle
  • TNSNAMES entries details Oracle
  • Privileges Required to Create Procedures and Functions that uses objects from other schema. Oracle
  • Important Script Method for tuning Oracle
  • Create type and Grant on it. Oracle
  • standard Monitoring – 1 Oracle
  • temp_use.sql diplays usage of temp ts Oracle
  • How to see which patches are applied. Oracle
  • Drop specific SQL plan baseline – spm Oracle
  • Move WordPress site from one hosting service to other. PHP/MYSQL/Wordpress
  • Remove duplicate rows from table 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

  • When to rebuld B-tree index Oracle
  • Resolving RMAN Hung Jobs Oracle
  • Check Oracle installed products using one command Oracle
  • pvmehta.com SQL scripts
    Find which sessions is accessing object that prevent your session to have exclusive locks in Oracle Oracle
  • How to Make Trace Files Created by Oracle Readable by All Users ? Oracle
  • DBMS_UTILITY.ANALYZE_SCHEMA Oracle

Leave a Reply Cancel reply

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

Categories

  • Ansible (0)
  • AWS (2)
  • Azure (1)
  • Linux/Unix (149)
  • MYSQL (5)
  • Oracle (393)
  • PHP/MYSQL/Wordpress (10)
  • POSTGRESQL (0)
  • 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

  • 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
  • V$INSTANCE of Oracle in MYSQL24-Jul-2025
  • Day to day MYSQL DBA operations (Compared with Oracle DBA)24-Jul-2025

Archives

  • 2025
  • 2024
  • 2023
  • 2010
  • 2009
  • 2008
  • 2007
  • 2006
  • 2005
  • find_err.sql for finding errors from dba_errors. Oracle
  • Monitor and Trace Unix processes using truss Linux/Unix
  • 272332.1 CRS 10g Diagnostic Collection Guide Oracle
  • refre.sql Oracle
  • DBMS_JOB all example Oracle
  • note id 373303.1 Linux/Unix
  • Creating never expiring DB user accounts in Oracle Oracle
  • column level grant syntax Oracle

Copyright © 2025 pvmehta.com.

Powered by PressBook News WordPress theme