基本信息
源码名称:oracel 表空间建立以及建立用户sql语句
源码大小:0.71KB
文件格式:.rar
开发语言:SQL
更新时间:2019-06-17
   友情提示:(无需注册或充值,赞助后即可获取资源下载链接)

     嘿,亲!知识可是无价之宝呢,但咱这精心整理的资料也耗费了不少心血呀。小小地破费一下,绝对物超所值哦!如有下载和支付问题,请联系我们QQ(微信同号):813200300

本次赞助数额为: 2 元 
   源码介绍

表空间建立及检查表空间使用情况代码

--创建表空间
create tablespace assp  
logging  
datafile 'F:\oracle\product\10.2.0\oradata\orcl\yb.dbf' 
size 50m  
autoextend on  
next 50m maxsize 2048m  
extent management local;
--增大表空间
alter database datafile 'F:\oracle\product\10.2.0\oradata\orcl\grp.dbf' autoextend on next 1000m maxsize 5000m

-- Create the user 
create user YBDC identified by 123456
  default tablespace ASSP
  temporary tablespace TEMP
  profile DEFAULT
  password expire;
-- Grant/Revoke role privileges 
grant connect to YBDC with admin option;
grant dba to YBDC with admin option;
grant exp_full_database to YBDC with admin option;
grant imp_full_database to YBDC with admin option;
-- Grant/Revoke system privileges 
grant alter profile to YBDC;
grant alter session to YBDC;
grant alter tablespace to YBDC;
grant unlimited tablespace to YBDC with admin option;


--检查表空间使用情况
select a.tablespace_name, total, free, total-free as used, substr(free/total * 100, 1, 5) as "FREE%", substr((total - free)/total * 100, 1, 5) as "USED%" from 
(select tablespace_name, sum(bytes)/1024/1024 as total from dba_data_files group by tablespace_name) a, 
(select tablespace_name, sum(bytes)/1024/1024 as free from dba_free_space group by tablespace_name) b
where a.tablespace_name = b.tablespace_name
order by a.tablespace_name;