Reputation:
I create one user name as MD. Unfortunately I copy the database from SYS to user MD using SQL developer. SO that lots of Tables, Indexes, Sequences, Objects and lot more has been copied. I want to delete all these at one time. How it is possible, While i tried to delete but not all has to be deleted.
Upvotes: 1
Views: 763
Reputation: 498
If you have grant to 'DROP USER', You can drop MD user with this command:
DROP USER MD CASCADE;
and create MD user again.
Otherwise, You can make drop commands with following select:
SELECT 'DROP ' || T.OBJECT_TYPE || ' ' || T.OBJECT_NAME || ';' || CHR(10) COMMANDS
FROM USER_OBJECTS T
WHERE T.OBJECT_TYPE IN ('TABLE', 'VIEW', 'PACKAGE', 'PACKAGE BODY', 'TRIGGER');
You can add or remove object types in where clause.
Upvotes: 2