2009年1月7日 星期三

常用的SQL Command

由於同事問到,所以把一些之前收集的Sql command 貼出來,方便找~
最近發現一堆檔案都不知道放去哪...所以還是丟到blog上來吧

1. 加Table Space
alter tablespace SYSAUX add
datafile '/dev/vx/rdsk/dg01/vol86' size 1999M;

2. View % of free space
select 100 - ((select sum(bytes) from sys.dba_free_space where tablespace_name = 'TCLASSLOG') / (select sum(bytes) as usage from sys.dba_data_files where tablespace_name = 'TCLASSLOG') * 100 ) as Usage from dual
3. View partitions info
select * from sys.user_tab_partitions
4. View DB free space info
select * from sys.dba_free_space
select TABLESPACE_NAME, sum(BYTES)/1048576 as MB from sys.dba_free_space group by TABLESPACE_NAME order by TABLESPACE_NAME
5. View Data File (Doesn't include TEMP)
select * from sys.dba_data_files
select TABLESPACE_NAME, File_Name,BYTES/1048576 as "SIZE (MB)" from sys.dba_data_files order by TABLESPACE_NAME,File_Name

沒有留言: