oracle ±Ê¼Ç
1. SQL Óï¾äÓëSQL*Plus ÃüÁî
SQL
SQL*Plus
Ò»ÖÖÓïÑÔ
Ò»ÖÖ»·¾³
ANSI±ê×¼
Oracle µÄÌØÐÔÖ®Ò»
¹Ø¼ü×Ö²»ÄÜËõд
¹Ø¼ü×Ö¿ÉÒÔËõд
ʹÓÃÓï¾ä¿ØÖÆÊý¾Ý¿âÖеıíµÄ¶¨ÒåÐÅÏ¢
ºÍ±íÖеÄÊý¾Ý
ÃüÁî²»ÄܸıäÊý¾Ý¿âÖеÄÊý¾ÝµÄÖµ
¼¯ÖÐÔËÐÐ
2.ÒÔϼ¸¸ö²éѯºÜÖØÒª£¬×ÐϸÌå»á
1 (ÓÐÔ±¹¤µÄ³ÇÊÐ)¸÷¸ö³ÇÊеÄƽ¾ù¹¤×Ê
select city,avg(salary) from employees e,departments d locations l
where e.department_id = d.department_id and d.location_id = l.location_id group by city;
2 ²éѯÄÄЩ³ÇÊÐÓÐÔ±¹¤£¬ÄÄЩ³ÇÊÐûÓÐÔ±¹¤
select city from employees e,departments d,locations l
where e.department_id = d.department_id and d.location_id = l.location_id
group by city having count(employee_id) > 0
1)×麯Êý²»ÄÜ·ÅÔÚ where×Ó¾äÖУ¬ ÐèÒª·ÅÔÚ having ×Ó¾äÖÐ
2) Ðè°´ city ½øÐзÖ×é
3 manager ÖÐ×î¸ß¹¤×ÊÊÇË manager ÖÐ×îµÍ¹¤×ÊÊǶàÉÙ manager ÖÐƽ¾ù¹¤×ÊÊǶàÉÙ
Ê×ÏÈҪȷ¶¨ÄÄЩÈËÊÇmanager
¹«Ë¾ÓÐÄÄЩÈËÊÇ manager :
·½°¸1
select distinct m.employee_id,m.last_name from employees e,employees m
where e.manager_id = m_employee_id order by m.employee_id
·½°¸2
select distinct manager_id from employees where manager_id is not null order by manager_id
ƽ¾ù¹¤×Ê:
select avg(m.salary) from employees e,employees m
where e.manager_id = m.employee_id order by m.employee_id
×î¸ß¹¤×Ê:
/*
select max(m.salary) from employees e,employees m
where e.manager_id= m.employee_id order by m.employee_id
*/
¿ÉÒÔÓÃ×Ó²éѯ
select last_name,salary from employees where salary =
(select max(m.salary) from employees e,employees m where e.manager_id = m.employee_id )
order by employee_id
5. Ñ¡ÔñËùÓÐÔ±¹¤µÄÐÕÃû£¬Ô±¹¤ºÅ£¬ÒÔ¼°ËûµÄ¹ÜÀíÕßµÄÐÕÃûºÍÔ±¹¤ºÅ£¬½á¹ûÀàËÆÓÚÏÂÃæµÄ¸ñʽ
--------------------
Ïà¹ØÎĵµ£º
¹ØÓÚ´æ´¢¹ý³ÌºÍº¯ÊýµÄ¶¨ÒåÍøÉÏÒ»ËÑÒ»´ó°Ñ£¬ÕâÀï¾Í²»ÌØÊâ½éÉÜÁË£¬ÕâÀï¾ÍÖ»¶ÔÎÒ×Ô¼ºÐ´µÄ¼¸ÖÖ¸ñʽµÄ´æ´¢¹ý³ÌºÍº¯Êý×öһЩ×ܽᣬϣÍû¶Ô´ó¼ÒÓеã°ïÖú¡£
Ò»£º´æ´¢¹ý³Ì
1£º×îÆÕͨµÄÒ»ÖÖ¡££¨´«²Î£¬²éѯÓαִ꣬ÐУ¬Ñ»·Óαê×ö²åÈ붯×÷£©¡£
create or replace procedure zy2040_sirole(rolekey in varchar2) ......
ÍêȫжÔØOracle·½·¨£º
Èí¼þ»·¾³£º
1¡¢Windows XP + Oracle 10g
2¡¢Oracle°²×°Â·¾¶Îª£ºd:\Oracle
1¡¢Èç¹ûÊý¾Ý¿âÅäÖÃÁË×Ô¶¯´æ´¢¹ÜÀí(ASM),Ó¦¸ÃÏÈɾ³ý¾Û¼¯Í¬²½·þÎñCSS£¨cluster Synchronization Services).ɾ³ýCSS·þÎñµÄ·½·¨ÊÇÔÚDOSÃüÁîÐÐÖÐÖ´ÐÐÈçÏÂÃüÁ localconfig delete
2¡¢ÔÚ“·þÎñ”´°¿ÚÖÐÍ£ ......
ImpºÍExp
ÃüÁîÏê½â:
Exp
µ¼³ö
ģʽ:
Fullģʽ---µ¼³ö
Õû¸öÊý¾Ý¿â
Userģʽ---µ¼³ö
Ö¸¶¨µÄÓû§
Tableģʽ—µ¼³ö
Ö¸¶¨µÄ±í
Tablespaceģʽ—µ¼³ö
±í
¿Õ¼ä
Exp
µ¼³ö
²ÎÊý:
OWNERÖ¸¶¨Òªµ¼³ö
µÄÓû§Áбí
FULL=y±íʾҪµ¼³ö
Õû¸öÊý¾Ý¿â
TablesÖ¸¶¨Òªµ¼³ö
µÄ±í
TablepacesÖ¸¶¨Òªµ¼³ö
µÄ±í
......
¡¡¡¡oracle% sqlplus /nolog
¡¡¡¡SQL> conn / as sysdba
¡¡¡¡Êý¾Ý¿âµÄÎïÀíÎļþ
¡¡¡¡Êý¾ÝÎļþ
¡¡¡¡select file_name from dba_data_files;
¡¡¡¡¿ØÖÆÎļþ
¡¡¡¡select name from v$controlfile;
¡¡¡¡ÈÕÖ¾Îļþ
¡¡¡¡select member from v$logfile;
¡¡¡¡---------------------------------------------------------
......
ORACLE 10GµÄ¼¯ºÏAPI
¼¯ºÏAPI·½·¨×îÔçÊÇÔÚORACLE 8IÖÐÒýÈëµÄ¡£¼¯ºÏAPIÌṩÁ˼ò»¯·ÃÎʼ¯ºÏµÄ·½·¨¡£ÔÚORACLE 10GÒÔÇ°£¬ÕâЩ·½·¨È·Êµ¼ò»¯Á˶Լ¯ºÏµÄ·ÃÎÊ¡£µ«ÊÇ£¬²¢²»ÊÇ·ÇÒªÇóÕÆÎÕÕâЩ·½·¨²»¿É¡£´ÓORACLE 9IµÄINDEX-BY±íµ½ORACLE 10GµÄÁªºÏÊý×éµÄת»»£¬Ê¹ËüÃdzÉΪ±ØÐëÕÆÎյķ½·¨¡£
ÏÂÃæÊÇÎÒ´ÓÊéÉÏժ¼ÏµÄһР......