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;

猜你喜欢

转载自blog.csdn.net/qq_35029061/article/details/82715129