oracleά»¤³£ÓÃÓï¾ä
1¡¢²é¿´±í¿Õ¼äµÄÃû³Æ¼°´óС select t.tablespace_name, round(sum(bytes/(1024*1024)),0) ts_size from dba_tablespaces t, dba_data_files d where t.tablespace_name = d.tablespace_name group by t.tablespace_name; 2¡¢²é¿´±í¿Õ¼äÎïÀíÎļþµÄÃû³Æ¼°´óС select tablespace_name, file_id, file_name, round(bytes/(1024*1024),0) total_space from dba_data_files order by tablespace_name; 3¡¢²é¿´»Ø¹ö¶ÎÃû³Æ¼°´óС select segment_name, tablespace_name, r.status, (initial_extent/1024) InitialExtent,(next_extent/1024) NextExtent, max_extents, v.curext CurExtent From dba_rollback_segs r, v$rollstat v Where r.segment_id = v.usn(+) order by segment_name ; 4¡¢²é¿´¿ØÖÆÎļþ select name from v$controlfile; 5¡¢²é¿´ÈÕÖ¾Îļþ select member from v$logfile; 6¡¢²é¿´±í¿Õ¼äµÄʹÓÃÇé¿ö select sum(bytes)/(1024*1024) as free_space,tablespace_name from dba_free_space group by tablespace_name; SELECT A.TABLESPACE_NAME,A.BYTES TOTAL,B.BYTES USED, C.BYTES FREE, (B.BYTES*100)/A.BYTES "% USED",(C.BYTES*100)/A.BYTES "% FREE" FROM SYS.SM$TS_AVAIL A,SYS.SM$TS_USED B,SYS.SM$TS_FREE C WHERE A.TABLESPACE_NAME=B.TABLESPACE_NAME AND A.TABLESPACE_NAME=C.TABLESPACE_NAME; 7¡¢²é¿´Êý¾Ý¿â¿â¶ÔÏó select owner, object_type, status, count(*) count# from all_objects group by owner, object_type, status; 8¡¢²é¿´Êý¾Ý¿âµÄ°æ±¾ Select version FROM Product_component_version Where SUBSTR(PRODUCT,1,6)='Oracle'; 9¡¢²é¿´Êý¾Ý¿âµÄ´´½¨ÈÕÆں͹鵵·½Ê½ Select Created, Log_Mode, Log_Mode From V$Database; 10¡¢²é¿´µ±Ç°ËùÓжÔÏó SQL> select * from tab; 11¡¢½¨Ò»¸öºÍa±í½á¹¹Ò»ÑùµÄ¿Õ±í SQL> create table b as select * from a where 1=2; SQL> create table b(b1,b2,b3) as select a1,a2,a3 from a where 1=2; 12¡¢²ì¿´Êý¾Ý¿âµÄ´óС£¬ºÍ¿Õ¼äʹÓÃÇé¿ö SQL> col tablespace format a20 SQL> select b.file_id ÎļþID, ¡¡¡¡b.tablespace_name ±í¿Õ¼ä, ¡¡¡¡b.file_name ÎïÀíÎļþÃû, ¡¡¡¡b.bytes ×Ü×Ö½ÚÊý, ¡¡¡¡(b.bytes-sum(nvl(a.bytes,0))) ÒÑʹÓÃ, ¡¡¡¡sum(nvl(a.bytes,0)) Ê£Óà, ¡¡¡¡sum(nvl(a.bytes,0))/(b.bytes)*100 Ê£Óà°Ù·Ö±È¡¡¡¡from dba_free_space a,dba_data_files b where a.file_id=b.file_id ¡¡¡¡group by b.tablespace_name,b.file_name,b.file_id,b.bytes order by b.tablespace_name ¡¡¡¡/ ¡¡¡¡dba_free_space --±í¿Õ¼äÊ£Óà¿Õ¼ä×´¿ö dba_data_files --Êý¾ÝÎļþ¿Õ¼äÕ¼ÓÃÇé¿ö 13¡¢²é¿´ÏÖÓлعö¶Î¼°Æä״̬ SQL> col segment format a30 SQL> SELECT SEGMENT_NAME,OWNER,TABLESPACE_NAME,SEGMENT_ID,FILE_ID,STATUS FROM DBA_ROLLBACK_SEGS; 14¡¢²é¿´Êý¾ÝÎļþ·ÅÖõÄ·¾¶ SQL> col file_name format a50 SQL> select tablespace_name,file_id,bytes/1024/1024,file_name from dba_data_files order by file_id; 15¡¢ÏÔʾµ±Ç°Á¬½ÓÓû§ SQL> show user 16¡¢°ÑSQL*Plusµ±¼ÆËãÆ÷ SQL> select 100*20 from dual; 17¡¢Á¬½Ó×Ö·û´® SQL> select ÁÐ1||ÁÐ2 from ±í1; SQL> select concat(ÁÐ1,ÁÐ2) from ±í1; 18¡¢²éѯµ±Ç°ÈÕÆÚ SQL> select to_char(sysdate,'yyyy-mm-dd,hh24:mi:ss') from dual; 19¡¢Óû§¼ä¸´ÖÆÊý¾Ý SQL> copy from user1 to user2 create table2 using select * from table1; 20¡¢ÊÓͼÖв»ÄÜʹÓÃorder by£¬µ«¿ÉÓÃgroup by´úÌæÀ´´ïµ½ÅÅÐòÄ¿µÄ SQL> create view a as select b1,b2 from b group by b1,b2; 21¡¢Í¨¹ýÊÚȨµÄ·½Ê½À´´´½¨Óû§ SQL> grant connect,resource to test identified by test; SQL> conn test/test
| |