请问兄弟们一个问题,有一个job,调用的存储过程里面有这么一段: insert into log_lock_msg (sql_text)
select '[' || to_char(sysdate, 'yyyy-mm-dd hh24:mi:ss') || '] ' || 'LOGON_TIME:' || to_char(t3.LOGON_TIME, 'yyyy-mm-dd hh24:mi:ss') || ',object_name:' || t2.object_name || ',object_type:' || t2.object_type || ',LOCKED_MODE:' || t1.LOCKED_MODE ||
',OS_USER_NAME:' || t1.OS_USER_NAME || ',STATUS:' || t3.STATUS || ',MACHINE:' || t3.MACHINE
from v$locked_object t1, all_objects t2, v$session t3
where t1.OBJECT_ID = t2.object_id and t1.SESSION_ID = t3.SID
and t2.object_name <> 'LOG_LOCK_MSG'; insert into log_lock_msg (sql_text)
values ( '[' || to_char(sysdate, 'yyyy-mm-dd hh24:mi:ss') || '] test'); commit;手工运行这个Job,这两个insert的数据都插到了表中;但是job自动运行(每1分钟)的话,只有第二个insert的数据插到了表中,而第一个没有。
select '[' || to_char(sysdate, 'yyyy-mm-dd hh24:mi:ss') || '] ' || 'LOGON_TIME:' || to_char(t3.LOGON_TIME, 'yyyy-mm-dd hh24:mi:ss') || ',object_name:' || t2.object_name || ',object_type:' || t2.object_type || ',LOCKED_MODE:' || t1.LOCKED_MODE ||
',OS_USER_NAME:' || t1.OS_USER_NAME || ',STATUS:' || t3.STATUS || ',MACHINE:' || t3.MACHINE
from v$locked_object t1, all_objects t2, v$session t3
where t1.OBJECT_ID = t2.object_id and t1.SESSION_ID = t3.SID
and t2.object_name <> 'LOG_LOCK_MSG'; insert into log_lock_msg (sql_text)
values ( '[' || to_char(sysdate, 'yyyy-mm-dd hh24:mi:ss') || '] test'); commit;手工运行这个Job,这两个insert的数据都插到了表中;但是job自动运行(每1分钟)的话,只有第二个insert的数据插到了表中,而第一个没有。
按第一条关联条件查询,有数据;并且手工执行这个job没有问题,但是让job自动运行就出问题了。
JOB在运行的时候,JOB所属的用户没有被锁定的对象。
你用不同的数据库用户执行,all_objects的内容就不一样。
当前用户对第一条sql的对象没有查询权限吧?