zoukankan      html  css  js  c++  java
  • 数据库事务信息

    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
  • 相关阅读:
    php笔记--php安装
    IEDA-Git的应用
    php类型
    3.比较与逻辑运算
    2.阶乘
    1.双分支
    013_request对象包含的内容以及获取
    011_jsp引入JSTL后实现jsp的解耦
    010_jsp引入JSTL
    ORACLE1.28 面试题
  • 原文地址:https://www.cnblogs.com/feiyun8616/p/6025733.html
Copyright © 2011-2022 走看看