oracle创建表空间、创建用户以及授权、查看权限

发布时间:2020-10-29编辑:脚本学堂
有关oracle表空间创建的方法,以及oracle用户授权、用户权限的操作实例,需要的朋友参考下。

1、创建临时表空间
 

create temporary tablespace test_temp
tempfile 'c:oracleproduct10.1.0oradataorcltest_temp01.dbf'
size 32m
autoextend on
next 32m maxsize 2048m
extent management local;

2、创建表空间
 

create tablespace histdb
datafile 'd:oracleproduct10.2.0oradatazjgistest_temp03.dbf'
size 32m
autoextend on
next 32m maxsize 2048m
extent management local;

3、创建用户并指定表空间
 

create user username identified by password
default tablespace test_data
temporary tablespace test_temp;

4、给用户授予权限
 

grant
create session, create any table, create any view ,create any index, create any procedure,
alter any table, alter any procedure,
drop any table, drop any view, drop any index, drop any procedure,
select any table, insert any table, update any table, delete any table
to username;

5、oracle表空间创建步骤
 

/*第1步:创建临时表空间 */
create temporary tablespace user_temp
tempfile 'D:oracleoradataOracle9iuser_temp.dbf'
size 50m
autoextend on
next 50m maxsize 20480m
extent management local;

/*第2步:创建数据表空间 */
create tablespace user_data
logging
datafile 'D:oracleoradataOracle9iuser_data.dbf'
size 50m
autoextend on
next 50m maxsize 20480m
extent management local;

/*第3步:创建用户并指定表空间 */
create user username identified by password
default tablespace user_data
temporary tablespace user_temp;

/*第4步:给用户授予权限 */
grant connect,resource,dba to username;

6、查看用户权限----
 

--查看所有用户
select * from dba_users;
select * from all_users;
select * from user_users;

--查看用户系统权限
select * from dba_sys_privs;
select * from user_sys_privs;

2、查看用户对象或角色权限
 

--查看用户对象权限
select * from dba_tab_privs;
select * from all_tab_privs;
select * from user_tab_privs;

--查看所有角色
--查看所有用户
select * from dba_roles;

--查看用户或角色所拥有的角色
select * from dba_role_privs;

select * from user_role_privs;

--删除新建用户
--删除用户
drop user username
--删新建表空间
--删除用户
drop tablespace tablespacename