oracle rownum
1. Use the analytic function is the best way.row_number() over ( partition by col1 order by col2 )for example: get records between 100 and 150, order by tname.select tname,tabtype from ( select tname,tabtype,row_number() over ( order by tname ) rn from tab)where rn between 100 and 150;2. use rownumselect tname,tabtype from ( select tname,tabtype,rownum rn from tab where rownum <= 150)where rn >= 100;Use rownum, you can not order the whole records when using order by, it will get the f
rm can not work when the Argument list is too long
When the argument list is too long, the rm command can not work, it is limit to os.solution 1:rm dir, recreate the dir.solution 2:find /path/to -name "*.png" -exec rm {} ;[@more@]
.pl & .pm file can be read under apache
When you put .html file on the document root, put .pl& .pm file in a cgi-bin directory under the document root. The user can get the .pl & .pm file through http://host/documentroot/cgi-bin/aaa.pl, so we should add AddHandler cgi-script .pl orAddType application/x-httpd-cgi .pl .pm in apache configure file, then user request http://host/documentroot/cgi-bin/aaa.pl, it can not work, it must through ScriptAlias.[@more@]
Some difference between mysql & oracle
1.create table TEST( num1 number(10), num2 number(10), num3 number(10))insert into TEST values(2,4,2).update TESTHUA set num1=num1+2,num2=num2+8,num3=num2/num1;select * from TESToracle's result:4,12,2when oracle execute num3,the value of num1 and num2 didn't change.mysql's result:4,12,3when mysql execute num3,the value of num1 and num2 changed already.num1 early than num2 because num1's position is bofore num2It means that oracle update the field data at the same time butthe mysql not,It update
two method of left out join -- more than two table;
oneselect A.NAME_1,B.NAME_2,C.NAME_3 from A left join B on A.ID=B.ID left join C on B.ID_1= C.ID_1;twoselect P.NAME_1,P.NAME_2,C.NAME_3 from (select A.NAME_1,B.NAME_2,B.ID_1 from A left join B on A.ID=B.ID) P left join C on P.ID_1= C.ID_1;[@more@]
/dev/shm 介绍 --转载
默认系统就会加载/dev/shm ,它就是所谓的tmpfs,有人说跟ramdisk(虚拟磁盘),但不一样。象虚拟磁盘一样,tmpfs 可以使用您的 RAM,但它也可以使用您的交换分区来存储。而且传统的虚拟磁盘是个块设备,并需要一个 mkfs 之类的命令才能真正地使用它,tmpfs 是一个文件系统,而不是块设备;您只是安装它,它就可以使用了。tmpfs有以下优势:1。动态文件系统的大小,2。tmpfs 的另一个主要的好处是它闪电般的速度。因为典型的 tmpfs 文件系统会完全驻留在 RAM 中,读写几乎可以是瞬间的。3。tmpfs 数据在重新启动之后不会保留,因为虚拟内存
mysql can't start dues to the disk space is full
use ./mysqld_safe --user=mysql &start mysql.The mysql can not start. There are much mysql restart info show on the screen always. And can not find the /var/lib/mysql/mysql.sock file.The reason:Then find the space is full. So the mysql can not start naturally. Delete some log info, then the mysql start correctly.The big log files are two:1. Our application log2. The /var/log/audit.d在/var/log/audit.d目录下的文件是由Linux审计子系统(Linux Audit Subsystem,简称LAuS)产生的。 为了安全目的,LAuS在启
umask side-effect
When we deploy production today, a strange problem comes out.When accessing the url, tell Can't locate loadable object for module DBI in @INC. First, we think it is the DBI install problem, but after install several time, it has no use.Then we find the umask is 077, so when we install, the dir will be 700, so it can not be access by regular user through http. So we should change umask to 022 before we install.[@more@]
mysql can't connect error about privilege----not root user
mysql -uuser -ppass dbERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (13)when use root user,It is ok.Obviously, it is privilege problem.Try to check the mysql.sock privelege. If it is ok, then check its father dir to check.[@more@]
mysql drop key
It is easy.alter table TABLE_NAME drop key KEY_NAME;[@more@]
the "in" use in mysql
use in in mysql,if the field is indexed,the index is still useful,but when the data quantity is small relative to the param in "in" parentheses,mysql optimizer will use ALL TABLE SCAN instead.[@more@]