真实的国产乱ⅩXXX66竹夫人,五月香六月婷婷激情综合,亚洲日本VA一区二区三区,亚洲精品一区二区三区麻豆

成都創(chuàng)新互聯(lián)網(wǎng)站制作重慶分公司

獲取sql完整腳本,get_fulltext.sh

點擊(此處)折疊或打開

網(wǎng)站建設(shè)公司,為您提供網(wǎng)站建設(shè),網(wǎng)站制作,網(wǎng)頁設(shè)計及定制網(wǎng)站建設(shè)服務(wù),專注于成都定制網(wǎng)頁設(shè)計,高端網(wǎng)頁制作,對成都公路鉆孔機等多個行業(yè)擁有豐富的網(wǎng)站建設(shè)經(jīng)驗的網(wǎng)站建設(shè)公司。專業(yè)網(wǎng)站設(shè)計,網(wǎng)站優(yōu)化推廣哪家好,專業(yè)成都網(wǎng)站推廣優(yōu)化,H5建站,響應(yīng)式網(wǎng)站。

  1. #!/bin/bash
  2. # by ray
  3. # 2017-08-31
  4. #v0.1

  5. ##get sqltext from dbs_hist_sqltext,sqltext will be save current directory and file name will be sql_id.txt
  6. FromHist(){
  7. sqlplus -s /nolog <<-RAY
  8.     conn / as sysdba
  9.     set linesize 300
  10.     set serveroutput on
  11.     set feedback off
  12.     spool ./$1.txt
  13.     declare
  14.     l_buffer varchar2(3000);
  15.     l_amount binary_integer :=3000;
  16.     l_pos int :=1;
  17.     l_clob_length int;
  18.     sqlid varchar2(100) := '$1';
  19.     begin
  20.     select DBMS_LOB.getlength(sql_text) into l_clob_length from dba_hist_sqltext where sql_id=sqlid;
  21.     while l_pos
  22.     select DBMS_LOB.SUBSTR(sql_text,l_amount,l_pos) into l_buffer from dba_hist_sqltext where sql_id=sqlid;
  23.     dbms_output.put(l_buffer);
  24.     l_pos:=l_pos+l_amount;
  25.     end loop;
  26.     dbms_output.put_line(' ');
  27.     end;
  28.     /
  29.     spool off
  30.     exit
  31. RAY
  32. }


  33. ##get sqltext from V$sqlarea,sqltext will be save current directory and file name will be sql_id.txt
  34. FromMomery(){
  35. sqlplus -s /nolog <<-RAY
  36.     conn / as sysdba
  37.     set linesize 300
  38.     set serveroutput on
  39.     set feedback off
  40.     spool ./$1.txt
  41.     declare
  42.     l_buffer varchar2(3000);
  43.     l_amount binary_integer :=3000;
  44.     l_pos int :=1;
  45.     l_clob_length int;
  46.     sqlid varchar2(100) := '$1';
  47.     begin
  48.     select DBMS_LOB.getlength(sql_fulltext) into l_clob_length from v\$sqlarea where sql_id=sqlid;
  49.     while l_pos
  50.     select DBMS_LOB.SUBSTR(sql_fulltext,l_amount,l_pos) into l_buffer from v\$sqlarea where sql_id=sqlid;
  51.     dbms_output.put(l_buffer);
  52.     l_pos:=l_pos+l_amount;
  53.     end loop;
  54.     dbms_output.put_line(' ');
  55.     end;
  56.     /
  57.     spool off
  58.     exit
  59. RAY
  60. }

  61. func_help(){
  62.     echo "--from specifying how to get sqltext,memery or hist can be used.default momery!!"
  63.     echo "--sqlid specify a sql_id"
  64.     echo "for example:"
  65.     echo "get_fulltext.sh --from=momery --sqlid=*********"
  66. }

  67. #get parameter
  68. argvs=($@)
  69. for i in ${argvs[@]}
  70. do
  71.         case `echo $i | awk -F '=' '{print $1}' | awk -F '--' '{print $2}'| tr [a-z] [A-Z]` in
  72.         FROM)
  73.             fm=`echo $i | awk -F '=' '{print $2}' | tr [a-z] [A-Z]`
  74.         ;;
  75.         SQLID)
  76.             sqlid=`echo $i | awk -F '=' '{print $2}' `
  77.         ;;
  78.         HELP)
  79.             func_help
  80.             exit 1
  81.         esac
  82. done

  83. if [ ! ${fm} ]; then
  84.     fm='MOMERY'
  85. fi
  86. if [ ! ${sqlid} ]; then
  87.     echo "The sql_id must be specified!!"
  88.     exit 1
  89. fi

  90. ##exec script
  91. if [ ${fm} == "HIST" ];then
  92.     FromHist "${sqlid}"
  93. elif [ ${fm} == "MOMERY" ];then
  94.     FromMomery "${sqlid}"
  95. else
  96.     echo "The type of parameter only are HIST or MOMERY!!"
  97. fi


標題名稱:獲取sql完整腳本,get_fulltext.sh
網(wǎng)址分享:http://weahome.cn/article/joiehd.html

其他資訊

在線咨詢

微信咨詢

電話咨詢

028-86922220(工作日)

18980820575(7×24)

提交需求

返回頂部