Oracle创建用户、表空间及为用户指定表空间

-- 创建表空间  
 --语法: create tablespace 表空间名 datafile '路径' size 100M [aotuextend to];  
  create tablespace ytj_data 
   datafile 'D:/app/Administrator/oradata/ytj_data.DBF'  
   size 1000M  
   autoextend on;  
   
     
 --给表空间重命名  
 -- 语法: alter tablespace 旧名称 rename to 新名称;  
    alter tablespace newspace rename to myspace;  
      
-- 删除表空间  
--[including contents cascade constraints] 并把包含的数据和约束删除  
-- 语法: drop tablespace 表空间名 [including contents cascade constraints];  
    drop tablespace EHR_DATA including contents cascade constraints;  
      
      
-- 创建一个临时表空间  
   --语法: create temporary tablespace 临时表空间名 tempfile '路径' size 100M;  
   create temporary tablespace TEMP  
   tempfile 'd:/myspace/TEMP.dbf'  
   size 20M;  
     
-- 创建一个用户,并指定表空间和临时表空间  
   create user ytj  
   identified by ytj  
   default tablespace EHR_DATA  
   temporary tablespace TEMP;  
     
-- 一个新建的用户,是没有任何权限的,不能连接  
   -- 给用户授予权限  
    --连接数据库的权限  
    grant create session to lisi;  
    --创建表的权限  
    grant create table to lisi;  
    -- 使用表空间的权限  
    grant unlimited tablespace to lisi;  
      
-- 创建一张用户表  
  create table tb_user(  
    u_id number primary key ,  
    u_name varchar2(50),  
    u_pass varchar2(20)  
  );  




---查看表空间


select * from tablespace;


 

  • 0
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值