ORACLE SQLPLUS³£ÓÃÃüÁî¼°²éѯ
1.Æô¶¯Í£Ö¹TNS¼àÌý
lsnrctl start
lsnrctl stop
2.Æô¶¯Oracle Services
net start OracleServiceOrcl
net stop OracleServiceOrcl
SQL> show all --²é¿´ËùÓÐ68¸öϵͳ±äÁ¿Öµ
SQL> show user --ÏÔʾµ±Ç°Á¬½ÓÓû§
SQL> show error¡¡¡¡ --ÏÔʾ´íÎó
SQL> set heading off --½ûÖ¹Êä³öÁбêÌ⣬ĬÈÏֵΪON
SQL> set feedback off --½ûÖ¹ÏÔʾ×îºóÒ»ÐеļÆÊý·´À¡ÐÅÏ¢£¬Ä¬ÈÏֵΪ"¶Ô6¸ö»ò¸ü¶àµÄ¼Ç¼£¬»ØËÍON"
SQL> set timing on --ĬÈÏΪOFF£¬ÉèÖòéѯºÄʱ£¬¿ÉÓÃÀ´¹À¼ÆSQLÓï¾äµÄÖ´ÐÐʱ¼ä£¬²âÊÔÐÔÄÜ
SQL> set sqlprompt "SQL> " --ÉèÖÃĬÈÏÌáʾ·û£¬Ä¬ÈÏÖµ¾ÍÊÇ"SQL> "
SQL> set linesize 1000 --ÉèÖÃÆÁÄ»ÏÔʾÐÐ¿í£¬Ä¬ÈÏ100
SQL> set autocommit ON --ÉèÖÃÊÇ·ñ×Ô¶¯Ìá½»£¬Ä¬ÈÏΪOFF
SQL> set pause on --ĬÈÏΪOFF£¬ÉèÖÃÔÝÍ££¬»áʹÆÁÄ»ÏÔʾֹͣ£¬µÈ´ý°´ÏÂENTER¼ü£¬ÔÙÏÔʾÏÂÒ»Ò³
SQL> set arraysize 1 --ĬÈÏΪ15
SQL> set long 1000 --ĬÈÏΪ80
Áгöµ±Ç°Óû§ÏÂËùÓÐͬÒå´ÊµÄ¶¨Ò壬¿ÉÓÃÀ´²âÊÔͬÒå´ÊµÄÕæʵ´æÔÚÐÔ
select 'desc '||tname from tab where tabtype='SYNONYM';
²éѯµ±Ç°Óû§ÏÂËùÓбíµÄ¼Ç¼Êý
select 'select '''||tname||''',count(*) from '||tname||';' from tab where tabtype='TABLE';
°ÑËùÓзûºÏÌõ¼þµÄ±íµÄselectȨÏÞÊÚÓèΪpublic
select 'grant select on '||table_name||' to public;' from user_tables where ¡¶Ìõ¼þ¡·;
ɾ³ýÓû§Ï¸÷ÖÖ¶ÔÏó
select 'drop '||tabtype||' '||tname from tab;
ɾ³ý·ûºÏÌõ¼þÓû§
select 'drop user '||username||' cascade;' from all_users where user_id>25;
ÏÂÃæ°´Àà±ðÁгöһЩORACLEÓû§³£ÓÃÊý¾Ý×ÖµäµÄ²éѯʹÓ÷½·¨¡£
1¡¢Óû§
²é¿´µ±Ç°Óû§µÄȱʡ±í¿Õ¼ä
SQL>select username,default_tablespace from user_users;
²é¿´µ±Ç°Óû§µÄ½ÇÉ«
SQL>select * from user_role_privs;
²é¿´µ±Ç°Óû§µÄϵͳȨÏÞºÍ±í¼¶È¨ÏÞ
SQL>select * from user_sys_privs;
SQL>select * from user_tab_privs;
2¡¢±í
²é¿´Óû§ÏÂËùÓеıí
SQL>select * from user_tables;
²é¿´Ãû³Æ°üº¬log×Ö·ûµÄ±í
SQL>select object_name,object_id from user_objects
where instr(object_name,'LOG')>0;
²é¿´Ä³±íµÄ´´½¨Ê±¼ä
SQL>select object_name,created from user_objects where object_name=upper('&tabl
Ïà¹ØÎĵµ£º
oracle×ö²éѯÓï¾äµÄʱºò£¬ÀàËÆselect id in (xxxx,xxxx.....)ÕâÑùµÄÓï¾ä×î´óÖ»Ö§³Ö2000¸öÖµ£¬Èç¹û¶ÔÓ¦µÃÖµÉÏÍòÐУ¬Èç¸ÃÈçºÎ´¦ÀíÁË¡£
ÕâʱºòÓ¦¸Ã²ÉÓÃÁÙʱ±í¡£½¨Ò»¸öÁÙʱ±í£¬°ÑÊý¾Ýµ¼Èë½øÈ¥¡£²éѯʱºòÁª±í²éѯ¼È¿É¡££¨ÒÔÉÏÊÇÎÒ¹¤×÷ÖÐÓöµ½µÄÒ»¸öÐèÇó) ......
oracle´Ó9i¿ªÊ¼Ö§³ÖÒ»ÖÖеÄÊý¾ÝÀàÐÍ---- xmltype£¬ÓÃÓÚ´æ´¢ºÍ¹ÜÀíxmlÊý¾Ý£¬²¢ÌṩÁ˺ܶàµÄfunctions£¬ÓÃÀ´Ö±½Ó¶ÁÈ¡xmlÎĵµºÍ¹ÜÀí½Úµã¡£ÏÂÃ潫½éÉÜxmltypeµÄһЩ»ù±¾Ê¹Óá£
1.½¨Á¢º¬ÓÐxmltypeÊý¾ÝÀàÐ͵ıí
create table abc (id number,xmldoc sys.xmltype);
ÉùÃ÷xmltypeÐÍ×Ö¶ÎÓÃ:sys.xmltype
2.Ïò´øÓÐxmltypeÀàÐ͵ıí ......
ORACLE SQLÐÔÄÜÓÅ»¯´ó×ܽá
1£© Ñ¡Ôñ×îÓÐЧÂʵıíÃû˳Ðò(Ö»ÔÚ»ùÓÚ¹æÔòµÄÓÅ»¯Æ÷ÖÐÓÐЧ)£º
" ?; J) n+ v8 J- v" q OracleµÄ½âÎöÆ÷°´ÕÕ´ÓÓÒµ½×óµÄ˳Ðò´¦Àífrom×Ó¾äÖеıíÃû£¬from×Ó¾äÖÐдÔÚ×îºóµÄ±í(»ù´¡±í driving table)½«±»×îÏÈ´¦Àí£¬ÔÚfrom×Ó¾äÖаüº¬¶à¸ö±íµÄÇé¿öÏÂ,Äã±ØÐëÑ¡Ôñ¼Ç¼ÌõÊý×îÉٵıí×÷Ϊ»ù´¡±í¡ ......
ºÜ²»ÐÒ£¬½¨Á¢µÄ±í±»Ä³ÈËÎóɾÁË£¬£¬£¬
»¹ºÃ¿ÉÒÔͨ¹ýÕâÑù»Ö¸´¡£
select * from user_recyclebin where original_name like 'FINANCE_%' order by droptime desc;
FLASHBACK TABLE FINANCE_CASE_FEE_ITEM TO BEFORE DROP
¼´ËùÓÐdropµÄ±í¶¼ÔÚ user_recyclebin Õâ¸öoracle»ØÊÕÕ¾ÀïÃæµÄ£¬ÔÙͨ¹ýflashbackÃü ......