UPDATE TABLE_DETAILS SET EXTENTS = (SELECT EXTENTS FROM DBA_SEGMENTS WHERE SEGMENT_NAME IN (SELECT DISTINCT(SEGMENT_NAME) FROM DBA_SEGMNETS WHERE SEGMENT_NAME =NAME ))
I want to populate the table TABLE_DETAILS column extents with the number of extents for DBA segments .Distinct is used as there are more than 1 segment for some tables .
I guess it is because of 'NAME' being a reseved word. This query does not hang :
UPDATE TABLE_DETAILS td SET td.EXTENT = (SELECT EXTENTS FROM DBA_SEGMENTS WHERE
SEGMENT_NAME IN (SELECT DISTINCT(SEGMENT_NAME) FROM DBA_SEGMENTS
WHERE SEGMENT_NAME = td.name));
create table extent_details as
select count(segment_name) seg_count, sum(extents) sum_ext, segment_name
from dba_segments
group by segment_name
order by 2 desc
insert into Table_details (Name ,num_Rows) select DISTINCT(table_name) ,num_rows from dba_tables
Just want to populate extents column from dba_segments for those particular tables
Thanks !!!
UPDATE TABLE_DETAILS td SET td.EXTENTS = (SELECT EXTENTS FROM DBA_SEGMENTS WHERE
SEGMENT_NAME IN (SELECT DISTINCT(SEGMENT_NAME) FROM DBA_SEGMENTS
WHERE SEGMENT_NAME = td.name));
Has been running for > 5 min for 300 rows . don't expect iot to stop . please let me know for a better SQL
Bookmarks