Skip to content

Instantly share code, notes, and snippets.

@dincosman
Last active March 6, 2022 19:27
Show Gist options
  • Select an option

  • Save dincosman/68ad1effeee8c86acffeecee86474af6 to your computer and use it in GitHub Desktop.

Select an option

Save dincosman/68ad1effeee8c86acffeecee86474af6 to your computer and use it in GitHub Desktop.
The query to detect and drop, not needed mdrt_ tables.
SQL> SELECT 'DROP TABLE ' || T.OWNER || '.' || '"' || T.TABLE_NAME || '" PURGE;'
AS DROP_ORPHANED_MDRTS_COMMAND
FROM DBA_TABLES T
WHERE T.TABLE_NAME LIKE 'MDRT%'
AND T.TABLE_NAME NOT IN (SELECT SM.SDO_INDEX_TABLE
FROM ALL_SDO_INDEX_METADATA SM);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment