表空间名称及状态等信息:
SELECT * FROM dba_tablespaces;
表空间的创建语句:
SELECT DBMS_METADATA.GET_DDL('TABLESPACE', TS.tablespace_name)
FROM DBA_TABLESPACES TS;
----查看数据库表空间的信息
select *from v$datafile;
Select *--Segment_Name,Sum(bytes)/1024
From User_Extents Group By Segment_Name;
--1.查看剩余表空间大小
SELECT tablespace_name 表空间,sum(blocks*8192/1000000) 剩余空间M
FROM dba_free_space GROUP BY tablespace_name;
--2.检查系统中所有表空间总体空间
select b.name,sum(a.bytes/1000000)总空间
from v$datafile a,v$tablespace b where a.ts#=b.ts# group by b.name;
---修改表空间大小(物理文件的大小)
alter database datafile '/oracle/app/oradata/KFBOSS/datacenter.dbf' resize 3500M;
-----查看每个表空间的大小
Select Tablespace_Name,Sum(bytes)/1024/1024 From Dba_Segments Group By Tablespace_Name;
select segment_name, bytes
from user_segments
where segment_type = 'BOSS_PRODUCTSTR';
创建表空间:
create tablespace WEBTBS datafile '/oracle/app/oradata/KFBOSS/WEBTBS.dbf'
size 100M autoextend on next 200M
maxsize unlimited extent management local autoallocate segment space management auto;