oracle应用-表空间.用户名.权限

oracle 数据库应用 虽然代码少但是很实用!


--01.表空间
create tablespace tp_hr
datafile
'E: p_hr01.dbf' size 10M,
'E: p_tak.dbf' size 10M autoextend on;

alter tablespace tp_hr add datafile 'E: p_hr02.dbf' size 10M

--02.创建用户
create user Ah_r
identified by bdqn
default tablespace tp_hr
temporary tablespace temp
quota 10M on tp_bak
password expire
--03.给新添加的用户授权
Grant connect,resource to Ah_r
--04.建立一张表
create table Stu
(
sid number primary key not null,
sname nvarchar2(20)
)
--05.给scott用户访问Stu的权限
grant select on Stu to scott
--06.同义词
1.用system账户登录,让Ah_r具有创建同义词权限
grant create public synonym to Ah_r;
2.用Y2160账户登录创建一个同义词
create public synonym ah_table for Ah_r.Stu;
3.将查询ah_table的权限授予scott这个用户
grant select on ah_table to scott;
4.在scott模式下访问同义词就访问到了
select * from ah_table;

原文地址:https://www.cnblogs.com/xiaotangtang/p/5121383.html