Skip to Main Content
  • Questions
  • Could not able to drop an empty tablespace. ORA-23515: materialized views and/or their indices exist in the tablespace

Breadcrumb

Question and Answer

Connor McDonald

Thanks for the question, shiva shekar.

Asked: November 05, 2016 - 7:07 am UTC

Last updated: November 09, 2016 - 1:50 am UTC

Version: 11.2.0.4

Viewed 1000+ times

You Asked

Hi Tom,

I have been trying to drop a tablespace, but it is showing the below error. I've checked under dba_segments from any Mviews but I couldn't find anything.

1)
SQL> drop tablespace GOLFX including contents and datafiles;
drop tablespace GOLFX including contents and datafiles
*
ERROR at line 1:
ORA-23515: materialized views and/or their indices exist in the tablespace

2)
I've checked in dba_segments but i couldn't find anything

select count(*) from dba_segments where TABLESPACE_NAME='GOFLX';

COUNT(*)
----------
0

Thank you in advance
Shiva

and Connor said...

From MOS Note 1624253.1

Try these queries as SYSDBA to identify the objects in question

select s.sowner MV_OWNER, s.tname MV_NAME, p.name TABLESPACE
from sys.obj$ o, sys.tab$ t, sys.user$ u, sys.snap$ s , sys.ts$ p
where t.ts#=p.ts# and p.name='GOFLX'
and t.obj#=o.obj# and o.owner#=u.user# and u.name=s.sowner and o.name=s.tname
order by 1,2;

select o.owner, o.object_name index_name, o.object_type, sq.mv_owner,sq.mv_name,sq.tablespace
from dba_objects o,
(select i.obj#,s.sowner MV_OWNER, s.tname MV_NAME, p.name TABLESPACE
from sys.obj$ o, sys.tab$ t, sys.ind$ i, sys.user$ u, sys.snap$ s,sys.ts$ p where i.ts#=p.ts# and p.name='GOFLX'
and i.bo#=t.obj# and t.obj#=o.obj# and o.owner#=u.user# and u.name=s.sowner and o.name=s.tname ) sq
where sq.obj#=o.object_id
order by 1,2,3;

Rating

  (3 ratings)

Is this answer out of date? If it is, please let us know via a Comment

Comments

A reader, November 07, 2016 - 4:39 pm UTC

Hi Tom,

Thank you for the answer. But it is showing no rows selected.

SQL> select s.sowner MV_OWNER, s.tname MV_NAME, p.name TABLESPACE
from sys.obj$ o, sys.tab$ t, sys.user$ u, sys.snap$ s , sys.ts$ p
2 3 where t.ts#=p.ts# and p.name='GOFLX'
4 and t.obj#=o.obj# and o.owner#=u.user# and u.name=s.sowner and o.name=s.tname
5 order by 1,2;

no rows selected

SQL> select o.owner, o.object_name index_name, o.object_type, sq.mv_owner,sq.mv_name,sq.tablespace
2 from dba_objects o,
3 (select i.obj#,s.sowner MV_OWNER, s.tname MV_NAME, p.name TABLESPACE
4 from sys.obj$ o, sys.tab$ t, sys.ind$ i, sys.user$ u, sys.snap$ s,sys.ts$ p where i.ts#=p.ts# and p.name='GOFLX'
5 and i.bo#=t.obj# and t.obj#=o.obj# and o.owner#=u.user# and u.name=s.sowner and o.name=s.tname ) sq
6 where sq.obj#=o.object_id
7 order by 1,2,3;

no rows selected

Thank You
Shiva

A reader, November 07, 2016 - 10:05 pm UTC

Maybe try emptying the recyclebin?

GOLFX vs GOFLX

Mikhail Velikikh, November 08, 2016 - 1:32 am UTC

Hi Siva,

You tried to drop tablespace GOLFX, but then you executed the query against DBA_SEGMENTS using GOFLX tablespace. You also executed Connor's query passing the same GOFLX but not GOLFX, which you tried to drop.
Perhaps you made a typo.
Please substitute the correct tablespace in Connor's query and let us know how it works.
Connor McDonald
November 09, 2016 - 1:50 am UTC

Nice catch spotting the typo !