OracleÖÐÖ»¸üÐÂÁ½Õűí¶ÔÓ¦Êý¾ÝµÄ·½·¨
OracleÖÐÖ»¸üÐÂÁ½Õűí¶ÔÓ¦Êý¾ÝµÄ·½·¨
ÏȽ¨Á¢Ò»¸ö½á¹¹Ò»Ä£Ò»ÑùµÄ±íemp1£¬²¢ÎªÆä²åÈ벿·ÖÊý¾Ý
create table emp1
as
select * from emp where deptno = 20;
updateµôemp1ÖеIJ¿·ÖÊý¾Ý
update emp1
set sal = sal + 100,
comm = nvl(comm,0) + 50
È»ºóÎÒÃÇÊÔ×ÅʹÓÃemp1ÖÐÊý¾ÝÀ´¸üÐÂempÖÐsal ºÍ commÕâÁ½ÁÐÊý¾Ý¡£
ÎÒÃÇ¿ÉÒÔÕâôд
Update emp
Set(sal,comm) = (select sal,comm. from emp1 where emp.empno = emp1.empno)
Where exists (select 1 from emp1 where emp1.empno = emp.empno)
ÇëÄãÓÈÆä×¢ÒâÕâÀïµÄwhere×Ӿ䣬Äã¿ÉÒÔ³¢ÊÔ²»Ð´where×Ó¾äÀ´Ö´ÐÐÒÔÏÂÕâ¾ä»°£¬Ä㽫»áʹµÃempÖеĺܶàÖµ±ä³É¿Õ¡£
ÕâÊÇÒòΪÔÚoracleµÄupdateÓï¾äÖÐÈç¹û²»Ð´where×Ó¾ä,oracle½«»áĬÈϵİÑËùÓеÄֵȫ²¿¸üУ¬¼´Ê¹ÄãÕâÀïʹÓÃÁË×Ó²éѯ²¢ÇÒijÔÚÖµ²¢²»ÄÜÔÚ×Ó²éѯÀïÕÒµ½£¬Äã¾Í»áÏ뵱ȻµÄÒÔΪ,oracle»òÐí½«»áÌø¹ýÕâЩֵ°É£¬Äã´íÁË£¬oracle½«»á°Ñ¸ÃÐеÄÖµ¸üÐÂΪ¿Õ¡£
ÎÒÃÇ»¹»¹¿ÉÒÔÕâôд£º
update (select a.sal asal,b.sal bsal,a.comm acomm,
b.comm bcomm from emp a,emp1 b where a.empno = b.empno)
set asal = bsal,
acomm = bcomm;
ÕâÀïµÄ±íÊÇÒ»¸öÀàÊÓͼ¡£µ±È»ÄãÖ´ÐÐʱ¿ÉÄÜ»áÓöµ½ÈçÏ´íÎó:
ERROR λÓÚµÚ 2 ÐÐ:
ORA-01779: ÎÞ·¨ÐÞ¸ÄÓë·Ç¼üÖµ±£´æ±í¶ÔÓ¦µÄÁÐ
ÕâÊÇÒòΪн¨µÄ±íemp1»¹Ã»ÓÐÖ÷¼üµÄÔµ¹Ê
ÏÂÃæÔö¼ÓÒ»¸öÖ÷¼ü
alter table emp1 add constraint pk_emp1 primary key (empno);
Ö´ÐÐÖ®ºó
ÔÚÖ´ÐÐÇ°ÃæµÄÓï¾ä¾ÍÄܳɹ¦¡£
ÕâÀïÎÒÃÇ×ܽáһϣº
ÔÚoracleÖв»´æÔÚupdate from½á¹¹£¬ËùÒÔÓöµ½ÐèÒª´ÓÁíÍâÒ»¸ö±íÀ´¸üб¾±íµÄÖµµÄÎÊÌâµÄʱºò£¬ÓÐÁ½ÖÖ½â¾öµÄ°ì·¨:
Ò»ÖÖÊÇʹÓÃ×Ó²éѯ£¬Ê¹ÓÃ×Ó²éѯʱһ¶¨Òª×¢ÒâwhereÌõ¼þ(Ò»°ãºóÃæ½Óexists×Ó¾ä)£¬³ý·ÇÁ½¸ö±íÊÇÒ»Ò»¶ÔÓ¦µÄ£¬·ñÔòwhereÌõ¼þ±Ø²»¿ÉÉÙ£¬ÒÅ©µôwhereÌõ¼þʱ¿ÉÄܻᵼÖ²åÈë´óÁ¿¿ÕÖµ¡£
ÁíÍâÒ»ÖÖÊÇÀàÊÓͼµÄ¸üз½·¨£¬ÕâÒ²ÊÇoracleËù¶ÀÓеġ£ÏȰѶÔÓ¦µÄÊý¾ÝÈ«²¿³éÈ¡³öÀ´£¬È»ºó¸üбíÒ»Ñù¸üÐÂÊý¾Ý£¬ÕâÀïÐèҪעÒâµÄÊÇ£¬±ØÐë±£Ö¤±íµÄÊý¾ÝΨһÐÍ¡£
Ïà¹ØÎĵµ£º
´¦Àí·½·¨Ò» £º
¼ì²éÄǸö±í±»Ëø
select sess.sid,sess.serial#, lo.oracle_username,lo.os_user_name,ao.object_name,lo.locked_mode
from v$locked_object lo,dba_objects ao,v$session sess
where ao.object_id = lo.object_id
and lo.session_id = sess.sid;
½âËø
alter system kill session '273,45';
´¦Àí·½·¨¶ ......
¼ì²âËø£º
SELECT A.OWNER,
A.OBJECT_NAME,
B.XIDUSN,
B.XIDSLOT,
B.XIDSQN,
B.SESSION_ID,
B.ORACLE_USERNAME,
B.OS_USER_NAME,
B.PROCESS,
B.LOCKED_MODE,
C.MACHINE,
C.STATUS,
C.SERVER,
C.SID,
C.SERIAL#,
C.PROGRAM
from ALL_OBJECTS A,
V$LOCKED_OBJECT B,
SYS.GV_$SESSION C
WHERE ( A.OBJE ......
×î½ü×öÁËÒ»¸öÊý¾ÝÕï¶ÏµÄÏîÄ¿£¬ÀïÃæ×Ô¼ºÐ´ÁËÒ»¸öÊý¾Ý¿âµÄ²Ù×÷À࣬°üº¬£ºÁ¬½ÓÊý¾Ý¿â¡¢¶ÁÊý¾Ý±í¡¢Ö´ÐÐSQL²Ù×÷£¬ÊÍ·ÅÊý¾Ý¿âµÈ×é³É£¬Ï£Íû¶Ô´ó¼ÒÓÐÓã¬ÓÉÓÚˮƽÓÐÏÞ£¬ÈôÓдíÎó»òÕß´úÂë²»×ãµØ·½»¶ÓÖ¸Õý£¬Ð»Ð»¡£
ADOOperate.H
//////////////////////////////////////////////////////////////////////
// ......
×î½üÓöµ½ÔÚwindows 2008ÏÂIEÆäËüµÄÍøÒ³¶¼¿ÉÒÔ·ÃÎÊ,ΨÓÐoracle.com²»ÄÜ·ÃÎÊ,ÕæÓôÃÆÁË,ºóÀ´ÕÒÒ»´úÀí,·ÃÎÊËٶȻ¹¿ÉÒÔ,ÅäÖÃÈçÏÂ:
Õâ¸ö´úÀíµÚÒ»´Î·ÃÎʵĻ°£¬ÐèÒªÌøµ½ËûµÄÖ÷Ò³£¬¹ý¸öÊ®¼¸ÃëÖоͿÉÒÔÌøתµ½OracleµÄ¹Ù·½ÍøÕ¾ÁË¡£
—————————————&md ......
http://www.oracle.com/technology/global/cn/obe/2day_dba/index.html
¿Î³ÌÁбí
1
¹ÜÀíÊý¾Ý¿âµÄÒªËØÊÇʲô£¨Ã»Óб¾Õ¶ÔÓ¦µÄ¸½¼Ó×ÊÁÏ£©
2
°²×° Oracle ºÍ¹¹½¨Êý¾Ý¿â
3
Oracle Enterprise Manager Êý¾Ý¿â¿ØÖÆÈëÃÅ
4
ÅäÖÃÍøÂç»·¾³
5
¹ÜÀí Oracle Àý³Ì
6
¹ÜÀíÊý¾Ý¿â´æ´¢½á¹¹
7
¹ÜÀíÓû§ºÍ°²È«ÐÔ
8
¹ÜÀíģʽ¶ ......