oracle¶¨Ê±±¸·Ý
δʵÑé
ORACLEÊý¾Ý¿â×Ô´øµÄDBMS_JOB¹¦ÄÜ¿ÉÒÔʵÏÖ¶¨Ê±Ö´ÐÐPL/SQLµÄ´æ´¢¹ý³Ì£¬µ«ÊÇÈç¹ûSQLÓï¾äºÜ¸´ÔÓ£¬
SQLÓï¾äºÜ¶à£¬ÒÔ¼°¾³£Òª¸Ä±äSQLÓï¾äµÄд·¨£¬ÓÃдPL/SQL´æ´¢¹ý³ÌµÄ·½·¨ÔÙ¶¨Ê±Ö´Ðлá±È½Ï·±Ëö¡£ºÎ
¿ö»¹ÓÐһЩUNIXϵͳ¹ÜÀíÔ±²»»áдPL/SQL´æ´¢¹ý³Ì£¬ËùÒÔÎÒ½éÉÜÒ»¸ö¼òµ¥µÄshell³ÌÐò¿ÉÒÔÔÚ°²×°ÁË
ORACLE SERVER»òCLIENTµÄUNIX»úÆ÷ÉÏʵÏÖ¶¨Ê±Ö´ÐÐÒ»¸ö*.sqlÎļþ¡£
Ê×ÏÈÎÒÃÇÔÚ°²×°ÁËORACLE SERVER»òCLIENTµÄUNIX»úÆ÷ÉÏÁ¬½ÓÄ¿µÄÊý¾Ý¿â:
$sqlplus username/password@servie_name
Èç¹ûÄܹ»³É¹¦½øÈë
SQL>;
״̬,²¢Ö´Ðмòµ¥µÄSQLÓï¾ä
SQL>; SELECT SYSDATE from DUAL;
±íÃ÷Á¬½Ó³É¹¦¡£
·ñÔò¼ì²é/$ORACLE_HOME/network/admin/tnsnames.ora Àïservie_nameÊÇ·ñÕýÈ·¶¨Òå
/etc/hostname ÀïÊÇ·ñ°üº¬Ä¿µÄÊý¾Ý¿âµÄÖ÷»úÃû
µÈµÈ......(ÆäËüµÄÍøÂç¼ì²é¾Í²»ÔÚÕâÀïÏêϸÁоÙÁË)
½Ó×ÅÔÚscottÓû§ÏÂÔËÐвâÊÔµÄSQLÓï¾ä:scott_select.sql
SQL>; SELECT D.DNAME,E.ENAME,E.JOB,E.HIREDATE
from EMP E,DEPT D
WHERE TO_CHAR(E.HIREDATE,'YYYY')='1981' AND E.DEPTNO=D.DEPTNO;
È»ºóÔÚĿ¼/oracle_backup/
Ïà¹ØÎĵµ£º
Oracle
ÖеÄÈÕÆÚÀàÐͼ°ÆäÏà¹ØµÄº¯Êý
Oracle
ÌṩÁ˺ܶàµÄÄÚÖõÄÈÕÆÚÀàÐÍ£¬°üÀ¨Èçϼ¸ÖÖ£º
Date
Timestamp
Timestamp With Time Zone
Timestamp With Local Time Zone
Interval Year To Month
Interval Day To Second
DateÀàÐÍÓÃÓÚ´æ´¢ÈÕÆÚ£¬¾«È·µ½Ã룬¿ÉÄÜͨ¹ýÉèÖÃNLS_DATE_FORMAT»òÕßTO_CHAR·½·¨À´¸ñʽ»¯ÈÕÆÚµÄÊ ......
Ò»£®ÒýÑÔ
ORACLE
Êý¾Ý¿â×Ö·û¼¯£¬¼´Oracle
È«Çò»¯Ö§³Ö(Globalization Support)
£¬»ò¼´¹ú¼ÒÓïÑÔÖ§³Ö£¨NLS
£©Æä×÷ÓÃÊÇÓñ¾¹úÓïÑԺ͸ñʽÀ´´æ´¢¡¢´¦ÀíºÍ¼ìË÷Êý¾Ý¡£ÀûÓÃÈ«Çò»¯Ö§³Ö£¬ORACLE
ΪÓû§Ìṩ×Ô¼ºÊìϤµÄÊý¾Ý¿âĸÓï»·¾³£¬ÖîÈçÈÕÆÚ¸ñʽ¡¢Êý×Ö¸ñʽºÍ´æ´¢ÐòÁеȡ£Oracle
¿ÉÒÔÖ§³Ö¶àÖÖÓïÑÔ¼°×Ö·û¼ ......
ORACLE ÈçºÎ²úÉúÒ»¸öËæ»úÊý:DBMS_RANDOM
--1¡¢Ð¡Êý( 0 ~ 1)
select dbms_random.value from dual ;
--2¡¢Ö¸¶¨·¶Î§ÄÚµÄСÊý ( 0 ~ 100 )
select dbms_random.value(0,100) from dual ;
--3¡¢Ö¸¶¨·¶Î§ÄÚµÄÕûÊý ( 0 ~ 100 )
select trunc(d ......
1.¼à¿ØÊÂÀýµÄµÈ´ý£º
select event,sum(decode(wait_time,0,0,1)) prev, sum(decode(wait_time,0,1,0)) curr,count(*)
from v$session_wait
group by event order by 4;
2.»Ø¹ö¶ÎµÄÕùÓÃÇé¿ö£º
select name,waits,gets,waits/gets ratio from v$rollstat a,v$rollnam ......
ÏȽ¨ÁËÕŲâÊÔ±í
SQL> select * from test_a;
ID PLAYNAME SCORE
-------------------- --- ......