1

We have a database that has reached it's 12 GB limit. Export of the user went ok with no errors or warnings. Next step is to drop it completely and then do an import.

Trouble is that drop user [name] cascade; never finishes. And when we look at the object count for that user, nothing has been dropped.

When we look at what the session dropping the user is waiting on we get these two a lot: latch: cache buffers chains, resmgr:cpu quantum.

We also get this one: log file switch completion, not so often, but the wait time is long (700+ seconds on the one in wait just now).

Here is the result of a query against the v$session_event for the drop user cascade SID:

SID EVENT                               TOTAL_WAITS TOTAL_TIMEOUTS TIME_WAITED AVERAGE_WAIT   MAX_WAIT TIME_WAITED_MICRO   EVENT_ID WAIT_CLASS_ID WAIT_CLASS# WAIT_CLASS      CON_ID
--- ----------------------------------- ----------- -------------- ----------- ------------ ---------- ----------------- ---------- ------------- ----------- --------------- ------
 61 Disk file operations I/O                     89              0           0            0          0              3741  166678035    1740759767           8 User I/O             3
 61 control file sequential read                654              0           0            0          0              4274 3213517201    4108307767           9 System I/O           3
 61 control file parallel write                  66              0           8 ,12                   0             82283 4078387448    4108307767           9 System I/O           3
 61 latch: cache buffers chains                   3              0           1 ,41                   1             12447 2779959231    3875070507           4 Concurrency          3
 61 write complete waits                         11              0         886         80,5        177           8855414 4229542060    3290255840           2 Configuration        3
 61 log file switch completion                    1              0           0 ,25                   0              2459 3834950329    3290255840           2 Configuration        3
 61 log file sync                                 6              0           1 ,17                   0             10429 1328744198    3386400367           5 Commit               3
 61 db file sequential read                    3264              0          14            0          0            140814 2652584166    1740759767           8 User I/O             3
 61 db file scattered read                      692              0          10 ,01                   0             99381  506183215    1740759767           8 User I/O             3
 61 db file single write                         20              0           2 ,09                   0             17032 1307477558    1740759767           8 User I/O             3
 61 db file parallel read                         6              0           0 ,01                   0               818  834992820    1740759767           8 User I/O             3
SID EVENT                               TOTAL_WAITS TOTAL_TIMEOUTS TIME_WAITED AVERAGE_WAIT   MAX_WAIT TIME_WAITED_MICRO   EVENT_ID WAIT_CLASS_ID WAIT_CLASS# WAIT_CLASS      CON_ID
--- ----------------------------------- ----------- -------------- ----------- ------------ ---------- ----------------- ---------- ------------- ----------- --------------- ------
 61 index (re)build lock or pin object          204              0           0            0          0              1007 3347698104    4166625743           3 Administrative       3
 61 latch: shared pool                           11              0           0 ,01                   0              1369 2696347763    3875070507           4 Concurrency          3
 61 resmgr:cpu quantum                            6              0          19         3,14         18            188682 1452455426    2396326234          10 Scheduler            3
 61 SQL*Net message to client                    17              0           0            0          0                42 2067390145    2000153315           7 Network              3
 61 SQL*Net message from client                  17              0       62533      3678,42      30488         625331207 1421975091    2723168908           6 Idle                 3
 61 events in waitclass Other                   364              5         427         1,17        100           4267757 1736664284    1893977003           0 Other                3

17 rows selected. 

Any insights or tips would be great.

Database is Oracle XE 18.04.

2
  • Did you check v$session if it's maybe waiting for a lock? Sep 4, 2020 at 11:35
  • Blocking _session_status is not_in_wait Sep 4, 2020 at 11:41

1 Answer 1

2

'drop user' has to be atomic, which means we need to be able to roll it back, so its potentially a big operation depending on the number of objects and dependencies.

In some circumstances, I've found it faster to drop all the objects first for that user and then drop the user. For example spooling something like this

select 'drop table '||owner||'.'||table_name||' cascade constraints purge;'
from dba_tables
where owner = upper('&&owner')
union all
select 'drop '||object_type||' '||owner||'.'||object_name||';'
from dba_objects
where object_type not in ('TABLE','INDEX','PACKAGE BODY','TRIGGER','LOB','JOB')
and object_type not like '%LINK%'
and object_type not like '%PARTITION%'
and owner = upper('&&owner')

and running that covers the typical majority of objects. (There can be leftovers, like scheduler jobs etc) but at least at normally gets the number of objects down very low. And then run 'drop user' after that

1
  • It dropped during the weekend, so did not get to test this (but I will next time). Setting it as the right answer, thanks. Sep 8, 2020 at 9:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.