阅读更多
--查看表空间的dbf数据位置;
select name from v$datafile
--查看当前有哪些表空间
select dbf.tablespace_name,
dbf.totalspace "总量(M)",
dbf.totalblocks as 总块数,
dfs.freespace "剩余总量(M)",
dfs.freeblocks "剩余块数",
(dfs.freespace / dbf.totalspace) * 100 "空闲比例"
from (select t.tablespace_name,
sum(t.bytes) / 1024 / 1024 totalspace,
sum(t.blocks) totalblocks
from dba_data_files t
group by t.tablespace_name) dbf,
(select tt.tablespace_name,
sum(tt.bytes) / 1024 / 1024 freespace,
sum(tt.blocks) freeblocks
from dba_free_space tt
group by tt.tablespace_name) dfs
where trim(dbf.tablespace_name) = trim(dfs.tablespace_name)
--删除无用的表空间
DROP TABLESPACE CRM_ONLINE_SPACE INCLUDING CONTENTS AND DATAFILES CASCADE CONSTRAINTS
--新建表空间
create tablespace CJUAT
logging
datafile 'D:\oracle\changjiu01.dbf'
size 2048m
autoextend on
next 5m
extent management local;
--查看用户
select username,default_tablespace from dba_users;
---删除用户
drop user HXWMS cascade
---创建用户
create user weizhi identified by weizhi123
default tablespace CJLOGISTICS
temporary tablespace temp;
--给用户授权
grant connect,resource,dba to weizhi;