ÉÐѧÌÃoracle±Ê¼Ç
µÚÒ»¿Î£º¿Í»§¶Ë
1. Sql Plus(¿Í»§¶Ë£©£¬ÃüÁîÐÐÖ±½ÓÊäÈ룺sqlplus£¬È»ºó°´ÌáʾÊäÈëÓû§Ãû£¬ÃÜÂë¡£
2. ´Ó¿ªÊ¼³ÌÐòÔËÐÐ:sqlplus£¬ÊÇͼÐΰæµÄsqlplus.
3. http://localhost:5560/isqlplus
Toad£º¹ÜÀí£¬ PlSql Developer:
µÚ¶þ¿Î£º¸ü¸ÄÓû§
1. sqlplus sys/bjsxt as sysdba
2. alter user scott account unlock;(½âËø)
µÚÈý¿Î£ºtable structure
1. ÃèÊöijһÕÅ±í£ºdesc ±íÃû
2. select * from ±íÃû
µÚËĿΣºselect Óï¾ä£º
1.¼ÆËãÊý¾Ý¿ÉÒÔÓÃ¿Õ±í£º±ÈÈ磺.select 2*3 from dual
2.select ename,sal*12 annual_sal from emp;Óëselect ename,sal*12 "annual sal" from emp;Çø±ð£¬¼ÓË«ÒýºÅ±£³ÖÔ´óСд¡£²»¼ÓÈ«±ä´óд¡£
3. select ename || "abcd" Èç¹ûÁ¬½Ó×Ö·û´®Öк¬Óе¥ÒýºÅ£¬ÓÃÁ½¸öµ¥ÒýºÅ´úÌæÒ»¸öµ¥ÒýºÅ¡£
µÚÎå¿Î£ºdistinct
select deptno from emp;
select distinct deptno from emp;
select distinct deptno from emp;
select distinct deptno ,job from emp
È¥µôdeptno,jobÁ½Õß×éºÏµÄÖظ´¡£¸ü¶àµÄÏ¾ÍÊÇÕâô¶àÏîµÄ×éºÏµÄ²»Öظ´×éºÏ¡£
µÚÁù¿Î£ºWhere
select * from emp where deptno =10;
select * from emp where deptno <>10;²»µÈÓÚ10
select * from emp where ename ='bike'
Ïà¹ØÎĵµ£º
OracleÊý¾Ý¿âÔÚʹÓùý³ÌÖУ¬Ëæ×ÅÊý¾ÝµÄÔö¼ÓÊý¾Ý¿âÎļþÒ²Öð½¥Ôö¼Ó£¬ÔÚ´ïµ½Ò»¶¨´óСºóÓпÉÄÜ»áÔì³ÉÓ²Å̿ռ䲻×ã;ÄÇôÕâʱÎÒÃÇ¿ÉÒÔ°ÑÊý¾Ý¿âÎļþÒƶ¯µ½ÁíÒ»¸ö´óµÄÓ²ÅÌ·ÖÇøÖС£ÏÂÃæÎÒ¾ÍÒÔOracle for Windows°æ±¾ÖаÑCÅ̵ÄÊý¾Ý¿âÎļþÒƶ¯µ½DÅÌΪÀý½éÉÜOracleÊý¾Ý¿âÎļþÒƶ¯µÄ·½·¨ºÍ²½Öè¡£
¡¡¡¡1.ÔÚsqlplusÖÐÁ¬½Óµ½ÒªÒƶ¯ÎļþµÄOr ......
Óï·¨£º
select *
from ±íÃû
where Ìõ¼þ1
start with Ìõ¼þ2
connect by prior µ±Ç°±í×Ö¶Î=¼¶Áª±í×Ö¶Î
start withÓëconnect by priorÓï¾äÍê³ÉµÝ¹é¼Ç¼£¬ÐγÉÒ»¿ÃÊ÷Ðνṹ£¬Í¨³£¿ÉÒÔÔÚ¾ßÓвã´Î½á¹¹µÄ±íÖÐʹÓá£
start with±íʾ¿ªÊ¼µÄ¼Ç¼
connect by prior Ö¸¶¨Ó뵱ǰ¼Ç¼¹ØÁªÊ±µÄ×ֶιØϵ
´úÂ룺
--´´½¨²¿Ãű ......
Ò»£®Ïà¹ØµÄ¸ÅÄî
RowidµÄ¸ÅÄrowidÊÇÒ»¸öαÁУ¬¼ÈÈ»ÊÇαÁУ¬ÄÇôÕâ¸öÁоͲ»ÊÇÓû§¶¨Ò壬¶øÊÇϵͳ×Ô¼º¸ø¼ÓÉϵġ£¶Ôÿ¸ö±í¶¼ÓÐÒ»¸örowidµÄαÁУ¬µ«ÊÇ
±íÖв¢²»ÎïÀí´æ´¢ROWIDÁеÄÖµ¡£²»¹ýÄã¿ÉÒÔÏñʹÓÃÆäËüÁÐÄÇÑùʹÓÃËü£¬µ«ÊDz»ÄÜɾ³ý¸ÄÁУ¬Ò²²»ÄܶԸÃÁеÄÖµ½øÐÐÐ޸ġ¢²åÈë¡£Ò»µ©Ò»ÐÐÊý¾Ý²åÈëÊý¾Ý¿â£¬Ôò
rowidÔÚ¸ÃÐ ......
ÉùÃ÷£ºÒÔÏÂÄÚÈÝת×Ô http://www.weixiuwang.com/Article/server/tech/200610/22126.html
1. ²éѯÕýÔÚÖ´ÐÐÓï¾äµÄÖ´Ðмƻ®(Ò²¾ÍÊÇʵ¼ÊÓï¾äÖ´Ðмƻ®)
select * from v$sql_plan where hash_value = (select sql_hash_value from v$session where sid = 1111);
ÆäÖÐidºÍparent_id±íʾ ......
½ñÌìÔÚ¶Ô±í´´½¨ÊÓͼµÄʱºò£¬Óû§Ìáʾ ORA-01031Óû§È¨ÏÞ²»×ã
ʹÓÃsystemÓû§¶ÔÆä·ÖÅädbaµÈȨÏÞ£¬ÒÀÈ»ÎÞ·¨´´½¨ÊÓͼ¡£
¼ÌÐø¸³ÓèȨÏÞ
grant select any table to AAA;
ÊÚÓèÓû§Ñ¯ËùÓбíµÄȨÏÞ
grant select any dictionary to AAA;
ÔÙ´ÎÊÚÈ¡Óû§selectÈκÎ×ÖµäµÄȨÏÞ
......