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/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- Oracle - 表相關常用操作語句Oracle
- Oracle臨時表相關知識Oracle
- 資料表相關操作
- oracle報表自動FTP指令碼OracleFTP指令碼
- Oracle 效能相關常用指令碼(SQL)Oracle指令碼SQL
- 【AWR】Oracle批量生成awr報告指令碼Oracle指令碼
- mybatise外掛反向生成資料庫表相關Java程式碼MyBatis資料庫Java
- oracle啟動和關閉指令碼for LinuxOracle指令碼Linux
- 關於oracle 預設示例scott的指令碼Oracle指令碼
- MySQL鎖表相關問題查詢思路MySql
- 轉:Mysql 分割槽 分表相關總結MySql
- Oracle rman 指令碼Oracle指令碼
- Oracle expdp 指令碼Oracle指令碼
- SHELL指令碼實現Oracle自啟動與關閉指令碼Oracle
- ORACLE及OS相關監控指令碼 For AIX6.1Oracle指令碼AI
- DG相關指令碼指令碼
- 您好!關於指令碼指令碼
- IE 頁面不正常顯示 錯誤指令碼不報錯 指令碼除錯相關指令碼除錯
- Mysql運維-資料庫及表相關操作MySql運維資料庫
- 和分割槽表相關的一點總結
- Oracle10g 自動生成AWR報告的指令碼Oracle指令碼
- ORACLE備份指令碼Oracle指令碼
- oracle建庫指令碼Oracle指令碼
- [Oracle] 指令碼建立DBOracle指令碼
- oracle 熱備指令碼 .Oracle指令碼
- Oracle登入指令碼Oracle指令碼
- oracle自帶指令碼Oracle指令碼
- oracle 備份指令碼Oracle指令碼
- oracle 監控指令碼Oracle指令碼
- 關於oracle安裝時的root.sh指令碼解析Oracle指令碼
- 關於Oracle資料庫熱備份指令碼深入剖析Oracle資料庫指令碼
- Oracle10g自動生成AWR分析報告的指令碼Oracle指令碼
- 關於群起kafka指令碼Kafka指令碼
- QTP - 指令碼相關收集QT指令碼
- zabbix報警指令碼(wechat,email)指令碼AI
- shell指令碼報錯:[: missing `]‘指令碼
- 生成awr報告的指令碼指令碼
- oracle獲取ddl指令碼Oracle指令碼