如何查询oracle数据库默认用户表空间大小 Oracle查询用户表空间select*from user_all_tables;select*from user_source;select*from all_users;select*from dba_users select*from v$Session;SELECT*FROM USER_ROLE_PRIVS;select*from session_privs;SELECT*FROM DBA_ROLE_PRIVS;select*from dba_roles;SELECT NAME FROM V$DATABASE;select a.file_id\"FileNo\",a.tablespace_name\"Tablespace_name\",a.bytes\"Bytes\",a.bytes-sum(nvl(b.bytes,0))\"Used\",sum(nvl(b.bytes,0))\"Free\",sum(nvl(b.bytes,0))/a.bytes*100\"%freefrom dba_data_files a,dba_free_space bwhere a.file_id=b.file_id(+)group by a.tablespace_name,a.file_id,a.bytesorder by a.tablespace_name;
如何在Oracle中查看各个表,表空间占用空间的大小 在Oracle中查看各表及表空间占用空间大e79fa5e98193e58685e5aeb931333339663932小可用sql语句执行查看。Oracle版本:Oracle 10g一、查看表占用空间大小语句:select t.segment_name,t.segment_type,sum(t.bytes/1024/1024)\"占用空间(M)from dba_segments twhere t.segment_type='TABLE'group by OWNER,t.segment_name,t.segment_type;查询结果:二、查看表空间占用空间大小语句:select a.tablespace_name,a.bytes/1024/1024\"Sum MB\",(a.bytes-b.bytes)/1024/1024\"used MB\",b.bytes/1024/1024\"free MB\",round(((a.bytes-b.bytes)/a.bytes)*100,2)\"percent_usedfrom(select tablespace_name,sum(bytes)bytes from dba_data_files group by tablespace_name)a,(select tablespace_name,sum(bytes)bytes,max(bytes)largest from dba_free_space group by tablespace_name)bwhere a.tablespace_name=b.tablespace_nameorder by((a.bytes-b.bytes)/a.bytes)desc查询结果:
如何查看oracle中某个用户占用表空间大小情况 可以通过以下语句查看所有的表空间大小:sql:SELECT C.TABLESPACE_NAME,A.BYTES/1048576 MEGS_TOTAL,(A.BYTES-B.BYTES)/1048576 MEGS_USED,B.BYTES/1048576 MEGS_FREE,(A.BYTES-B.BYTES)/A.BYTES*100 PCT_USED,B.BYTES/A.BYTES*100 PCT_FREEFROM(SELECT TABLESPACE_NAME,SUM(A.BYTES)BYTES,MIN(A.BYTES)MINBYTES,MAX(A.BYTES)MAXBYTES FROM SYS.DBA_DATA_FILES AGROUP BY TABLESPACE_NAME)A,(SELECT A.TABLESPACE_NAME,NVL(SUM(B.BYTES),0)BYTESFROM SYS.DBA_DATA_FILES A,SYS.DBA_FREE_SPACE B WHERE A.TABLESPACE_NAME=B.TABLESPACE_NAME(+)AND A.FILE_ID=B.FILE_ID(+)GROUP BY A.TABLESPACE_NAME)B,SYS.DBA_TABLESPACES CWHERE A.TABLESPACE_NAME=B.TABLESPACE_NAME(+)AND A.TABLESPACE_NAME=C.TABLESPACE_NAME ORDER BY 6;备注:如果是查询特定的可以在外面在嵌套一层select*from(sql)t1 where t1.TABLESPACE_NAME='表空间名称'的形式即可。
oracle中怎么查看一个用户所占的空间。用pl/sql能看嘛?还有怎么看表空间还剩多少 查看一个用户所占的空间用该用户登录selectsum(bytes)/1024/1024 MBfrom user_extents u查看表空间还剩多少,用这个,还能看每个文件情况selectb.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 bwhere a.file_id=b.file_idgroup by b.tablespace_name,b.file_name,b.file_id,b.bytesorder by b.tablespace_name