¶à¸öoracleÊý¾Ý¿âÖ®¼äÊý¾Ý¹²Ïí database link
ÒòΪ¹«Ë¾µÄÕÆÉϳÇÊÐϵͳÔÚ¶à¸öµØÊÆͬʱÉÏÏߣ¬¶øΪÁËÈÃÿ¸ö³ÇÊеÄ3G¿ìѶ¾ßÓеØÊÆÌØÉ«ÐÔ£¬Ã¿¸öµØÊÆÓÐ×Ô¼ºµ¥¶ÀµÄÊý¾Ý¿âϵͳ£¬¶øÿ¸öµØÊƵĿìѶÓÖһЩ¹²Í¬µÄ£¬Æ©ÈçͻȻ³öÁËÒ»Ìõ¹ú¼ÊÐÂÎÅ£¬ÄÇôÊDz»ÊÇÿ¸öµØÊƵĺǫ́±à¼¶¼ÒªÂ¼ÈëÒ»±é£¬ÕâÑùÎÞÒÉÊÇ×öÁËÐí¶àÎÞÓù¦£¬ËùÒÔ¹«Ë¾¿¼ÂǼÜÉèÒ»¸ö×ÜÕ¾£¬×ÜÕ¾ÉÏÓÐרÃŵÄÈ˸ºÔð£¬Ã¿Ì츺Ôð¼ÈëһЩͨÓõģ¬²»¾ßÓеØÊÆÌØÉ«µÄÐÂÎÅ×ÊѶ£¬¶ø¸÷¸ö³ÇÊеÄÊý¾Ý¿â¶¼½«¹²Ïí×ÜÕ¾µÄÄÚÈÝ£¬Í¬Ê±ÓÖ¾ßÓб¾µØÌØÉ«µÄ×ÊѶ£¬Í¬Ê±½â·ÅÁËÈËÁ¦×ÊÔ´£¬¸÷¸ö³ÇÊпÉÒÔ¼¯ÖÐÓÚµØÊÆÌØÉ«µÄ½¨ÉèÉÏ¡£
ÕâÑùµÄ·½°¸£¬ÔÚ¼¼ÊõÉÏ£¬¾ÍÑݱä³ÉÁËÊý¾Ý¿âÖ®¼äµÄÊý¾Ý¹²Ïí£¬Ã¿µ±Â¼Èë×Üվ¼ÈëÊý¾ÝµÄʱºò£¬µ÷Óô¥·¢Æ÷£¬Í¨¹ýdatabaselinkÏòÆäËü¸÷¸ö·Öվͬ²½Êý¾Ý
Óõ½oracleµÄdatabase link,֮ǰҲû½Ó´¥¹ý£¬ÕâÁ½ÌìÒÀ¾Ý×ÊÁÏÃþË÷ÁËһϣ¬×ö¸ö¼Ç¼ÈçÏ£º
×÷ÓÃ:½«¶à¸öoracleÊý¾Ý¿âÂß¼ÉÏ¿´³ÉÒ»¸öÊý¾Ý¿â,Ò²¾ÍÊÇ˵ÔÚÒ»¸öÊý¾Ý¿âÖпÉÒÔ²Ù×÷ÁíÒ»¸öÊý¾Ý¿âÖеĶÔÏó¡£
Óï·¨:
CREATE [PUBLIC] DATABASE LINK dblink CONNECT TO user IDENTIFIED BY password USING ‘connect_string’;
DROP [PUBLIC] DATABASE LINK dblink;
×¢Òâ:Äã±ØÐëÓÐCREATE DATABASE LINK»òCREATE PUBLIC DATABASE LINKµÄȨÏÞ£¨¿ÉÓÃsysÉí·ÝÈ¥·ÖÅ䣩,ÁíÍâ,ÔÚÄãÒªÁ¬½ÓµÄÊý¾Ý¿âÉÏ,µÄȨÏÞ.
²ÎÊý˵Ã÷:
dblink: ÄãËù´´½¨µÄdatabase linkµÄÃû×Ö,
userºÍpassword:ÒªÁ¬½ÓµÄÊý¾Ý¿âµÄÓû§ÃûºÍÃÜÂë
connect_string:¿ÉÒÔÊǾ¹ýNet ManagerÅäÖõÄ(tnsnames.ora)ÇÒ¾²âÊÔ¿ÉÒÔÁ¬½ÓµÄ·þÎñÃû£¬²»¹ýÒ²¿Éд³ÉÕâÖÖÐÎʽ£¬¸üÖ±½Ó£º(DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 127.0.0.1)(PORT = 1521)) ) (CONNECT_DATA = (SERVICE_NAME =orcl) )
ʹÓÃ:
select * from mobile_type@dblink ;
UPDATE mobile_type@dblink m set m.type_name='83-6' where m.type_id =6;
¾ßÌå²½Ö裺
1¡¢ Á´½Ó×Ö·û´®¼´·þÎñÃû£¬Ê×ÏÈÔÚ±¾µØÅäÖÃÒ»¸ö·þÎñÃû£¬µØÖ·Ö¸ÏòÔ¶³ÌµÄÊý¾Ý¿âµØÖ·,
µ±È»Ò²¿ÉÏòÏÂÃæÄÇÑùÖ±½ÓдµÄ¡£
2¡¢´´½¨Êý¾Ý¿âÁ´½Ó£¨Ç°ÌáÊÇÒÑ·ÖÅäÏàӦȨÏÞ£©£¬½øÈëϵͳ¹ÜÀíÔ±SQL>²Ù×÷·ûÏ£¬ÔËÐÐÃüÁ
create database link wapsx
connect to WAP identified by wap
using '(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST =
Ïà¹ØÎĵµ£º
ÎÒÃÇ¿ÉÒÔͨ¹ýSTART WITH . . . CONNECT BY . . .×Ó¾äÀ´ÊµÏÖSQLµÄ ²ã´Î²éѯ£¬¶øOracle 10g ΪÆäÌí¼ÓÐí¶àÁËеÄαÁС£Ê®¶àÄêÒÔÀ´£¬Oracle SQL ¾ßÓÐÒÀÕÕ²ã´Î¹Øϵ½øÐвéѯµÄ¹¦ÄÜ¡£ÀýÈ磬Äã¿ÉÒÔÖ¸¶¨Ò»¸öÆðʼÌõ¼þ£¬È»ºó¸ù¾ÝÒ»¸ö»ò¶à¸öÁ¬½ÓÌõ¼þÀ´È·¶¨º¢×ÓÐеÄÄÚÈÝ¡£¾ÙÀýÀ´Ëµ£¬ÏÖÔÚ¼ÙÉèÎÒÓÐÒ»¸ö±í£¬ÀïÃæ¼Ç ......
truncate,delete,dropµÄÒìͬµã
×¢Òâ:ÕâÀï˵µÄdeleteÊÇÖ¸²»´øwhere×Ó¾äµÄdeleteÓï¾ä
Ïàͬµã:truncateºÍ²»´øwhere×Ó¾äµÄdelete, ÒÔ¼°drop¶¼»áɾ³ý±íÄÚµÄÊý¾Ý
²»Í¬µã:
1. truncateºÍ deleteֻɾ³ýÊý¾Ý²»É¾³ý±íµÄ½á¹¹(¶¨Òå)
dropÓï¾ä½«É¾³ý±íµÄ½á¹¹±»ÒÀÀµµÄÔ¼Êø(constrain),´¥·¢Æ÷(trigger),Ë÷Òý(index); ÒÀÀµÓÚ¸Ã±íµ ......
ͨ¹ý select * from table whereid=16701 for update ËøסһÕűí
ͨ¹ýÒÔÏÂÓï¾ä¿É²éѯ³ö±»ËøסµÄ¶ÔÏó
SELECT OBJECT_ID,
SESSION_ID,
SERIAL#,
ORACLE_USERNAME,
&nb ......
CREATE OR REPLACE PROCEDURE kevin_proc(x varchar) IS
a VARCHAR(20);
b VARCHAR(20);
CURSOR mycur(rn NUMBER) IS SELECT * from t_kevin_test WHERE ROWNUM<rn;
BEGIN
OPEN mycur(10);
LOOP FETCH mycur INTO a,b;
EXIT WHEN mycur%NOTFOUND;
Dbms_Output.put_line('a: '||a);
Dbms_Output.put_line('b: '| ......
2010-04-21 14:04
oracleÖй¹ÔìÊý×éµÄÀý×Ó£º
declare
type t_varray is varray(4) of number;
arr t_varray;
begin
arr := t_varray(1,2,3,4);
for i in 1..arr.count loop
dbms_output.put_line(arr(i));
end loop;
end;
¹¹Ôì¶þάÊý×éµÄÀý×Ó£º
declare
type t_varray ......