Oracle创建用户与授予表空间与权限

Oracle建立用户

建立:create user 用户名 identified by "密码";

oracle 表空间

一个数据库可以有多个表空间,一个表空间里可以有多个表。表空间就是存多个表的物理空间; 可以指定表空间的大小位置等。

建立表空间的定义

建立表空间(一般建N个存数据的表空间和一个索引空间):
create tablespace 表空间名
datafile ' 路径(要先建好路径)\***.dbf  ' size *M
tempfile ' 路径\***.dbf ' size *M
autoextend on  --自动增长
--还有一些定义大小的命令,看需要
 default storage(
 initial 100K,
 next 100k,
);

例子

创建表空间:create tablespace ts1 datafile 'C:\tablespace\ts1.dbf' size 50M;
自动扩展大小:create tablespace ts2 datafile 'C:\tablespace\ts2.dbf' size 50M autoextend on next 10M;
设置最大空间:create tablespace ts3 datafile 'C:\tablespace\ts3.dbf' size 50M autoextend on next 10M maxsize 1024M;
 
更改用户默认表空间:alter database default tablespace ts1;
表空间改名:alter tablespace ts1 rename to tss1;
删除表空间:drop tablespace ts2 including contents and datafiles;

授予用户使用表空间的权利

alter user 用户名 quota unlimited on 表空间;
或 alter user 用户名 quota *M on 表空间

授予用户的基本权限

授权:grant create session to 用户名;
            grant create table to  用户名;
            grant create tablespace to  用户名;
            grant create view to  用户名;
grant connect,resource to demo;
grant create any sequence to demo;
grant create any table to demo;
grant delete any table to demo;
grant insert any table to demo;
grant select any table to demo;
grant unlimited tablespace to demo;
grant execute any procedure to demo;
grant update any table to demo;
grant create any view to demo;
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值