Как в оракл прибить всех приконнекченных клиентов?

pitrik2

делаю drop user cascade;
а он говорит что не может, т.к. юзер приконнекчен
делаю тогда так:

revoke connect from user;
spool
select 'ALTER system KILL SESSION ''' || sid || ',' || serial# || ''';' from v$session WHERE LOWER(username)=LOWER(user);
@spooled.sql
drop user cascade;

все равно не может по той же причине :(
причем toad-овые коннекты валятся, а java-вские нет
как их тоже завалить?

0000

KILL SESSION Clause
...
If the session is performing some activity that must be completed, such as waiting for a reply from a remote database or rolling back a transaction, then Oracle Database waits for this activity to complete, marks the session as terminated, and then returns control to you.
Не?

sinet

попробуй immediate у KILL SESSION указать...

pitrik2

Не?
о блин, я думал что так поступает disconnect
а kill сразу валит

pitrik2

попробуй immediate у KILL SESSION указать...
не помогло :(
гадство

0000

Ты уверен, что у Java-сессий нет rollback? На больших объемах он может быть ого-го по времени.

pitrik2

Ты уверен, что у Java-сессий нет rollback? На больших объемах он может быть ого-го.
подожди, а разве
and then returns control to you
не означает что к моменту drop user; сессия уже будет прибита?

sinet

Нет.
marks the session as terminated, and then returns control to you.

0000

Так он вернет контроль тебе, когда откат пройдет.
Кажется я понял - тебе DISCONNECT SESSION нужно
Use the DISCONNECT SESSION clause to disconnect the current session by destroying the dedicated server process (or virtual circuit if the connection was made by way of a Shared Sever). To use this clause, your instance must have the database open. You must identify the session with both of the following values from the V$SESSION view:
For integer1, specify the value of the SID column.
For integer2, specify the value of the SERIAL# column.
If system parameters are appropriately configured, then application failover will take effect.
The POST_TRANSACTION setting allows ongoing transactions to complete before the session is disconnected. If the session has no ongoing transactions, then this clause has the same effect described for as KILL SESSION.
The IMMEDIATE setting disconnects the session and recovers the entire session state immediately, without waiting for ongoing transactions to complete.
If you also specify POST_TRANSACTION and the session has ongoing transactions, then the IMMEDIATE keyword is ignored.
If you do not specify POST_TRANSACTION, or you specify POST_TRANSACTION but the session has no ongoing transactions, then this clause has the same effect as described for KILL SESSION IMMEDIATE.

pitrik2

блин
ну хрень какая то
я понимаю что она токо помечает ее, а завалит при следующем запросе
но ведь туад же не шлет следующий запрос а юзер нормально прибивается

pitrik2

Кажется я понял - тебе DISCONNECT SESSION нужно
ща попробую оба сделать нах
сначала дисконект потом кил
:)

pitrik2

ща попробую оба
не помогло
но заметил что второй вызов скрипта срабатывает
т.е. там некая задержка нужна
как ее сделать?
есть команда sleep?

pitrik2

execute dbms_lock.sleep(2);
пока что вроде работает
Оставить комментарий
Имя или ник:
Комментарий: