oracle報表相關指令碼
今天查詢之前的資料,突然發現一些有用的指令碼,在上一家公司,工作當中需要調取相關報表的一些指令碼,感覺還是蠻有用的,就放到blog上面來,命令多數是作業系統層面的(linux,hp_unix,aix),具體如下:
AUTHSTATE=compat
export SHELL=/usr/local/bin/bash
export NLS_LANG=American_America.ZHS16GBK
export PATH=/opt/softbench/bin:/usr/bin:/usr/ccs/bin:/usr/contrib/bin:/usr/contrib/Q4/bin:/opt/perl/bin:/opt/ipf/bin:/opt/hparray/bin:/opt/nettladm/bin:/opt/fcms/bin:/opt/sas/bin:/opt/wbem/bin:/opt/wbem/sbin:/usr/bin/X11:/opt/resmon/bin:/opt/perf/bin:/usr/contrib/kwdb/bin:/opt/graphics/common/bin:/opt/prm/bin:/opt/sfm/bin:/opt/hpsmh/bin:/opt/upgrade/bin:/opt/wlm/bin:/opt/gvsd/bin:/opt/sec_mgmt/bastille/bin:/opt/drd/bin:/opt/dsau/bin:/opt/dsau/sbin:/opt/firefox:/opt/gnome/bin:/opt/mozilla:/opt/perl_32/bin:/opt/perl_64/bin:/opt/sec_mgmt/spc/bin:/opt/ssh/bin:/opt/swa/bin:/opt/thunderbird:/opt/gwlm/bin:/usr/contrib/bin/X11:/opt/aCC/bin:/opt/caliper/bin:/opt/cadvise/bin:/opt/sentinel/bin:/opt/langtools/bin:/usr/sbin:/usr/local/sbin:/sbin:/oramem/oracle/product/10.2.0/bin:/usr/local/bin:/home/oracle/bin:/usr/sbin:/usr/local/sbin:/sbin
export BASH_ENV=/home/kasaur/.bashrc
export ORACLE_HOME=/oramem/oracle/product/10.2.0
export NLS_DATE_FORMAT=YYYYMMDDHH24MISS
export NLSPATH=/usr/lib/nls/msg/%L/%N:/usr/lib/nls/msg/%L/%N.cat
export LD_LIBRARY_PATH=/oramem/oracle/product/10.2.0/lib:/oramem/oracle/product/10.2.0/sqlplus/lib:/usr/lib:/lib:
cd /tmp/kpi_sh
export pwd=`cat /tmp/kpi_sh/pwd.txt `
TMP_VAL=`sqlplus -S kasaur/$pwd@M_ORAQUE << !
set heading off feedback off pagesize 0 verify off echo off numwidth 4
select to_char(sysdate-1,'YYYYMM') from dual;
exit;
!`
TMP_VAL2=`sqlplus -S kasaur/$pwd@M_ORAQUE << !
set heading off feedback off pagesize 0 verify off echo off numwidth 4
select to_char(sysdate-1,'YYYYMMDD') from dual;
exit;
!`
sqlplus -S kasaur/$pwd@M_ORAMDB << !
truncate table tmp_sun_ip;
insert into tmp_sun_ip select active_ip,uuid from njxlzxtf.memb_active_game where active_ip in
(select active_ip from (
select active_ip,count(*) as cnt from njxlzxtf.memb_active_game where trunc(active_ts)=trunc(sysdate-1) and site_cd='SUN'
group by active_ip having count(*)>=10)
) and trunc(active_ts)=trunc(sysdate-1) and site_cd='SUN';
commit;
exit;
!
sqlplus -S kasaur/$pwd@oraque > sun_ipban_$TMP_VAL2.txt << !
set echo off
set feedback off
set newpage none
set linesize 2000
set verify off
set pagesize 0
set term off
set trims on
set heading off
set trimspool on
set trimout on
set timing off
select substr(sysdate-1,1,8)||'|'||site_id||'|'||active_ip||'|'||loginname from
(select a.site_id as site_id,b.active_ip as active_ip,a.loginname as loginname from njxlzxtf.memb_active_queue_sun a,tmp_sun_ip b where a.create_ts>=substr(sysdate-1,1,8) and a.create_ts
union all
select b.active_ts as active_ts,a.site_id as site_id,b.active_ip as active_ip,a.loginname as loginname from njxlzxtf.memb_active_queue_sun_$TMP_VAL a,tmp_sun_ip b where a.create_ts>=substr(sysdate-1,1,8) and a.create_ts
order by site_id,active_ip,loginname;
commit;
exit;
!
sqlplus -S kasaur/$pwd@oraque > sun_ipunban_$TMP_VAL2.txt << !
set echo off
set feedback off
set newpage none
set linesize 2000
set verify off
set pagesize 0
set term off
set trims on
set heading off
set trimspool on
set trimout on
set timing off
select active_ts||'|'||site_id||'|'||active_ip||'|'||loginname from
(select b.active_ts as active_ts,a.site_id as site_id,b.active_ip as active_ip,a.loginname as loginname from njxlzxtf.memb_active_queue_sun a,tmp_sun_ip b where a.create_ts>=substr(sysdate-1,1,8) and a.create_ts
union all
select b.active_ts as active_ts,a.site_id as site_id,b.active_ip as active_ip,a.loginname as loginname from njxlzxtf.memb_active_queue_sun_$TMP_VAL a,tmp_sun_ip b where a.create_ts>=substr(sysdate-1,1,8) and a.create_ts
order by site_id,active_ip,loginname;
commit;
exit;
!
然後把這段指令碼放到crontab裡面,每天自動執行就ok了。
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/25618347/viewspace-713821/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 埋點表相關
- 【AWR】Oracle批量生成awr報告指令碼Oracle指令碼
- 資料表相關操作
- oracle建庫指令碼Oracle指令碼
- ORACLE備份指令碼Oracle指令碼
- mybatise外掛反向生成資料庫表相關Java程式碼MyBatis資料庫Java
- MySQL鎖表相關問題查詢思路MySql
- Mysql運維-資料庫及表相關操作MySql運維資料庫
- ORACLE常用定時備份指令碼Oracle指令碼
- Oracle:GRID 下 root.sh 指令碼Oracle指令碼
- 分享Oracle Rman的備份指令碼Oracle指令碼
- 【SCN】Oracle檢查scn值指令碼Oracle指令碼
- 【TABLE】Oracle表資訊收集指令碼Oracle指令碼
- Oracle批次生成Merge指令碼程式Oracle指令碼
- oracle自動冷備份指令碼Oracle指令碼
- oracle_ray.sh 常用的oracle sql功能指令碼OracleSQL指令碼
- 關於群起kafka指令碼Kafka指令碼
- SCRIPT】Oracle巡檢報告html格式樣例指令碼,帶趨勢圖OracleHTML指令碼
- Oracle運維指令碼-巡檢(RAC版)Oracle運維指令碼
- Oracle ADG 自動切換指令碼分享Oracle指令碼
- ORACLE問題處理十個指令碼Oracle指令碼
- shell指令碼報錯:[: missing `]‘指令碼
- 關於Solidity指令碼相關環境配置及指令碼資料的查詢Solid指令碼
- 史上最全近百條Oracle DBA日常維護SQL指令碼指令OracleSQL指令碼
- sql_trace相關指令碼SQL指令碼
- Python基礎之列表相關知識-day5Python
- Oracle RAC重新執行root.sh指令碼Oracle指令碼
- Oracle運維指令碼-巡檢(單機版)Oracle運維指令碼
- Oracle運維指令碼-收集統計資訊Oracle運維指令碼
- 【SCRIPT】Oracle日常巡檢指令碼通用版Oracle指令碼
- oracle資料庫使用rman備份指令碼Oracle資料庫指令碼
- sh指令碼執行報錯指令碼
- zabbix報警指令碼(wechat,email)指令碼AI
- C#連線Oracle資料庫,通過EF自動生成與資料庫表相關的實體類C#Oracle資料庫
- python中列表相加Python
- 【SCRIPT】Oracle資料庫基本資訊收集指令碼Oracle資料庫指令碼
- [20190930]oracle raw型別轉化number指令碼.txtOracle型別指令碼
- Oracle 建立表空間和使用者指令碼Oracle指令碼
- oracle自帶指令碼說明(rdbms,ctx,sqlplus,javavm)Oracle指令碼SQLJava