1. 检查数据库是否delete:
1.select sid,serial#,event,logon_time,status,sql_id,p1,p2,p3 from v$session where sql_id in (select sql_id from v$sqlarea where sql_text like upper('%delete%audit_log%'))
select sql_text,sql_id from v$sql where sql_text like upper('%delete%audit_log%')
2.如果等待事件是行锁的话,建议删除
ALTER SYSTEM KILL SESSION 'sid,serial#' immediate;
2.
输入 : 数据库名字
输出: 数据库当前登录事务信息
#!/bin/bash export ORACLE_SID=statdb export ORACLE_HOME=/oracle11g/product/11.2 export PATH=$ORACLE_HOME/bin:$PATH:. sqlplus -s oper/stat_4102 <<EOF delete from ngen_session where trunc(CAPTURE_DATETIME)<trunc(sysdate-365) / insert into ngen_session select sysdate capture_datetime,username,machine,count(1),status no_of_session from v$session@nGenpr group by sysdate,username,machine,status / quit / EOF
输入 : 数据库名字
输出: 数据库当前登录事务信息
#!/bin/bash #set -x export ORACLE_SID=statdb export ORACLE_HOME=/oracle11g/product/11.2 export PATH=$ORACLE_HOME/bin:$PATH:. case $1 in An) sqlplus -s oper/stat_4102 <<EOF delete from ngen_session where trunc(CAPTURE_DATETIME)<trunc(sysdate-365) / insert into ngen_session select sysdate capture_datetime,username,machine,count(1),status no_of_session from v$session@An group by sysdate,username,machine,status / quit / EOF ;; A) sqlplus -s oper/stat_4102 <<EOF delete from ngen_session where trunc(CAPTURE_DATETIME)<trunc(sysdate-365) / insert into ngen_session select sysdate capture_datetime,username,machine,count(1),status no_of_session from v$session@A group by sysdate,username,machine,status / quit / EOF ;; B) sqlplus -s oper/stat_4102 <<EOF delete from B_session where trunc(CAPTURE_DATETIME)<trunc(sysdate-365) / insert into B_session select sysdate capture_datetime,username,machine,count(1),status no_of_session from v$session@B group by sysdate,username,machine,status / quit / EOF ;; *) exit ;; esac