´´½¨oracleÊý¾Ý¿âÁ¬½Ó(database link)µÄÁ½ÖÖ·½·¨
oracle Êý¾Ý¿âÁ¬½Ó¾ÍÏñÄãÔÚ³ÌÐòÖн¨Á¢Ò»¸öµ½Êý¾Ý¿âµÄÁ¬½ÓÒ»Ñù¡£
Èç¹ûÊý¾Ý¿â²»ÔÚ±¾µØÖ÷»ú,±ØÐëÔÚ$ORACLE_HOME/network/admin/tnsnames.oraÖÐÅäÖÃÏàÓ¦µÄtns£¬È»ºó³ÌÐò²ÅÄÜͨ¹ýÅäÖúõÄtns·ÃÎÊÊý¾Ý¿â£¬µ«ÊÇjavaͨ¹ýthin·½Ê½·ÃÎÊoracleÀýÍ⣬¿ÉÒÔ²ÉÓÃÔÚ±¾µØÅäÖúõÄtns±ðÃû£¬Ò²¿ÉÒÔ²ÉÓÃtnsÈ«½âÎöÃû£¬²ÉÓñðÃûµÈºÅºóµÄÈ«ÃèÊö·û£»ÈçÏ£º
TESTCZ =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.70.9.12)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = TESTCZ)
)
)
¾ÙÀý¡£
ÏÖÔÚÓÐÁ½¸öÊý¾Ý¿â
adb£¬Óû§ÃûºÍÃÜÂë·Ö±ðÊÇadb/adb£¬ÔÚ±¾µØÖ÷»úÅäÖõÄtnsÃû×ÖÊÇtns_a,ËùÔÚÖ÷»úa;
bdb£¬Óû§ÃûºÍÃÜÂë·Ö±ðÊÇbdb/bdb£¬ÔÚ±¾µØÖ÷»úÅäÖõÄtnsÃû×ÖÊÇtns_b,ËùÔÚÖ÷»úb;
ÏÖÔÚÐèÒªÔÚadbÉÏÃ潨һ¸öÁ¬½Óµ½bdbÊý¾Ý¿âµÄdblink;
·½·¨1£º
ÔÚaÖ÷»úÉϱà¼tnsnames.oraÎļþÅäÖÃbdbÊý¾Ý¿âµÄtns±ðÃûtns_b£¬ÈçÏ£º
tns_b =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.70.9.12)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = dbtestb)
)
)
È»ºó´´½¨Êý¾Ý¿âÁ¬½Ó£¬ÈçÏ£º
create database link
connect to bdb identified by identified by bdb
using 'tns_b';
·½·¨2£º
Èç¹ûûÓÐȨÏÞÐÞ¸Ätnsnames.ora£¬ÄÇô¾ÍûÓа취½¨Á¢µ½adbÊý¾Ý¿âµÄtns±ðÃû£¬ÄÇô¾ÍÖ»ÄܲÉÓÃÔÚ´´½¨dblinkµÄʱºò£¬È«Ð´½âÎö·ûºÅ¡£´´½¨dblinkµÄ·½·¨ÈçÏ£º
create database link
connect to bdb identified by identified by bdb
using '(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.70.9.12)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = dbtestb)
)
)';
´´½¨ºÃtns±ðÃûÖ®ºó£¬¿ÉÒÔ²ÉÓÃsqlplus username/password@tnsnameÀ´²âÊÔ´´½¨µÄtns±ðÃûÊÇ·ñÕýÈ·¡£
ÎÒÔÚÉú²úϵͳÖд´½¨µÄÒ»¸ödblinkʾÀý£º
create database link NEW_DBLINK
connect to AIIPS identified by "1qaz2wsx"
using '(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.70.193.12)(PORT = 1521))
Ïà¹ØÎĵµ£º
Ò»¡£jobµÄÔËÐÐƵÂÊÉèÖÃ
1.ÿÌì¹Ì¶¨Ê±¼äÔËÐУ¬±ÈÈçÔçÉÏ8:10·ÖÖÓ£ºTrunc(Sysdate+1) + (8*60+10)/24*60
2.ToadÖÐÌṩµÄ£º
ÿÌ죺trunc(sysdate+1)
ÿÖÜ£ºtrunc(sysdate+7)
ÿÔ£ºtrunc(sysdate+30)
ÿ¸öÐÇÆÚÈÕ£ºnext_day(trunc(sysdate),'SUNDAY')
ÿÌì6µã£ºtrunc(sysdate+1)+6/24
°ë¸öСʱ£ºsysdate+30/1440
3.ÿ¸ö ......
¶Ô³õѧORACLEµÄÈËһʱºÜÄÑ·ÖÇåORACLEÖйØÓÚ“¿Õ¼ä”µÄ¸ÅÄ±ÈÈç±í¿Õ¼ä ÁÙʱ±í¿Õ¼ä Óû§±í¿Õ¼äµÈ£¬¶ÔÓÚÓÉSQLתµ½ORACLEµÄ¾Í¸ü¼Ó»ìÏýÁË£¬ÈÃÈ˸оõORACLE·±Ëö£»·±ËöÔÚÄĶù£¬ÎÒÕûÀíÂÞÁÐÈçÏ£º
1.ORACLE×Ô´ø¹¤¾ß²»Ê®·ÖÒ×Óã»
2.ORACLEµÚÈý·½¹¤¾ßÒ×ÉÏÊÖ£¬µ«ÄÑÉîÈ룻
&n ......
OracleÊý¾Ý¿âÖÐÌṩÁËͬÒå´Ê¹ÜÀíµÄ¹¦ÄÜ¡£Í¬Òå´ÊÊÇÊý¾Ý¿â·½°¸¶ÔÏóµÄÒ»¸ö±ðÃû£¬¾³£ÓÃÓÚ¼ò»¯¶ÔÏó·ÃÎʺÍÌá¸ß¶ÔÏó·ÃÎʵݲȫÐÔ¡£ÔÚʹÓÃͬÒå´Êʱ£¬OracleÊý¾Ý¿â½«Ëü·Òë³É¶ÔÓ¦·½°¸¶ÔÏóµÄÃû×Ö¡£ÓëÊÓͼÀàËÆ£¬Í¬Òå´Ê²¢²»Õ¼ÓÃʵ¼Ê´æ´¢¿Õ¼ä£¬Ö»ÓÐÔÚÊý¾Ý×ÖµäÖб£´æÁËͬÒå´ÊµÄ¶¨Òå¡£ÔÚOracleÊý¾Ý¿âÖеĴ󲿷ÖÊý¾Ý¿â¶ÔÏó£¬Èç±í¡¢ÊÓͼ¡¢Í ......
1£ºÒÔÒ»¸öDBAÉí·ÖµÄÓû§µÇ½£¬´ò¿ªÒ»¸öÃüÁî´°¿Ú¡£Ö´ÐÐÃüÁî
SELECT /*+ rule */ s.username,
decode(l.type,'TM','TABLE LOCK',
'TX','ROW LOCK',
NULL) LOCK_LEVEL,
o.owner,o.object_name,o.object_type,
s.sid,s.serial#,s.terminal,s.machine,s.program,s.osuser
from v$session s,v$lock l,dba_objects o
WHERE ......