OracleÖÐSQL PLUSµÄ³£ÓÃÖ¸Áî
½øÈësql*plusÐèÒªÊäÈëÓû§Ãû¡¢¿ÚÁîºÍÖ÷»ú±êÖ¾·û
system/manager
sys/change_on_intall
scott/tiger
internal/oracle
ÒÔÉÏΪ³õʼÃÜÂë
Ö÷»ú×Ö·û´®¿Õ»òÕßÊÇ@+ÄãµÄ·þÎñÃû,ÔÚ±¾µØµÇ½²»ÐèÒª±¾µØ·þÎñÃû¡£
ÏÂÃæ¾Í½éÉÜÒ»ÏÂһЩ³£ÓõÄsql*plusÃüÁ
Ê×ÏȲ鿴µ±Ç°Ê¹ÓõÄÊý¾Ý¿âʵÀý:
select name from V$database;
Çл»Á½¸öÊý¾Ý¿âʵÀý
ÔÚsqlplusÀïconnect username/password@sid
»òhost set ORACLE_SID=sid
»òcmdÀïset ORACLE_SID=sid
»òÐÞ¸Ä×¢²á±íÀïORACLE_SIDÏî
¡ô1. Ö´ÐÐÒ»¸öSQL½Å±¾Îļþ
SQL>start file_name
SQL>@ file_name
ÎÒÃÇ¿ÉÒÔ½«¶àÌõsqlÓï¾ä±£´æÔÚÒ»¸öÎı¾ÎļþÖУ¬ÕâÑùµ±ÒªÖ´ÐÐÕâ¸öÎļþÖеÄËùÓеÄsqlÓï¾äʱ£¬ÓÃÉÏÃæµÄÈÎÒ»ÃüÁî¼´¿É£¬ÕâÀàËÆÓÚdosÖеÄÅú´¦Àí¡£
¡ô2. ¶Ôµ±Ç°µÄÊäÈë½øÐбà¼
SQL>edit
¡ô3. ÖØÐÂÔËÐÐÉÏÒ»´ÎÔËÐеÄsqlÓï¾ä
SQL>/
¡ô4. ½«ÏÔʾµÄÄÚÈÝÊä³öµ½Ö¸¶¨Îļþ
SQL> SPOOL file_name
ÔÚÆÁÄ»ÉϵÄËùÓÐÄÚÈݶ¼°üº¬ÔÚ¸ÃÎļþÖУ¬°üÀ¨ÄãÊäÈëµÄsqlÓï¾ä¡£
¡ô5. ¹Ø±ÕspoolÊä³ö
SQL> SPOOL OFF
Ö»ÓйرÕspoolÊä³ö£¬²Å»áÔÚÊä³öÎļþÖп´µ½Êä³öµÄÄÚÈÝ¡£
¡ô6£®ÏÔʾһ¸ö±íµÄ½á¹¹
SQL> desc table_name
¡ô7. COLÃüÁ
Ö÷Òª¸ñʽ»¯ÁеÄÏÔʾÐÎʽ¡£
¸ÃÃüÁîÓÐÐí¶àÑ¡Ï¾ßÌåÈçÏ£º
COL[UMN] [{ column|expr} [ option ...]]
OptionÑ¡Ïî¿ÉÒÔÊÇÈçϵÄ×Ó¾ä:
ALI[AS] alias
CLE[AR]
FOLD_A[FTER]
FOLD_B[EFORE]
FOR[MAT] format
HEA[DING] text
JUS[TIFY] {L[EFT]|C[ENTER]|C[ENTRE]|R[IGHT]}
LIKE { expr|alias}
NEWL[INE]
NEW_V[ALUE] variable
NOPRI[NT]|PRI[NT]
NUL[L] text
OLD_V[ALUE] variable
ON|OFF
WRA[PPED]|WOR[D_WRAPPED]|TRU[NCATED]
1). ¸Ä±äȱʡµÄÁбêÌâ
COLUMN column_name HEADING column_heading
For example:
Sql>select * from dept;
DEPTNO DNAME LOC
---------- ---------------------------- ---------
10 ACCOUNTING NEW YORK
sql>col LOC heading location
sql>select * from dept;
DEPTNO DNAME location
--------- ---------------------------- -----------
10 ACCOUNTING NEW YORK
2). ½«ÁÐÃûENAME¸ÄΪÐÂÁÐÃûEMPLOYEE NAME²¢½«ÐÂÁÐÃû·ÅÔÚÁ½ÐÐÉÏ£º
Sql>select * from emp
Department name Salary
---------- ---------- ----------
10 aaa 11
SQL> COLUMN ENAME HEADING ’Employee|Name’
Sql>select * from
Ïà¹ØÎĵµ£º
Oracle´æ´¢¹ý³Ì°üº¬Èý²¿·Ö£º¹ý³ÌÉùÃ÷£¬Ö´Ðйý³Ì²¿·Ö£¬´æ´¢¹ý³ÌÒì³£¡£
Oracle´æ´¢¹ý³Ì¿ÉÒÔÓÐÎÞ²ÎÊý´æ´¢¹ý³ÌºÍ´ø²ÎÊý´æ´¢¹ý³Ì¡£
Ò»¡¢Î޲γÌÐò¹ý³ÌÓï·¨
1 create or replace procedure NoParPro
2 as ;
3 begin
4 ;
5 exception &nb ......
Ê×ÏÈдºÃ½¨¿â½Å±¾c.sql
¡¡¡¡
¡¡¡¡create database mydb
¡¡¡¡controlfile reuse
¡¡¡¡maxinstances 1
¡¡¡¡maxloghistory 1
¡¡¡¡maxlogfiles 5
¡¡¡¡maxlogmembers 5
¡¡¡¡maxdatafiles 100
¡¡¡¡datafile '$ORACLE_HOME/oradata/system01.dbf'size 325M reuse
¡¡¡¡autoextend on next 10240K maxsize unlimited
¡¡¡¡u ......
Oracle10GµÄEM²ÉÓÃÁËweb·½Ê½£¬²¢ÇÒ·Ö³ÉÁË2¸ö²úÆ·£¬database controlºÍgrid control¡£ÕâÀïÖ÷Òª½éÉÜÈçºÎ´´½¨µ¥Êý¾ÝµÄdbcontrol¡£Grid controlÐèÒªÏÂÔص¥¶ÀµÄ¹âÅÌ°²×°¡£
ÔÚÓÃDBCA½¨¿âµÄʱºò£¬¿ÉÒÔÑ¡ÔñÊÇ·ñÆôÓÃdbcontrol£¬ÆôÓõĻ°ÐèÒªÔÚ
Êý¾Ý¿â
Öн¨Á¢Ò»¸ösysmanµÄschema£¬ÓÃÓÚ±£´æEMµÄһЩÊý¾Ý£¬Õâ¸ö¾ÍÊÇEMµÄ×ÊÁÏ¿â(reposi ......
.errInfo
{
border:solid 1px #d00;
background:#F7F0F7;
}
1.URLµØÖ··À×¢È룺
//¹ýÂËURL·Ç·¨SQL×Ö·û
var sUrl=location.search.toLowerCase();
var sQuery=sUrl.substring(sUrl.indexOf("=")+1);
re=/select|update|delete|truncate|join|union|exec|insert|drop|count|&r ......
--¾ÛºÏº¯Êý
use pubs
go
select avg(distinct price) --Ëãƽ¾ùÊý
from titles
where type='business'
go
use pubs
go
select max(ytd_sales) --×î´óÊý
from titles
go
use pubs
go
select min(ytd_sales) --×îÐ¡Ê ......