MYSQLºÍORACLEµÄһЩ²Ù×÷Çø±ð
MYSQLºÍORACLEµÄһЩ²Ù×÷Çø±ð
ÓкܶàÓ¦ÓÃÏîÄ¿, ¸ÕÆð²½µÄʱºòÓÃMYSQLÊý¾Ý¿â»ù±¾ÉÏÄÜʵÏÖ¸÷ÖÖ¹¦ÄÜÐèÇó£¬Ëæ×ÅÓ¦ÓÃÓû§µÄÔö¶à£¬Êý¾ÝÁ¿µÄÔö¼Ó£¬MYSQL½¥½¥µØ³öÏÖ²»¿°ÖظºµÄÇé¿ö£ºÁ¬½ÓºÜÂýÉõÖÁå´»ú£¬ÓÚÊǾÍÓаÑÊý¾Ý´ÓMYSQLǨµ½ORACLEµÄÐèÇó£¬Ó¦ÓóÌÐòÒ²ÒªÏàÓ¦×öһЩÐ޸ġ£±¾ÈË×ܽá³öÒÔϼ¸µã×¢ÒâÊÂÏϣÍû¶Ô´ó¼ÒÓÐËù°ïÖú¡£
1.×Ô¶¯Ôö³¤µÄÊý¾ÝÀàÐÍ´¦Àí
MYSQLÓÐ×Ô¶¯Ôö³¤µÄÊý¾ÝÀàÐÍ£¬²åÈë¼Ç¼ʱ²»ÓòÙ×÷´Ë×ֶΣ¬»á×Ô¶¯»ñµÃÊý¾ÝÖµ¡£ORACLEûÓÐ×Ô¶¯Ôö³¤µÄÊý¾ÝÀàÐÍ£¬ÐèÒª½¨Á¢Ò»¸ö×Ô¶¯Ôö³¤µÄÐòÁкţ¬²åÈë¼Ç¼ʱҪ°ÑÐòÁкŵÄÏÂÒ»¸öÖµ¸³ÓÚ´Ë×ֶΡ£
CREATE SEQUENCE ÐòÁкŵÄÃû³Æ (×îºÃÊDZíÃû+ÐòÁкűê¼Ç) INCREMENT BY 1 START WITH 1 MAXVALUE 99999 CYCLE NOCACHE;
ÆäÖÐ×î´óµÄÖµ°´×ֶεij¤¶ÈÀ´¶¨, Èç¹û¶¨ÒåµÄ×Ô¶¯Ôö³¤µÄÐòÁкŠNUMBER(6) , ×î´óֵΪ999999
INSERT Óï¾ä²åÈëÕâ¸ö×Ö¶ÎֵΪ: ÐòÁкŵÄÃû³Æ.NEXTVAL
2. µ¥ÒýºÅµÄ´¦Àí
MYSQLÀï¿ÉÒÔÓÃË«ÒýºÅ°üÆð×Ö·û´®£¬ORACLEÀïÖ»¿ÉÒÔÓõ¥ÒýºÅ°üÆð×Ö·û´®¡£ÔÚ²åÈëºÍÐÞ¸Ä×Ö·û´®Ç°±ØÐë×öµ¥ÒýºÅµÄÌæ»»£º°ÑËùÓгöÏÖµÄÒ»¸öµ¥ÒýºÅÌæ»»³ÉÁ½¸öµ¥ÒýºÅ¡£
3. ·Ò³µÄSQLÓï¾äµÄ´¦Àí
MYSQL´¦Àí·Ò³µÄSQLÓï¾ä±È½Ï¼òµ¥£¬ÓÃLIMIT ¿ªÊ¼Î»ÖÃ, ¼Ç¼¸öÊý£»PHPÀﻹ¿ÉÒÔÓÃSEEK¶¨Î»µ½½á¹û¼¯µÄλÖá£ORACLE´¦Àí·Ò³µÄSQLÓï¾ä¾Í±È½Ï·±ËöÁË¡£Ã¿¸ö½á¹û¼¯Ö»ÓÐÒ»¸öROWNUM×ֶαêÃ÷ËüµÄλÖÃ, ²¢ÇÒÖ»ÄÜÓÃROWNUM<100, ²»ÄÜÓÃROWNUM>80¡£
ÒÔÏÂÊǾ¹ý·ÖÎöºó½ÏºÃµÄÁ½ÖÖORACLE·Ò³SQLÓï¾ä( IDÊÇΨһ¹Ø¼ü×ÖµÄ×Ö¶ÎÃû )£º
Óï¾äÒ»£º
SELECT ID, [FIELD_NAME,...] from TABLE_NAME WHERE ID IN ( SELECT ID from (SELECT ROWNUM AS NUMROW, ID from TABLE_NAME WHERE Ìõ¼þ1 ORDER BY Ìõ¼þ2) WHERE NUMROW £¾ 80 AND NUMROW £¼ 100 ) ORDER BY Ìõ¼þ3;
Óï¾ä¶þ£º
SELECT * from (( SELECT ROWNUM AS NUMROW, c.* from (select [FIELD_NAME,...] from TABLE_NAME WHERE Ìõ¼þ1 ORDER BY Ìõ¼þ2) c) WHERE NUMROW £¾ 80 AND NUMROW £¼ 100 ) ORDER BY Ìõ¼þ3;
4£® ³¤×Ö·û´®µÄ´¦Àí
³¤×Ö·û´®µÄ´¦ÀíORACLEÒ²ÓÐËüÌØÊâµÄµØ·½¡£INSERTºÍUPDATEʱ×î´ó¿É²Ù×÷µÄ×Ö·û´®³¤¶ÈСÓÚµÈÓÚ4000¸öµ¥×Ö½Ú, Èç¹ûÒª²åÈë¸ü³¤µÄ×Ö·û´®, Ç뿼ÂÇ×Ö¶ÎÓÃCLOBÀàÐÍ£¬·½·¨½èÓÃORACLEÀï×Ô´øµÄDBMS_LOB³ÌÐò°ü¡£²åÈëÐ޸ļǼǰһ¶¨Òª×ö½øÐзǿպͳ¤¶ÈÅжϣ¬²»ÄÜΪ¿ÕµÄ×Ö¶ÎÖµºÍ³¬³ö³¤¶È×Ö¶ÎÖµ¶¼Ó¦¸ÃÌá³ö¾¯¸æ,·µ»ØÉϴβÙ×÷¡£
5. ÈÕÆÚ×ֶεĴ¦Àí
MYSQLÈÕÆÚ×ֶηÖDATEºÍTIMEÁ½ÖÖ£¬ORACLEÈÕÆÚ
Ïà¹ØÎĵµ£º
ÎÒÃÇ´ó¼Ò¶¼ÖªµÀÿ¸öOracleÊý¾Ý¿â¶¼»áÓÐÒ»¸ö»òÊǶà¸öÎïÀíµÄOracleÊý¾ÝÎļþ,Êý¾Ý¿âÐÅÏ¢(½á¹¹,Êý¾Ý)µÄÖ÷Òª×÷ÓÃÊÇÀ´±£´æÔÚÕâЩÏà¹ØµÄÊý¾ÝÎļþ,¶øÇÒÖ»ÓÐÕâЩÏà¹ØµÄÎļþOracle²ÅÄܹ»½âÊÍÓë¹ÜÀíÕâЩ´æ´¢.OracleÊý¾ÝÎļþ¾ßÓÐÒÔÏÂһЩÌØÐÔ:
1.Ò»¸öÊý¾ÝÎļþ½ö½ö¹ØÁªÒ»¸öÊý¾Ý¿â,OracleÊý¾ÝÎļþÓëÊý¾Ý¿âÖ®¼ä¶ÔÓ¦¹ØϵÊÇÒ»¶ÔÒ»¹Øϵ,µ±È»· ......
Oracle AWR ½éÉÜ(AWR -- Automatic Workload Repository)
http://blog.csdn.net/tianlesoftware/archive/2009/10/17/4682300.aspx
Ò». ADDM¸ÅÊö
ADDM(Automatic Database Diagnostic Monitor) ÊÇÖ²ÈëOracleÊý¾Ý¿âµÄÒ»¸ö×ÔÕï¶ÏÒýÇæ.ADDM ͨ¹ý¼ì²éºÍ ......
TkprofÊÇÒ»¸öÓÃÓÚ·ÖÎöOracle¸ú×ÙÎļþ²¢ÇÒ²úÉúÒ»¸ö¸ü¼ÓÇåÎúºÏÀíµÄÊä³ö½á¹ûµÄ¿ÉÖ´Ðй¤¾ß¡£Èç¹ûÒ»¸öϵͳµÄÖ´ÐÐЧÂʱȽϵͣ¬Ò»¸ö±È½ÏºÃµÄ·½·¨ÊÇͨ¹ý¸ú×ÙÓû§µÄ»á»°²¢ÇÒʹÓÃTkprof¹¤¾ßʹÓÃÅÅÐò¹¦Äܸñʽ»¯Êä³ö£¬´Ó¶øÕÒ³öÓÐÎÊÌâµÄSQLÓï¾ä¡£
Ò». TKPROF ÃüÁîÓï·¨£º
TKPROF filename1, filename2  ......
³£ÓõÄ:
µ¼³ö
mysqldump -hyour_host -uyour_username -pyour_password database_name > file.sql
µ¼Èë
mysql -hyour_host -uyour_username -pyour_password database_name < file.sql
»òÕßÏÈÓÃmysql¿Í»§¶ËµÇ½ºó£¬
>\. file.sql
Ò²¿ÉÒÔÍê³Éµ¼È빦ÄÜ
ÉÏÃæµÄÁ½¸öÃüÁî½áºÏÆðÀ´Ó㬿ÉÒÔÍê³É½«Ò»¸öÊý¾Ý¿âµÄ ......