±±´óÇàÄñoracleѧϰ±Ê¼Ç25
¹ý³ÌÖеÄÊÂÎñ
¶¨Òå¹ý³Ìp1
create or replace procedure p1
as
begin
insert into student values(5,'xdh','m',sysdate);
rollback;
end;
¶¨Òå¹ý³Ìp2
create or replace procedure p2
as
begin
update student set stu_sex = 'a' where stu_id = 3;
p1;
end;
Ö´Ðйý³Ìp2
exec p2;
Ö´ÐÐÍê±Ï·¢ÏÖ±íÖÐÊý¾ÝûÓбä¸ü£¬ËµÃ÷p1ÖеÄrollbackÓï¾ä½«p2ÖеÄupdateÓï¾äÒ²»Ø¹öÁË¡£
×ÔÖ÷ÊÂÎñ´¦Àí
²½Ö裺
Ö÷ÊÂÎñ´¦ÀíÆô¶¯×ÔÖ÷ÊÂÎñ´¦Àí
Ö÷ÊÂÎñ´¦Àí±»ÔÝÍ£
×ÔÖ÷ÊÂÎñ´¦Àísql²Ù×÷
ÖÐÖ¹×ÔÖ÷ÊÂÎñ´¦Àí
»Ö¸´Ö÷ÊÂÎñ´¦Àí
pragma autonomous_transaction
ÓÃÓÚ±ê¼Ç×Ó³ÌÐò
ÔÚp1µÄas beginµ±ÖмÓÈë pragma autonomous_transaction ºóÖ´ÐУ¬·¢ÐÐp2µÄupdateÓï¾äÉúЧ£¬p1ÖеÄÊÂÎñ×÷Ϊ×ÔÖ÷ÊÂÎñÀ´´¦Àí£¬²»Ó°ÏìÖ÷ÊÂÎñ¡£
³ÌÐò°ü
Ïà¹Ø¶ÔÏóµÄ·â×°
-³ÌÐò°ü¹æ¸ñ˵Ã÷
ÉùÃ÷×Ó³ÌÐò£¬²»°üº¬ÊµÏÖ
create package °üÃû is|as ±äÁ¿ÉùÃ÷|ÀàÐͶ¨Òå|Òì³£ÉùÃ÷|ÓαêÉùÃ÷|º¯Êý˵Ã÷|¹ý³Ì˵Ã÷
pragma restrict_references(º¯ÊýÃû,WNDS[,WNPS][,RNDS][,RNPS])
end [°üÃû];
create or replace package StuPackages
is
type curRefStudent is REF CURSOR RETURN student%rowtype;
procedure insertStudent(stuid in student.stu_id%type,stuname in student.stu_name%type,stusex in student.stu_sex%type,studate in student.stu_birthday%type);
Function QueryStudent(stuid in student.stu_id%type) return student%rowtype;
end StuPackages;
-³ÌÐò°üÖ÷Ìå
¶¨Òå×Ó³ÌÐò£¬ÊµÏÖÉùÃ÷²¿·Ö
create package body °üÃû is|as ±äÁ¿ÉùÃ÷|ÀàÐͶ¨Òå|Òì³£ÉùÃ÷|ÓαêÉùÃ÷|º¯Êý¶¨Òå|¹ý³Ì¶¨Òå
end [°üÃû];
CREATE OR REPLACE
PACKAGE BODY STUPACKAGES AS
procedure insertStudent(stuid in student.stu_id%type,stuname in student.stu_name%type,stusex in student.stu_sex%type,studate in student.stu_birthday%type) AS
i INTEGER;
Student_Exist EXCEPTION;
BEGIN
select count(*) into i from student where stu_id = stuid;
if i>0 then
raise Student_Exist;
else
insert into student values(stuid,stuname,stusex,studate);
commit;
end if;
Ïà¹ØÎĵµ£º
ÃÀ¹úPVH DB´æÔÚÐÐÁ´½Ó.ͨ¹ýÎҵļì²é,·¢ÏÖ,ÎÒÃǵÄDBͬÑù´æÔÚÐÐǨÒƺÍÐÐÁ´½Ó.ORACLEµÄdbms_stats.gather_schema_statsÖ»»áÊÕ¼¯ÓÅ»¯Æ÷ͳ¼ÆÐÅÏ¢,²»»á¼ì²â±íµÄ¼Ç¼ÊÇ·ñ´æÔÚÐÐǨÒƺÍÐÐÁ´½Ó.(ÎÒÔÏȱ»Õâ¸ö°ü¸øÆÁË,ËùÒÔÖ´ÐÐÍêdbms_stats.gather_schema_statsºóÒ»²éÊý¾Ý×Öµä:USER_TABLES,ÆäÖеÄ×Ö¶Îchain_cntֵȫΪ0).Òª¼ì²â±íµÄ¼Ç ......
Á©Ì¨²»Í¬µÄÊý¾Ý¿â·þÎñÆ÷£¬´Óһ̨Êý¾Ý¿â·þÎñÆ÷µÄÒ»¸öÓû§¶ÁÈ¡Áíһ̨Êý¾Ý¿â·þÎñÆ÷ϵÄij¸öÓû§µÄÊý¾Ý£¬Õâ¸öʱºò¿ÉÒÔʹÓÃdblink¡£
ÆäʵdblinkºÍÊý¾Ý¿âÖеÄview²î²»¶à£¬½¨dblinkµÄʱºòÐèÒªÖªµÀ´ý¶ÁÈ¡Êý¾Ý¿âµÄipµØÖ·£¬ssidÒÔ¼°Êý¾Ý¿âÓû§ÃûºÍÃÜÂë¡£
´´½¨¿ÉÒÔ ......
2010-03-12 21:21:26
sqlplusµÇ½¶ÌÏûÏ¢oracleÊý¾Ý¿âʱÌáʾ“ORA-28000: Õʺű»Ëø¶¨”¡£
תÌù£ºhttp://blog.csdn.net/shongyu/archive/2009/06/01/4233260.aspx
È·¶¨ÊÇÓÉÓÚoracle11gÖÐĬÈÏÔÚdefault¸ÅÒªÎļþÖÐÉèÖÃÁË“FAILED_LOGIN_ATTEMPTS=10´Î”£¬µ±ÊäÈëÃÜÂë´íÎó´ÎÊý´ïµ½ÉèÖÃÖµ½«µ¼Ö´ËÎÊÌâ¡£
° ......
1. ÔÚ´ò¿ªEnterprise Manager Consolʱ±¨´í: "ÕÒ²»µ½Ä¿±êÖ÷»ú";
¡¾½â¾ö·½°¸¡¿¸ÃÎÊÌâÔÚʹÓÃGhostÖÆ×÷µÄϵͳÖг£¼û, ³ö´íÔÒòÊÇOracleÖÐÅäÖõÄÖ÷»úÃû
ºÍʵ¼ÊµÄÖ÷»úÃû²»Ò»ÖÂ. ½â¾ö·½·¨ÈçÏÂ:
(1) Enterprise Manager Consol -> ¹¤¾ß²Ëµ¥ ->·þÎñ¹ÜÀí -> Oracle Net Manager;
(2) ½«"±¾µØ ......