ÍæתOracle£¨2£©
sql*plus ÃüÁî
//Ö´Ðнű¾
@ºÍstart d:/a.txt;
//Ð޸Ľű¾
edit d:/a.txt;
//½«ÄÚÈÝÊäÈëµ½Îı¾ÖÐ
sloop d:/a.txt; //¿ªÊ¼¼Ç¼ÆÁÄ»ÄÚÈÝ
sloop off; //¼Ç¼½áÊø
//Á´½ÓµÇ¼Êý¾Ý¿â
connect system/919959 as sysdba/sysoper; //ȨÏÞ×î´ódba
connect sys/919959;
connect scott/tiger;
//´´½¨Óû§
create user valen identified by 919959; //´´½¨Íê³Éºó²¢²»Äܹ»µÇ¼£¬ÐèÒªÊÚȨ
//µ±Ç°Óû§
show user;
//ɾ³ýÓû§
drop user valen;
//ÊÚȨ
grant connect to valen; //µÇ¼µÄȨÏÞ
grant resource to valen; //½¨±íµÄȨÏÞ
grant select on emp to valen; //½«¶ÔÏó²Ù×÷ȨÏÞ¸øÓèijһ¸öÓû§£¬¼ÙÉ赱ǰÓû§Îªscott£¬½«scottµÄemp±íµÄselectȨÏÞ¸³¸øvalen
grant update on emp //¸üÐÂȨÏÞ
grant inset on emp //Ìí¼ÓȨÏÞ
grant delete on emp //ɾ³ýȨÏÞ
grant all on emp //µ±Ç°±íµÄËùÓÐȨÏÞ
//ÊÕ»ØȨÏÞ
revoke select on emp from valen; //´ÓvalenÓû§ÊջضÔemp±íµÄselectȨÏÞ
//²éѯÆäËûÓû§µÄ±íµÄȨÏÞ
select * from scott.emp //²éѯscottÓû§ÏÂemp±í
//ȨÏÞµÄά»¤
//¶ÔÏóȨÏÞ
scott½«È¨ÏÞ´«¸øÁËvalen£¬²¢Ï£Íûvalen½«¸ÃÑ¡Ïß¼ÌÐø´«µÝ¸øÏÂÒ»¸öÓû§
grant select on emp to valen with grant option //Èç¹ûÊǶÔÏóȨÏ޾ͼÓÈëwith grant option
//ϵͳȨÏÞ
grant connect to valen with admin option //Èç¹ûÊÇϵͳȨÏ޾ͼÓÈëwith admin option
Èç¹ûscottÊÕ»ØÁËvalenµÄȨÏÞ£¬ÔòvalenÊÚȨ¸øtomµÄȨÏÞÒ²±»ÊÕ»ØÁË
//ʹÓÃprofile¹ÜÀíÓû§¿ÚÁî
´´½¨profileÎļþ
create profile lock_account //´´½¨¹æÔòlock_account
limit //¹Ø¼ü×Ö
failed_login_attempts 3 //¸øÓè3´ÎµÇ¼»ú»á
password_lock_time 2; //Ëø¶¨2Ìì
//¸ü¸ÄÓû§×ñѴ˹æÔò
alter user tom profile lock_account;
//¸øÕË»§½â·â
alter user tom account unlock; //¸øÖ¸¶¨Óû§½â·â
//ÖÕÖ¹¿ÚÁî
create profile myprofile //´´½¨¹æÔòmyprofile
limit
password_life_time 10 //ÿ10ÌìÐ޸ĵǼÃÜÂë
password_grace_time 2 //¿íÏÞÆÚΪ2Ìì
password_reuse_time 10 //Ö¸¶¨¿ÚÁî¿ÉÖØÓÃʱ¼ä¼´10Ììºó¾Í¿ÉÒÔÖØÓÃ
//
Ïà¹ØÎĵµ£º
ÖØ×°²Ù×÷ϵͳºó,Èç¹ûÊý¾ÝÎļþ,¿ØÖÆÎļþ,ÈÕÖ¾Îļþ¶¼ÍêºÃµÄ»°(ÔÚitpub¿´¹ýºÜ¶àÈËÌá¹ýÕâ¸ö»°Ìâ,¶àÊýÈ˶¼Êǽ«Õâ3¸öÎļþ·ÅÔÚͬһĿ¼oradata),Ö»ÐèÖØа²×°oracle(¸úÖØ×°²Ù×÷ϵͳǰͬ°æ±¾)µ½ÔĿ¼ºó,Öؽ¨ÊµÀý·þÎñºÍÃÜÂëÎļþ,ÅäÖÃÒ»ÏÂlistenerºÍtns¼´¿ÉÕý³£Æô¶¯Êý¾Ý¿â.
¹ý³ÌÈçÏÂ(¼ÙÉèÔʵÀýÃûΪorcl,°æ±¾Îª9i):
1.½«ÔÀ´µÄor ......
.net Ô¶³ÌÁ¬½ÓOracleÊý¾Ý¿â¿´ÆðÀ´Í¦¼òµ¥µÄ£¬µ«Êµ¼Ê×öÆðÀ´»¹ÊÇÓöµ½²»ÉÙÎÊÌâ¡£°ÑÎÒ½ñÌìÕÛÌÚÕâ¸ö¶«Î÷µÄ¾Ñé¸ø´ó¼Ò¹²Ïí°É¡£
¡¡¡¡·ÃÎÊ oracle Êý¾Ý¿âµÄ·½Ê½ºÜ¶à£¬ÎÒÓõÄÊÇ OleDbConnection£¬Õâ¸öûʲôºÃ˵µÄ£¬´úÂëÈçÏ£º
¡¡¡¡1. Á¬½Ó´úÂë
¡¡_OleDbConnection¡¡=¡¡new¡¡OleDbConnection(connectionString);
¡¡¡ ......
SQLÖеĵ¥¼Ç¼º¯Êý
1.ASCII
·µ»ØÓëÖ¸¶¨µÄ×Ö·û¶ÔÓ¦µÄÊ®½øÖÆÊý;
SQL> select ascii('A') A,ascii('a') a,ascii('0') zero,ascii(' ') space from dual;
A A ZERO ......
OracleÓëSQL ServerÊÂÎñ´¦ÀíµÄ±È½Ï
ÊÂÎñ´¦ÀíÊÇËùÓдóÐÍÊý¾Ý¿â²úÆ·µÄÒ»¸ö¹Ø¼üÎÊÌ⣬¸÷Êý¾Ý¿â³§É̶¼ÔÚÕâ¸ö·½Ã滨·ÑÁ˺ܴó
¾«Á¦£¬²»Í¬µÄÊÂÎñ´¦Àí·½Ê½»áµ¼ÖÂÊý¾Ý¿âÐÔÄܺ͹¦ÄÜÉϵľ޴ó²îÒì¡£
ÊÂÎñ´¦ÀíÒ²ÊÇÊý¾Ý¿â¹ÜÀíÔ±ÓëÊý¾Ý¿âÓ¦ÓóÌÐò¿ª·¢ÈËÔ±±ØÐëÉî¿ÌÀí½âµÄÒ»¸öÎÊÌ⣬¶ÔÕâ¸öÎÊÌâµÄÊèºö¿ÉÄܻᵼÖÂÓ¦ÓóÌÐòÂß¼´í ......
CREATE OR REPLACE PROCEDURE PROC_T(
RESULT OUT NUMBER
)
IS
V_NAME emp%ROWTYPE;
CURSOR CUS_T IS SELECT * from EMP;
BEGIN
OPEN CUS_T;
loop
FETCH CUS_T INTO V_NAME;
exit when cus_t%notfound;
RESULT:=CUS_T%ROWCOUNT;
end loop;
CLOSE CUS_T;
END PROC_T; ......