create or replace PROCEDURE TASK_PRIMARY
IS
CNT NUMBER;
BEGIN
FOR C IN (SELECT * FROM TAB WHERE TNAME LIKE 'TASK_EMAILS%' ORDER BY TNAME) LOOP
EXECUTE IMMEDIATE ' ALTER TABLE '||C.TNAME||' MODIFY ID PRIMARY KEY ';
COMMIT;
END LOOP;
END;
//表锁住释放
select s.username,decode(l.type,'TM','TABLE LOCK','TX','ROW LOCK',NULL) LOCK_LEVEL,
o.owner,o.object_name,o.object_type,
s.sid,s.serial#,s.terminal,s.machine,s.program,s.osuser
from v$session s,v$lock l,dba_objects o
where s.sid=l.sid
and o.object_id=l.id1
and s.username is not null;
alter system kill session '300,24640'