SQL Server 2005 ´´½¨µ½ Oracle10g µÄÁ´½Ó·þÎñÆ÷
SQL Server 2005 ´´½¨µ½ Oracle10g µÄÁ´½Ó·þÎñÆ÷
ÓÉ lwgboy @ MoFun.CC, ÔÚ 08-9-12 ÏÂÎç5:00
±ê¼Ç: linkserver, oracle, sqlserver, Á´½Ó·þÎñÆ÷
SQL Server 2005 ´´½¨µ½ Oracle10g µÄÁ´½Ó·þÎñÆ÷
SQL Server 2005 ÒìÀàÊý¾ÝÔ´(ORACLE10G)Á´½Ó·þÎñÆ÷µÄ½¨Á¢
±¾ÎļòÊöSqlServer 2005 Á´½Óµ½ Oracle10g ·þÎñÆ÷µÄ¹ý³Ì¼°»ù±¾Ó¦Óá£
Ãû´Ê˵Ã÷£ºÁ´½Ó·þÎñÆ÷£º¶ÔÓ¦oracleµÄDBLINK¡£ÓÃÓÚÍê³É¶à¸öÒì¹¹Êý¾Ý¿â·þÎñµÄ·Ö²¼Ê½·ÃÎÊ¡£
´Ó SqlServer 2005 Öн¨Á¢µ½ Oracle µÄÁ´½ÓÓë SQLServer 2000 Öв¶à£¬Ö»ÊǽçÃ滨ÉÚÁËЩ£¬Õ¦Ò»¿´»¹ÒÔΪ²»Ò»ÑùÁËÄØ£¬Êµ¼Êûɶ´óµÄÇø±ð£º
Á´½Ó·þÎñ½¨Á¢£º
¡¡¡¡* °²×°oracle10g µÄ¿Í»§¶Ë£ºÊ¹ÓÃnetmgrÌí¼Ó±¾µØµÄ·þÎñÃüÃû£¬ÀýÈ磺·þÎñÃüÁDBLINK£»²âÊÔͨ¹ýºó½øÐÐÏÂÒ»²½¡£
¡¡¡¡* ½¨Á¢ODBCÊý¾ÝÔ´£¨ÏÖÔÚÒѲ»ÐèÒª£¬Ò»°ãÖ±½ÓÓÃOracle±¾µØ·þÎñÃû´úÌ棬±¾²½¿ÉÊ¡ÂÔ£©
¡¡¡¡¡¡Îª SQL Server 2005 ·þÎñÆ÷Ôö¼ÓϵͳÊý¾ÝÔ´£º
¡¡¡¡¡¡[¿ØÖÆÃæ°å]£½¡·[¹ÜÀí¹¤¾ß]£½¡·[Êý¾ÝÔ´(ODBC)]£½¡·[ϵͳDNS]£¬Ìí¼Ó»ùÓÚ Oracle µÄÊý¾ÝÔ´£ºÊý¾ÝÔ´ÃûΪ£ºDBLINK(´ËÃû³Æ¾¡Á¿ÓëOracleµÄ±¾µØ·þÎñÃûÒ»ÖÂ),²¢½øÐÐÁ¬½Ó²âÊÔ¡£
¡¡¡¡* ͨ¹ýÖ´ÐÐSQLServer´æ´¢¹ý³ÌÀ´´´½¨Á´½Ó·þÎñ(Ö±½ÓʹÓÃOracle±¾µØ·þÎñÃû£¬ÕâÀï±¾µØ·þÎñÃûΪCMCC)£º
¡¡¡¡¡¡exec sp_addlinkedserver @server='LINK2ORACLE', @srvproduct='Oracle', @provider='MSDAORA', @datasrc='CMCC'
¡¡¡¡* Á´½ÓµÇ¼ÅäÖãº
¡¡¡¡¡¡exec sp_addlinkedsrvlogin 'LINK2ORACLE',false,'sa','OracleUserName','OraclePassword' ;
¡¡¡¡¡¡ËµÃ÷£º´ËÓï¾ä°ÑÔ¶·½DBServerµÄscottÓû§Ó³Éäµ½±¾µØµÄsa£¨¸ÃÓû§Çë¸ù¾Ýʵ¼Ê½øÐиü¸Ä£©¡£
Á´½Ó·þÎñÆ÷Ó¦ÓÃ:
¡¡¡¡A¡¢²éѯOracleÊý¾Ý±í·½Ê½Ò»(ÕâÖÖ·½Ê½£¬µ±OracleÓëSQLServerµÄÊý¾ÝÀàÐͲ»Ò»ÖÂʱ¾³£±¨´í,ÇÒËÙ¶ÈÉÔÂý)£º
¡¡¡¡select * from [LINK2ORACLE]..[ORACLE_USER_NAME].TABLE_NAME;
¡¡¡¡ÎÒÔÚÖ´ÐиÃÓï¾ä¾³£±¨ÀàËÆ´íÎóÐÅÏ¢£ºÁ´½Ó·þÎñÆ÷ "LINK2ORACLE" µÄ OLE DB ·ÃÎÊ½Ó¿Ú "MSDAORA" ΪÁÐÌṩµÄÔªÊý¾Ý²»Ò»Ö¡£¶ÔÏó ""CMCC"."OS2_GIS_CELL"" µÄÁÐ "ISOPENED" (±àÒëʱÐòºÅΪ 20)ÔÚ±àÒëʱÓÐ 130 µÄ "DBTYPE"£¬µ«ÔÚÔËÐÐʱÓÐ 5¡£
¡¡¡¡B¡¢²éѯOracleÊý¾Ý±í·½Ê½¶þ(¾ÊÔÑ飬ÕâÖÖ·½Ê½Ê¹ÓÃÆðÀ´ºÜ˳³©£¬²»±¨´í£¬ÇÒËٶȼ¸ºõºÍÔÚOralceÖÐÒ»Ñù¿ì)£º
¡¡¡¡select * from openquery(LINK2ORACLE,'select * from OracleUserName.TableName')
¡¡¡¡Äú¿ÉÒÔ°Ñopenquery()µ±³É±íÀ´Ê¹Óá£
¡¡¡¡C¡¢¾Ù¸ö
Ïà¹ØÎĵµ£º
ÓÃoracleÊý¾Ý¿âµÄ´æ´¢¹ý³ÌʵÏÖ·µ»Ø½á¹û¼¯²¢ÊµÏÖ·ÖÒ³µÄ¹¦ÄÜ¡£
Óû§´«Èë²ÎÊý
Ò»ÏÂÊÇת±ðÈ˵ĴúÂë
--°üÉùÃ÷
create or replace package p_page is
-- Author : PHARAOHS
-- Created : 2006-4-30 14:14:14
-- Purpose : ·ÖÒ³¹ý³Ì
TYPE type_cur IS REF CURSOR; &n ......
ORACLEÔÚ¹ØϵÊý¾Ý¿âÍ⣬ÈÚÈëÁËÃæÏò¶ÔÏóµÄÔªËØ£¬±ÈÈç¿ÉÒÔ´´½¨type£¬typeÖ®¼ä¿ÉÒԼ̳У¬type¿ÉÒÔ´ø¹¹Ô캯Êý¡¢ÅÅÐòº¯Êý¡¢¸÷ÖÖ¸÷ÑùµÄ³ÉÔ±º¯Êý¡¢´æ´¢¹ý³ÌµÈµÈ¡£
¶ÔÏó±íÊÇÖ¸¸Ã±íµÄÒ»ÐоÍÊÇÒ»¸ö¶ÔÏó£¬ÓÐÒ»¸öOID(object ID)£¬¶ÔÏó±íÖ®¼äûÓÐÖ÷Íâ¼ü¹ØÁªµÄ¸ÅÄΪÁËÌåÏÖÕâ²ã¹Øϵ£¬oracleÖÐÓÃÁËref¶ÔÏóÀ´ÊµÏÖ¡£
ÏÂÃæÀý×Ó£¬´´½¨Ò»¸öµ ......
ÈçºÎ¼ÓËÙ
Oracle
´óÅúÁ¿Êý¾Ý´¦Àí
Ò»¡¢
Ìá¸ß
DML
²Ù×÷µÄ°ì·¨£º
¼òµ¥ËµÀ´£º
£±¡¢ÔÝÍ£Ë÷Òý£¬¸üкó»Ö¸´.
±ÜÃâÔÚ¸üеĹý³ÌÖÐÉæ¼°µ½Ë÷ÒýµÄÖؽ¨.
£²¡¢ÅúÁ¿¸üУ¬Ã¿¸üÐÂһЩ¼Ç¼ºó¼°Ê±½øÐÐÌá½»¶¯×÷.
±ÜÃâ´óÁ¿Õ¼Óûعö¶ÎºÍ»òÁÙʱ±í¿Õ¼ä.
£³¡¢´´½¨Ò»ÁÙʱ ......
ÍæOracleÒ²ÓÐ2ÄêµÄʱ¼äÁË£¬ ÁãÁãɢɢµÄÒ²ÕûÀíһЩ×ÊÁÏ¡£ ¶«Î÷Ò»¶àÁË£¬¾ÍÀí²»Çå³þ¡£ ËùÒÔ½áºÏÕÅÏþÃ÷µÄ¡¶´ó»°Oracle RAC¡·µÄһЩÄÚÈÝ£¬ºÍ×Ô¼ºÕûÀíµÄһЩ±Ê¼Ç£¬¶ÔOracle µÄ±¸·ÝºÍ»Ö¸´×öÁËÒ»¸öϵͳµÄÕûÀí¡£ Ò²ÊÇ×Ô¼º¶Ô֪ʶµÄÒ»¸ö¹®¹Ì°É¡£
Ò»£® ×¼±¸ÖªÊ¶
ÏÈÀ´¿´Ò»Ð©×¼±¸ÖªÊ¶£¬Á˽â ......