Oracleɾ³ýÖظ´Êý¾Ý
ÔÚ¶ÔÊý¾Ý¿â½øÐвÙ×÷¹ý³ÌÖÐÎÒÃÇ¿ÉÄÜ»áÓöµ½ÕâÖÖÇé¿ö£¬±íÖеÄÊý¾Ý¿ÉÄÜÖظ´³öÏÖ£¬Ê¹ÎÒÃǶÔÊý¾Ý¿âµÄ²Ù×÷¹ý³ÌÖдøÀ´ºÜ¶àµÄ²»±ã£¬ÄÇôÔõôɾ³ýÕâЩÖظ´Ã»ÓÐÓõÄÊý¾ÝÄØ?
¡¡¡¡Öظ´Êý¾Ýɾ³ý¼¼Êõ¿ÉÒÔÌṩ¸ü´óµÄ±¸·ÝÈÝÁ¿£¬ÊµÏÖ¸ü³¤Ê±¼äµÄÊý¾Ý±£Áô£¬»¹ÄÜʵÏÖ±¸·ÝÊý¾ÝµÄ³ÖÐøÑéÖ¤£¬Ìá¸ßÊý¾Ý»Ö¸´·þÎñˮƽ£¬·½±ãʵÏÖÊý¾ÝÈÝÔֵȡ£ Öظ´µÄÊý¾Ý¿ÉÄÜÓÐÕâÑùÁ½ÖÖÇé¿ö£¬µÚÒ»ÖÖʱ±íÖÐÖ»ÓÐijЩ×Ö¶ÎÒ»Ñù£¬µÚ¶þÖÖÊÇÁ½ÐмǼÍêÈ«Ò»Ñù¡£OracleÊý¾Ý¿âÖظ´Êý¾Ýɾ³ý¼¼ÊõÓÐÈçÏÂÓÅÊÆ£º¸ü´óµÄ±¸·ÝÈÝÁ¿¡¢Êý¾ÝÄܵõ½³ÖÐøÑéÖ¤¡¢Óиü¸ßµÄÊý¾Ý»Ö¸´·þÎñˮƽ¡¢·½±ãʵÏÖ±¸·ÝÊý¾ÝµÄÈÝÔÖ¡£
¡¡¡¡Ò»¡¢É¾³ý²¿·Ö×Ö¶ÎÖظ´Êý¾Ý¡¡¡¡
ÏÈÀ´Ì¸Ì¸ÈçºÎ²éѯÖظ´µÄÊý¾Ý°É¡£
ÏÂÃæÓï¾ä¿ÉÒÔ²éѯ³öÄÇЩÊý¾ÝÊÇÖظ´µÄ£º
Sql´úÂë
select ×Ö¶Î1,×Ö¶Î2,count(*)
from ±íÃû group by ×Ö¶Î1,×Ö¶Î2
having count(*) > 1
select ×Ö¶Î1,×Ö¶Î2,count(*)
from ±íÃû group by ×Ö¶Î1,×Ö¶Î2
having count(*) > 1
¡¡¡¡
½«ÉÏÃæµÄ>ºÅ¸ÄΪ=ºÅ¾Í¿ÉÒÔ²éѯ³öûÓÐÖظ´µÄÊý¾ÝÁË¡£
¡¡¡¡ÏëҪɾ³ýÕâЩÖظ´µÄÊý¾Ý£¬¿ÉÒÔʹÓÃÏÂÃæÓï¾ä½øÐÐɾ³ý
¡¡¡¡
Sql´úÂë
delete from ±íÃû a where ×Ö¶Î1,×Ö¶Î2 in
(select ×Ö¶Î1,×Ö¶Î2,count(*)
from ±íÃû
group by ×Ö¶Î1,×Ö¶Î2
having count(*) > 1)
delete from ±íÃû a where ×Ö¶Î1,×Ö¶Î2 in
(select ×Ö¶Î1,×Ö¶Î2,count(*)
from ±íÃû
group by ×Ö¶Î1,×Ö¶Î2
having count(*) > 1)
¡¡¡¡
ÉÏÃæµÄÓï¾ä·Ç³£¼òµ¥£¬¾ÍÊǽ«²éѯµ½µÄÊý¾Ýɾ³ýµô¡£²»¹ýÕâÖÖɾ³ýÖ´ÐеÄЧÂʷdz£µÍ£¬¶ÔÓÚ´óÊý¾ÝÁ¿À´Ëµ£¬¿ÉÄܻὫÊý¾Ý¿âµõËÀ¡£ËùÒÔÎÒ½¨ÒéÏȽ«²éѯµ½µÄÖظ´µÄÊý¾Ý²åÈëµ½Ò»¸öÁÙʱ±íÖУ¬È»ºó¶Ô½øÐÐɾ³ý£¬ÕâÑù£¬Ö´ÐÐɾ³ýµÄʱºò¾Í²»ÓÃÔÙ½øÐÐÒ»´Î²éѯÁË¡£ÈçÏ£º
¡¡¡¡
Sql´úÂë
CREATE TABLE ÁÙʱ±í AS
(select ×Ö¶Î1,×Ö¶Î2,count(*)
from ±íÃû
group by ×Ö¶Î1,×Ö¶Î2
having count(*) > 1)
CREATE TABLE ÁÙʱ±í AS
(select ×Ö¶Î
Ïà¹ØÎĵµ£º
1¡¢Ê¹ÓÃoracleÓû§µÇ¼£¬Á¬½ÓÊý¾Ý¿â
[oracle@wuzj ~]$ sqlplus /nolog
SQL*Plus: Release 10.2.0.1.0 - Production on Thu Feb 26 12:06:29 2009
Copyright (c) 1982, 2005, Oracle. All rights reserved.
SQL> conn /as sysdba
Connected.
//²é¿´Óû§
SQL> select username,password from dba_users;
......
OracleÊý¾Ýµ¼Èëµ¼³öimp/exp¾ÍÏ൱ÓÚoracleÊý¾Ý»¹ÔÓ뱸·Ý¡£expÃüÁî¿ÉÒÔ°ÑÊý¾Ý´ÓÔ¶³ÌÊý¾Ý¿â·þÎñÆ÷µ¼³öµ½±¾µØµÄdmpÎļþ£¬impÃüÁî¿ÉÒÔ°ÑdmpÎļþ´Ó±¾µØµ¼Èëµ½Ô¶´¦µÄÊý¾Ý¿â·þÎñÆ÷ÖС£ ÀûÓÃÕâ¸ö¹¦ÄÜ¿ÉÒÔ¹¹½¨Á½¸öÏàͬµÄÊý¾Ý¿â£¬Ò»¸öÓÃÀ´²âÊÔ£¬Ò»¸öÓÃÀ´ÕýʽʹÓá£
Ö´Ðл·¾³£º¿ÉÒÔÔÚSQLPLUS.EXE»òÕßDOS£¨ÃüÁîÐУ©ÖÐÖ´ÐУ¬
DOSÖпÉÒ ......
µÚÒ»¸öbug fix Óõ½ OracleµÄUpdateÓï¾ä
update Table1 set Web=-1 where ProgID=N‘123’
CodeReview ʱ
Do we need a COMMIT; in the Oracle version?
ÉÏÍø²éÁËÒ»ÏÂOracle COMMITÓ÷¨
COMMIT
Purpose
Use the COMMIT statement to end your current transaction and make permanent all changes ......
ÿ¸öOracleÓû§¶¼ÓÐÒ»¸öÃû×ֺͿÚÁî,²¢ÓµÓÐһЩÓÉÆä´´½¨µÄ±í¡¢ÊÓͼºÍÆäËû×ÊÔ´¡£Oracle½ÇÉ«£¨role£©¾ÍÊÇÒ»×éȨÏÞ£¨privilege£©(»òÕßÊÇÿ¸öÓû§¸ù¾ÝÆä״̬ºÍÌõ¼þËùÐèµÄ·ÃÎÊÀàÐÍ)¡£Óû§¿ÉÒÔ¸ø½ÇÉ«ÊÚÓè»ò¸³ÓèÖ¸¶¨µÄȨÏÞ£¬È»ºó½«½ÇÉ«¸³¸øÏàÓ¦µÄÓû§¡£Ò»¸öÓû§Ò²¿ÉÒÔÖ±½Ó¸øÆäËûÓû§ÊÚȨ¡£
Êý¾Ý¿âϵͳȨÏÞ£¨Dat ......