ORA-00054:资源正忙,要求指定NOWAIT

--ORA-00054:资源正忙,要求指定NOWAIT--

--以DBA角色, 查看当前数据库里锁的情况可以用如下SQL语句--

SELECT sid, serial#, username, osuser FROM v$session WHERE sid IN(SELECT session_id FROM v$locked_object);



--杀掉锁--

ALTER SYSTEM KILL SESSION 'sid,serial#';



ALTER SYSTEM KILL SESSION '151,48674';





--生成序号的函数--

 CREATE OR REPLACE FUNCTION BDLLY.fn_Reg_ywdjh(fn_rq date)

    RETURN varchar2 IS

    v_char varchar2(200);

    v_max  varchar2(100);



   BEGIN

      --查询出最大的业务登记号--

      SELECT max(ywdjh) INTO v_max FROM bdlly_2v.qtywb@"BDLLY2V_LINK.REGRESS.RDBMS.DEV.US.ORACLE.COM" WHERE TO_CHAR(rq,'YYYY-MM-DD')=TO_CHAR(fn_rq,'YYYY-MM-DD');

      IF v_max IS NULL  

       THEN

        v_char := to_char(fn_rq,'yyyymmdd')||'0001';

      ELSE

        v_char := to_char((to_number(v_max) + 1));

      END IF;

      commit;

      RETURN v_char;



   END fn_Reg_ywdjh;

/



--调用--



SELECT BDLLY.fn_Reg_ywdjh(RQ) FROM BDLLY_2V.QTYWB;

 

你可能感兴趣的:(wait)