1. 查看Oracle创建过哪些用户
>select username from all_users;
2. 查看Oracle创建过哪些表空间,表空间的名字和大小
>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;
3. 查看表空间物理文件的名称及大小
>select tablespace_name,file_id,file_name,round(bytes/(1024*1024),0)
total_space from dba_data_files order by tablespace_name;
4. 查看表空间的使用情况
>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;
5. 增加表空间的的大小
A. >alter tablespace SYSAUX add datafile
'/opt/oracle/oradata/testdb/sysaux02.dbf' size 100M autoextend on;
B. >alter tablespace SYSAUX add datafile
'/opt/oracle/oradata/testdb/sysaux02.dbf' size 100M;
C. >alter database datafile '/opt/oracle/oradata/testdb/sysaux02.dbf'
resize 1000M;
6. 查看Oracle RAC上剩余的表空间
#export ORACLE_SID=+ASM1
#sqlplus / as sysdba
#select NAME,TOTAL_MB,FREE_MB from V$ASM_DISKGROUP;
DG_DATA 285122 6332