Solved

script for checking empty block by segment

Posted on 2011-02-16
3
640 Views
Last Modified: 2012-05-11
Hello,

I search a script for checking empty block by segment.

Thanks

Regards

bibi
0
Comment
Question by:bibi92
3 Comments
 
LVL 76

Accepted Solution

by:
slightwv (䄆 Netminder) earned 500 total points
ID: 34912380
0
 
LVL 5

Expert Comment

by:manzoor_dba
ID: 34913206
Hi,

Hope the below example will help..

SQL> analyze table emp compute statistics;

Table analyzed.

SQL> select blocks user_Tables where table_name = 'EMP';

    BLOCKS
     ---------
     26111  

It is showing that currently 26111 blocks has been used by this table, but there may be lots of empty blocks in it ( due to DML Operation) , so we can query the below to find out exactly how many used blocks are there in this table.

SQL> select count( distinct dbms_rowid.ROWID_BLOCK_NUMBER(rowid))  "Actual Blocks" from emp;

ACTUAL BLOCKS
-----------------------
                    20363

it shows that 20363 blocks contains data which means   26111 - 20363 = 5748 , there are totally 5748 empty blocks are there in the emp table.

Thanks...
0
 

Author Closing Comment

by:bibi92
ID: 34914200
Thanks bibi
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Oracle SQL Query Syntax 6 85
Cross Outer Join 4 52
Oracle RMAN Database Restore 5 32
Oracle 12c patching 1 33
How to Create User-Defined Aggregates in Oracle Before we begin creating these things, what are user-defined aggregates?  They are a feature introduced in Oracle 9i that allows a developer to create his or her own functions like "SUM", "AVG", and…
This post first appeared at Oracleinaction  (http://oracleinaction.com/undo-and-redo-in-oracle/)by Anju Garg (Myself). I  will demonstrate that undo for DML’s is stored both in undo tablespace and online redo logs. Then, we will analyze the reaso…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Via a live example, show how to take different types of Oracle backups using RMAN.

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now