Benjamin Zhang

目前就职于中科院计算机网络信息中心,主要兴趣集中在数据库,操作系统,中间件。

【SHELL】csscan的后续处理

26 Feb 2019 » Nginx

csscan的后续处理

  1. 通过java程序处理了scan.err的日志,结果如下:

    [root@app1 ~]# more character.log 
    SYS ERROR$ TEXT VARCHAR2(4000) 512 convertible
    SYS CDEF$ CONDITION LONG 5413 convertible
    SYSTEM ISSUES AUTHOR VARCHAR2(80) 48 convertible
    SYS VIEW$ TEXT LONG 36331 convertible
    SYS COL$ NAME VARCHAR2(30) 45 convertible,exceed column size
    SYS COL$ DEFAULT$ LONG 303 convertible
    SYS IDL_CHAR$ PIECE LONG 12288 convertible
    SYS JOB$ NLSENV VARCHAR2(4000) 212 convertible
    SYS COM$ COMMENT$ VARCHAR2(4000) 606 convertible
    SYS SOURCE$ SOURCE VARCHAR2(4000) 4000 convertible
    FA T_FA_ASSET_INFO_BAK_181114 ASSET_NAME VARCHAR2(100) 126 exceed column size
    FA C_ASSET_INFO_180919 ASSET_NAME VARCHAR2(100) 126 exceed column size
    FA C_ASSET_INFO_180919 ORIGIN_COUNTRY VARCHAR2(32) 33 exceed column size
    PM T_PM_BUDGET_B052902 BUDGET_CODE VARCHAR2(32) 42 exceed column size
    FA T_FA_ASSET_INFO_BAK_18070601 ASSET_PURCHASE_CODE VARCHAR2(32) 39 exceed column size
    EX_INBOX FI_YJCW_YSHZ_MX GKZFLXMC VARCHAR2(6) 9 exceed column size
    EX_OUTBOX HR_RCXM_YGPLX_TZGK ZTMB VARCHAR2(4000) 5820 exceed column size
    
  2. 编写shell脚本,批量生成alter的语句,如下:

    [root@app1 ~]# cat alter.sh 
    awk '{position="alter table "$1"."$2" modify "$3" "$4;print position}' character.log |awk -F '(' '{print $1,$2}'|awk -F ')' '{print $1}' |awk '{print $1,$2,$3,$4,$5,$6,$7*1.5}' >temp02.log
       
    awk '{position=$1" "$2" "$3" "$4" "$5" "$6"("$7")";print position}' temp02.log
    
  3. 执行上述alter.sh脚本,效果如下:

    [root@app1 ~]# ./alter.sh 
    alter table SYS.ERROR$ modify TEXT VARCHAR2(6000)
    alter table SYS.CDEF$ modify CONDITION LONG(0)
    alter table SYSTEM.ISSUES modify AUTHOR VARCHAR2(120)
    alter table SYS.VIEW$ modify TEXT LONG(0)
    alter table SYS.COL$ modify NAME VARCHAR2(45)
    alter table SYS.COL$ modify DEFAULT$ LONG(0)
    alter table SYS.IDL_CHAR$ modify PIECE LONG(0)
    alter table SYS.JOB$ modify NLSENV VARCHAR2(6000)
    alter table SYS.COM$ modify COMMENT$ VARCHAR2(6000)
    alter table SYS.SOURCE$ modify SOURCE VARCHAR2(6000)
    alter table FA.T_FA_ASSET_INFO_BAK_181114 modify ASSET_NAME VARCHAR2(150)
    alter table FA.C_ASSET_INFO_180919 modify ASSET_NAME VARCHAR2(150)
    alter table FA.C_ASSET_INFO_180919 modify ORIGIN_COUNTRY VARCHAR2(48)
    alter table PM.T_PM_BUDGET_B052902 modify BUDGET_CODE VARCHAR2(48)
    alter table FA.T_FA_ASSET_INFO_BAK_18070601 modify ASSET_PURCHASE_CODE VARCHAR2(48)
    

Related Posts