Skip to main content

ORA-23515: Materialized Views and/or Their Indices Exist in the Tablespace

 

ORA-23515: Materialized Views and/or Their Indices Exist in the Tablespace


While dropping any Tablespace, you might get the errror 

ORA-23515: Materialized Views and/or Their Indices Exist in the Tablespace

This is due to the fact that the tablespace contains the indexes or Materialized views

You may use the following queries to find out which materialized views and/or which indeces of materialized view container tables are on the tablespace you intend to drop.

Once these objects are found you can move the tables, rebuild indeces in other tablespace.

 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='<tablespace_name>'
  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='<tablespace_name>'
  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;

 

An example output listing mviews and their owner where the container table of the mview is on the tablespace <tablespace_name>
 

SQL>  select s.sowner MV_OWNER, s.tname MV_NAME, p.name TABLESPACE
  2    from sys.obj$ o, sys.tab$ t, sys.user$ u, sys.snap$ s , sys.ts$ p
  3    where t.ts#=p.ts# and p.name='<tablespace_name>'
  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;

MV_OWNER                       MV_NAME                        TABLESPACE
------------------------------ ------------------------------ ------------------------------
<user_name>                    TEST_MV                        <tablespace_name>
<user_name>                    CUST_MV                        <tablespace_name>

An example output listing indeces of mviews container tables, where the index is on tablespace <tablespace_name>

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='<tablespace_name>'
  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;

OWNER      INDEX_NAME                     OBJECT_TYPE         MV_OWNER                       MV_NAME                         TABLESPACE
---------- ------------------------------ ------------------- ------------------------------ ------------------------------ ------------------------------
<user_name>  I_SNAP$_TEST_MV                INDEX              <user_name>                             TEST_MV                        <tablespace_name>
<user_name>  I_SNAP$_CUST_MV                INDEX              <user_name>                             CUST_MV                        <tablespace_name>

YOU MAY DELETE THE OBJECTS or MOVE Them to other tablespaces and then try the delete Tablespace command

Comments

Popular posts from this blog

Warning Message When Creating A Keystore

  Warning Message When Creating A Keystore When we try to list the contents of the keystore, using the below command, keytool -list -v -keystore adkeystore.dat Enter keystore password: Keystore type: JKS Keystore provider: SUN Your keystore contains 1 entry Alias name: prod_apps002 Creation date: Jan 26, 2012 Entry type: PrivateKeyEntry Certificate chain length: 1 Certificate[1]: Owner: CN=PROD_apps002, OU=apps, O=apps002, C=US Issuer: CN=PROD_apps002, OU=apps, O=apps002, C=US Serial number: 4f208085 Valid from: Thu Jan 26 01:21:57 AST 2012 until: Tue Jan 16 01:21:57 AST 2052 Certificate fingerprints:          MD5:  XX: XX XX XX          SHA1:  XX: XX XX XX          SHA256:  XX: XX XX XX Signature algorithm name: SHA1withDSA Subject Public Key Algorithm: 1024-bit DSA key Version: 3 ******************************************* ******************************************* Warning: The JKS keystore...

CLEARING an ADOP patching session

In some case adop prepare phase fails due to some issues and if you wish to apply any patch in hotpatch mode, it will fail with below errors [STATEMENT] There is already a session which is incomplete. Details are: [STATEMENT]     Session Id: 2 [STATEMENT]     Prepare phase status: R [STATEMENT]     Apply phase status: N [STATEMENT]     Cutover  phase status: N [STATEMENT]     Abort phase status: N [STATEMENT]     Session status: F [ERROR]     Cannot apply hotpatch as another online patching cycle is going on [ERROR]     Unrecoverable error occured. Exiting the current session. [STATEMENT] [START 2019/10/22 16:13:00] Unlocking sessions table [STATEMENT] [END   2019/10/22 16:13:00] Unlocking sessions table [STATEMENT] Log file: /adop_20191022_161221.log [STATEMENT] [START 2019/10/22 16:13:02] Unlocking sessions table [STATEMENT] [E...

How to Install XClock on Linux

 How to Install XClock on Linux Enable snaps on Red Hat Enterprise Linux and install xclock-simosx Snaps are applications packaged with all their dependencies to run on all popular Linux distributions from a single build. They update automatically and roll back gracefully. Snaps are discoverable and installable from the  Snap Store , an app store with an audience of millions. Follow the below link for the detailed steps https://snapcraft.io/install/xclock-simosx/rhel