rinald_未来往事

Can't locate DBI.pm in @INC (@INC contains: /usr/lib/perl错误解决方法

Linux
在安装使用mysqlsla时遇到了这个常见的错误,错误大致描述如下:
[root@vpn mysqlsla-2.03]# mysqlsla -lt slow /opt/slow.log | more
Can't locate DBI.pm in @INC (@INC contains: /usr/lib/perl5/site_perl/5.8.8/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.8 /usr/lib/perl5/site_perl /usr/lib/perl5/vendor_perl/5.8.8/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.8 /usr/lib/perl5/vendor_perl /usr/lib/perl5/5.8.8/i386-linux-thread-multi /usr/lib/perl5/5.8.8 .) at /usr/bin/mysqlsla line 2098.
BEGIN failed--compilation aborted at /usr/bin/mysqlsla line 2098.


错误原因很简单缺少DBI,安装即可:
[root@vpn mysqlsla-2.03]# wget http://search.cpan.org/CPAN/authors/id/T/TI/TIMB/DBI-1.623.tar.gz
[root@vpn mysqlsla-2.03]# tar -zxvf DBI-1.623.tar.gz
[root@vpn mysqlsla-2.03]# cd DBI-1.623
[root@vpn mysqlsla-2.03]# perl Makefile.PL
[root@vpn mysqlsla-2.03]# make && make install


安装完成DBI后再测试OK了:
[root@vpn mysqlsla-2.03]# mysqlsla -lt slow /opt/slow.log | more
mysqlsla -lt slow /opt/slow.log  | more                
Use of uninitialized value $line in pattern match (m//) at /usr/local/bin/mysqlsla line 675, <LOG> line 211.
Use of uninitialized value $line in pattern match (m//) at /usr/local/bin/mysqlsla line 692, <LOG> line 211.
Report for slow logs: /opt/slow.log
35 queries total, 15 unique
Sorted by 't_sum'
Grand Totals: Time 229 s, Lock 0 s, Rows sent 443.57k, Rows Examined 10.11M


______________________________________________________________________ 001 ___
Count         : 7  (20.00%)
Time          : 42.930986 s total, 6.132998 s avg, 4.046063 s to 10.72709 s max  (18.76%)
Lock Time (s) : 354 otal, 51 vg, 38 o 65 ax  (15.26%)
Rows sent     : 54 avg, 54 to 54 max  (0.09%)
Rows examined : 1.58k avg, 222 to 4.57k max  (0.11%)
Database      : discuz_nanchang
Users         :
       discuz_nanchang@ 192.168.1.10 : 42.86% (3) of query, 11.43% (4) of all users
       discuz_nanchang@ 192.168.1.15 : 42.86% (3) of query, 8.57% (3) of all users
       discuz_nanchang@ 192.168.1.20 : 14.29% (1) of query, 2.86% (1) of all users

Query abstract:
SET timestamp=N; SELECT t.* FROM pre_forum_thread t WHERE t.fid='S' AND (t.displayorder IN (N2)) ORDER BY displayorder DESC, lastpost DESC LIMIT N;

Query sample:
SET timestamp=1354213966;
SELECT t.* FROM pre_forum_thread t
                        WHERE  t.fid='139'  AND (t.displayorder IN (0, 1))
                        ORDER BY displayorder DESC, lastpost DESC
                        LIMIT 54;
……………………
……………………

原文作者:rinald
原文地址:http://fity.cn/post/325.html
互联网技术更新较快,本站很多文章具有实效性,我会及时更新原文,但转载的文章无法通知更新。为了不给读者造成困惑或误导,请您在转载时保留此出处信息,尊重别人也是尊重自己。

发表评论

必填

选填

选填

必填

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。