oracleËÀËø²éѯ¼°´¦Àí
²éѯ·¢ÉúËÀËøµÄselectÓï¾ä
select sql_text from v$sql where hash_value in
(select sql_hash_value from v$session where sid in
(select session_id from v$locked_object))
---------------------------------------------------------
¹ØÓÚÊý¾Ý¿âËÀËøµÄ¼ì²é·½·¨
Ò»¡¢ Êý¾Ý¿âËÀËøµÄÏÖÏó
³ÌÐòÔÚÖ´ÐеĹý³ÌÖУ¬µã»÷È·¶¨»ò±£´æ°´Å¥£¬³ÌÐòûÓÐÏìÓ¦£¬Ò²Ã»ÓгöÏÖ±¨´í¡£
¶þ¡¢ ËÀËøµÄÔÀí
µ±¶ÔÓÚÊý¾Ý¿âij¸ö±íµÄijһÁÐ×ö¸üлòɾ³ýµÈ²Ù×÷£¬Ö´ÐÐÍê±Ïºó¸ÃÌõÓï¾ä²»Ìá
½»£¬ÁíÒ»Ìõ¶ÔÓÚÕâÒ»ÁÐÊý¾Ý×ö¸üвÙ×÷µÄÓï¾äÔÚÖ´ÐеÄʱºò¾Í»á´¦Óڵȴý״̬£¬
´ËʱµÄÏÖÏóÊÇÕâÌõÓï¾äÒ»Ö±ÔÚÖ´ÐУ¬µ«Ò»Ö±Ã»ÓÐÖ´Ðгɹ¦£¬Ò²Ã»Óб¨´í¡£
Èý¡¢ ËÀËøµÄ¶¨Î»·½·¨
ͨ¹ý¼ì²éÊý¾Ý¿â±í£¬Äܹ»¼ì²é³öÊÇÄÄÒ»ÌõÓï¾ä±»ËÀËø£¬²úÉúËÀËøµÄ»úÆ÷ÊÇÄÄһ̨¡£
1£©ÓÃdbaÓû§Ö´ÐÐÒÔÏÂÓï¾ä
select username,lockwait,status,machine,program from v$session where sid in
(select session_id from v$locked_object)
Èç¹ûÓÐÊä³öµÄ½á¹û£¬Ôò˵Ã÷ÓÐËÀËø£¬ÇÒÄÜ¿´µ½ËÀËøµÄ»úÆ÷ÊÇÄÄһ̨¡£×Ö¶Î˵Ã÷£º
Username£ºËÀËøÓï¾äËùÓõÄÊý¾Ý¿âÓû§£»
Lockwait£ºËÀËøµÄ״̬£¬Èç¹ûÓÐÄÚÈݱíʾ±»ËÀËø¡£
Status£º ״̬£¬active±íʾ±»ËÀËø
Machine£º ËÀËøÓï¾äËùÔڵĻúÆ÷¡£
Program£º ²úÉúËÀËøµÄÓï¾äÖ÷ÒªÀ´×ÔÄĸöÓ¦ÓóÌÐò¡£
2£©ÓÃdbaÓû§Ö´ÐÐÒÔÏÂÓï¾ä£¬¿ÉÒԲ鿴µ½±»ËÀËøµÄÓï¾ä¡£
select sql_text from v$sql where hash_value in
(select sql_hash_value from v$session where sid in
(select session_id from v$locked_object))
ËÄ¡¢ ËÀËøµÄ½â¾ö·½·¨
Ò»°ãÇé¿öÏ£¬Ö»Òª½«²úÉúËÀËøµÄÓï¾äÌá½»¾Í¿ÉÒÔÁË£¬µ«ÊÇÔÚʵ¼ÊµÄÖ´Ðйý³ÌÖС£Óû§¿É
Äܲ»ÖªµÀ²úÉúËÀËøµÄÓï¾äÊÇÄÄÒ»¾ä¡£¿ÉÒÔ½«³ÌÐò¹Ø±Õ²¢ÖØÐÂÆô¶¯¾Í¿ÉÒÔÁË¡£
¡¡¾³£ÔÚOracleµÄʹÓùý³ÌÖÐÅöµ½Õâ¸öÎÊÌ⣬ËùÒÔÒ²×ܽáÁËÒ»µã½â¾ö·½·¨¡£
¡¡¡¡1£©²éÕÒËÀËøµÄ½ø³Ì£º
sqlplus "/as sysdba" (sys/change_on_install)
SELECT s.username,l.OBJECT_ID,l.SESSION_ID,s.SERIAL#,
l.ORACLE_USERNAME,l.OS_USER_NAME,l.PROCESS
from V$LOCKED_OBJECT l,V$SESSION S WHERE l.SESSION_ID=S.SID;
¡¡¡¡2£©killµôÕâ¸öËÀËøµÄ½ø³Ì£º
¡
Ïà¹ØÎĵµ£º
¢Ù Ö»ÐèÔÚÎļþ TNSNames.ora ÖмÓÈëÒÔϽڵ㣬¼´¿É³É¹¦ÅäÖüàÌý
ORCL190 = //ºìÉ«²¿ÃÅΪÁ¬½Ó¼àÌýÃû×Ö
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.190)(PORT = 1521)) //ºìÉ«²¿ÃÅΪ·þÎñÆ÷ËùÔÚIPµØÖ· 1521Ϊ¶Ë¿ÚºÅ
(CONNECT_DATA ......
oracle¿Í»§¶Ë Á¬½ÓPL/SQL
ÏÂÔØ¿Í»§¶Ëµ½Ä³¸ö·¾¶
ÐÞ¸ÄÅäÖÃÎļþ
D:\oracle\product\10.2.0\db_1\NETWORK\ADMIN\tnsnames.ora
# tnsnames.ora Network Configuration File: D:\oracle\product\10.2.0\db_1\network\admin\tnsnames.ora
# Generated by Oracle configuration tools.
SQLCLUB =
(DESCRIPTION ......
1£© Ñ¡Ôñ×îÓÐЧÂʵıíÃû˳Ðò(Ö»ÔÚ»ùÓÚ¹æÔòµÄÓÅ»¯Æ÷ÖÐÓÐЧ)£º
ORACLEµÄ½âÎöÆ÷°´ÕÕ´ÓÓÒµ½×óµÄ˳Ðò´¦Àífrom×Ó¾äÖеıíÃû£¬from×Ó¾äÖÐдÔÚ×îºóµÄ±í(»ù´¡±í driving table)½«±»×îÏÈ´¦Àí£¬ÔÚfrom×Ó¾äÖаüº¬¶à¸ö±íµÄÇé¿öÏÂ,Äã±ØÐëÑ¡Ôñ¼Ç¼ÌõÊý×îÉٵıí×÷Ϊ»ù´¡±í¡£Èç¹ûÓÐ3¸öÒÔÉϵıíÁ¬½Ó²éѯ, ÄǾÍÐèҪѡÔñ½»²æ±í(intersection ......
Êý¾Ý×Öµädict×ÜÊÇÊôÓÚOracleÓû§sysµÄ¡£
¡¡¡¡1¡¢Óû§£º
¡¡¡¡¡¡select username from dba_users;
¡¡¡¡¸Ä¿ÚÁî
¡¡¡¡¡¡alter user spgroup identified by spgtest;
¡¡¡¡2¡¢±í¿Õ¼ä£º
¡¡¡¡¡¡select * from dba_data_files;
¡¡¡¡¡¡select * from dba_tablespaces;//±í¿Õ¼ä
¡¡¡¡¡¡select tablespace_name,sum(bytes), sum ......
ÓÐʱºò£¬ÐèÒªÔÚÁ½¸öOracleÊý¾Ý¿âÖ®¼äÊÖ¹¤Í¬²½Êý¾Ýʱ£¬DBLinkÊÇ×î·½±ã¿ì½ÝµÄÊÖ¶ÎÖ®Ò»£¬´´½¨DBLinkµÄ·½Ê½Ò»°ãÊÇÕâÑù£º
create public database link <DBLinkÃû³Æ> connect to <±»Á¬½Ó¿âµÄÓû§Ãû> identified by <±»Á¬½Ó¿âµÄÃÜÂë> using '< ......