Session altered.
Elapsed: 00:00:00.03
SQL> select count(distinct(substr(ip_address_date,1,instr(ip_address_date,' ')))) uip
2 from ealog;
UIP
----------
7528
Elapsed: 00:00:02.15
此时用了大约2秒的时间,也就是说,外部表的性能较数据库表大约慢了3倍左右。
继续,我们可以查询当日网站中,哪些网页是被最频繁访问的:
SQL> select replace((replace(acc_file,'GET ','www.eygle.com')),'HTTP/1.1') accfile,ct from (
2 select ACC_FILE,count(*) ct from eygle_access_log_20061016
3 where acc_file like '%htm%'
4 group by acc_file order by ct desc)
5 where rownum <21;
ACCFILE CT
-------------------------------------------------------------------------------- ----------
www.eygle.com/index-tech.htm 110
www.eygle.com/archives/2006/10/wish_home.html 103
www.eygle.com/index-ha.htm 79
www.eygle.com/me/fairy_tale_leaf.htm 77
www.eygle.com/archives/2006/11/use_oracle_external_table.html 73
www.eygle.com/index-sql.htm 69
www.eygle.com/archives/2006/10/tom_oracle_9i10g.html 68
www.eygle.com/archives/2008/08/my_book_services.html 63
www.eygle.com/archives/2006/11/welcome_friend.html 62
www.eygle.com/archives/2006/10/veritas_vcs_simulator.html 61
www.eygle.com/index-case.htm 60
www.eygle.com/archives/2004/08/aoaouiiciona.html 59
www.eygle.com/archives/2006/08/oracle_fundbook_recommand.html 52
www.eygle.com/archives/2006/08/5460_8174.html 49
www.eygle.com/archives/2004/12/gmailaeaeoa.html 48
www.eygle.com/archives/2005/06/howlsmovingcast.html 48
www.eygle.com/gbook/index.html 48
www.eygle.com/index-hist.htm 44
www.eygle.com/index-special.htm 41
www.eygle.com/index-f&l.htm 37
20 rows selected.
Elapsed: 00:00:06.31
SQL>
通过外部表及SQL查询,只要日志文件中存在的信息,都可以很容易的被获取和分析.
-The End-