OracleÊý¾Ý¿âSQL*plus³£ÓõÄÃüÁîºÍº¯Êý
OracleÖг£ÓõÄÃüÁîºÍº¯Êý£¬×ö¸öÕûÀí£¬ÒÔ±¸ÒÔºóÓõ½£¬·½±ã²éÔÄ¡£
³£ÓÃÃüÁ
Á¬½Ósqlplus
ÃüÁîÐÐÏÂÔËÐÐcmd½øÈ룬ÈçÒÔsysģʽµÇ½£¬ÃüÁîÈçÏ£º
(1).sqlplus "sys/zhb126 as sysdba"
(2).sqlplus/nolog connect sys/zhb126 as sysdba
(3).sqlplus scott/tiger
Æô¶¯Êý¾Ý¿âʵÀý
startup --Æô¶¯Êý¾Ý¿âµÄͬʱÆô¶¯¿ØÖÆÎļþ¡¢Êý¾ÝÎļþ
startup mount --Æô¶¯Êý¾Ý¿âµÄͬʱÆô¶¯¿ØÖÆÎļþ¡¢²»Æô¶¯Êý¾ÝÎļþ
startup nomount --½öÆô¶¯Êý¾Ý¿âʵÀý£¬ÓÃÓÚ¿ØÖÆÎļþ¶ªÊ§Çé¿ö£¬´Ëʱ¿ØÖÆÎļþÎÞ·¨Æô¶¯
¹Ø±ÕÊý¾Ý¿âʵÀý
shutdown --Õý³£¹Ø±Õ£¨µÈ´ýËùÓÐÓû§¶Ï¿ªÁ¬½Óºó²ÅÄܹرգ©
shutdown immediate--½¨ÒéʹÓã¨ÆÈʹÓû§Ö´Ðе±Ç°SQLºóÁ¢¼´¶Ï¿ªÁ¬½Ó£©
shutdown transactional--£¨ÆÈʹÔÚµ±Ç°Óû§Ö´ÐÐÍêºóÁ¢¼´¶Ï¿ªÁ¬½Ó£©
shutdown abort--Ç¿Öƹرգ¨Ààdb2µÄdb2 stop force£©
²é¿´ÈÕÖ¾¹éµµ·½Ê½--ÓÃstartup mountÆô¶¯Êý¾Ý¿â
archive log list
ALTER DATABASE archivelog
ALTER DATABASE OPEN
²é¿´sqlplusÖ§³ÖµÄÃüÁî
help INDEX
½â³ýÓû§Ëø
ÒÔ°²×°oracleʱµÚÒ»²½ÉèÖõÄÓû§¿ÚÁîµÇ½£¨È磺sqlplus "sys/zhb126 as sysdba"£©ºóÖ´ÐÐ
alter user scott account unlock;
È»ºóÖ´ÐÐsqlplus scott/tiger£¬´Ëʱ»áÒªÇóÄãÐÞ¸ÄscottµÄпÚÁî¡£
ÉèÖÃÃüÁîÐÐÖ§³Ö¿Õ¸ñ
set sqlblanklines on
±äÁ¿Ìæ´ú--±äÁ¿Ìæ»»£¬Õâ¸ö¹ý³ÌÖ»°²ÅÅÒ»¸öÖ´Ðмƻ®£¬¿ÉÌá¸ßÖ´ÐÐЧÂÊ
SQL> select * from dept where deptno = &t;
ÊäÈë t µÄÖµ: 10
ÔÖµ 1: select * from dept where deptno = &t
ÐÂÖµ 1: select * from dept where deptno = 10
²é¿´»º³åÆ÷Ö´ÐйýµÄÃüÁî (list/l)
SQL> l
1* select * from dept where deptno = &t
SQL> l1
1* select * from dept where deptno = &t
»º³åÇøÎļþµÄ±£³Ö¡¢Ö´ÐÐ
SQL> save d:\test.sql --±£´æ»º³åÇøÎļþµ½Ö¸¶¨ÎļþÖÐ
ÒÑ´´½¨ file d:\test.sql
SQL> @d:\test.sql --Ö´Ðб£´æÎļþµÄSQL
²é¿´±í½
Ïà¹ØÎĵµ£º
oracle±í¿Õ¼ä²Ù×÷Ïê½â
1
2
3×÷Õߣº À´Ô´£º ¸üÐÂÈÕÆÚ£º2006-01-04
5
6
7½¨Á¢±í¿Õ¼ä
8
9CREATE TABLESPACE data01
10DATAFILE '/ora ......
1.OracleÔõÑù´æ´¢Îı¾
CHARºÍVARCHAR2µÄÇø±ð
•CHAR¶¨³¤×Ö·û´®£¬VARCHAR2±ä³¤×Ö·û´®¡£
•CHAR(n) ¶¨³¤×Ö·û´®£¬n×Ö½Ú£¬nµÄÈ¡Öµ·¶Î§£º1~2000×Ö½Ú¡£
•VARCHAR2(n) ¿É±ä³¤µÄ×Ö·û´®£¬¶¨ÒåʱӦָÃ÷×î´ó³¤¶È£¬È¡Öµ·¶Î§£º1~ 4000×Ö½Ú¡£
2. OracleÔõÑù´æ´¢ÊýÖµ
ÊýÖµÀàÐÍ˵Ã÷£º NUMBER£¨m , n£©
Êý×Ö ......
DBOÊÇÿ¸öÊý¾Ý¿âµÄĬÈÏÓû§£¬¾ßÓÐËùÓÐÕßȨÏÞ£¬¼´DbOwner
ͨ¹ýÓÃDBO×÷ΪËùÓÐÕßÀ´¶¨Òå¶ÔÏó£¬Äܹ»Ê¹Êý¾Ý¿âÖеÄÈκÎÓû§ÒýÓöø²»±ØÌṩËùÓÐÕßÃû³Æ¡£
±ÈÈ磺ÄãÒÔUser1µÇ¼½øÈ¥²¢½¨±íTable£¬¶øδָ¶¨DBO£¬
µ±Óû§User2µÇ½øÈ¥Ïë·ÃÎÊTableʱ¾ÍµÃÖªµÀÕâ¸öTableÊÇÄãUser1½¨Á¢µÄ£¬ÒªÐ´ÉÏUser1.Table£¬Èç¹ûËû²»ÖªµÀÊÇÄ㽨µÄ£¬Ôò·ÃÎÊ» ......
ÎÊ£ºÔõÑùÔÚÒ»¸öUPDATEÓï¾äÖÐʹÓñíBµÄÈý¸öÁиüбíAÖеÄÈý¸öÁУ¿
¡¡¡¡´ð£º¶ÔÕâ¸öÎÊÌ⣬Äú¿ÉÒÔʹÓÃÇ¿´óµÄ¹Øϵ´úÊý¡£±¾Ò³ÖеĴúÂë˵Ã÷ÁËÈçºÎ×éºÏʹÓÃfrom×Ó¾äºÍJOIN²Ù×÷£¬ÒÔ´ïµ½ÓÃÆäËû±íÖÐÊý¾Ý¸üÐÂÖ¸¶¨ÁеÄÄ¿µÄ¡£ÔÚÉè¼Æ¹Øϵ±í´ïʽʱ£¬ÄúÐèÒª¾ö¶¨ÊÇ·ñÐèÒªµ¥Ò»ÐÐÆ¥Åä¶à¸öÐУ¨Ò»¶Ô¶à¹Øϵ£©£¬»òÕßÐèÒª¶à¸öÐÐÆ¥Åä±»Áª½Ó±íÖеĵ¥Ò» ......