question

Cee avatar image
Cee asked

Is there any way to speed up dropping a user when they have a large number of tables etc?

I currently have a

DROP USER SAMPLE_USER CASCADE;

statement to drop the user SAMPLE_USER and all child tables/object/etc.

SAMPLE_USER contains approx 1200 tables and, using SQLDeveloper, can take several minutes to drop the user and all associated tables. Is there an alteration to this statement that can be used to speed up dropping user SAMPLE_USER?

tablesusersdropspeedupcascade
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Jonah H. Harris avatar image
Jonah H. Harris answered

In addition to handling the normal UNDO transactional semantics of the DROP, I don't believe there's much you can do, because Oracle has to internally perform removal of all dependency information and invalidate any/all objects that reference ones you are dropping.

Some people say you can cheat by dropping/truncating tables/tablespaces/data files first, but the sum of time spent is generally equivalent and it's more complex and error-prone.

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Shaun 2 avatar image
Shaun 2 answered

Jonah is correct. But oddly, there are some bugs on Tablespace Quotas that slow down drop user. If you remove any tablespace quotas first then quite often the drop user is faster. This is particularly evident if dropping many users. So you could try that.

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

oakesgr avatar image
oakesgr answered

Ok - it's a longshot, but trying REALLY hard to think outside the box...

If your db in question has only the 1 major schema, shutdown your database remove the files and create a new one. It's pretty drastic I know, but otherwise I can't think of anything to add to Jonah's answer.

1 comment
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Cee avatar image Cee commented ·
That's a little too nuclear for my liking...
0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.