oracle创建用户表空间

--本次因工作需要,为其他部门提供部分表数据,创建一个新用户与表空间。
--system用户
drop user sys_outside cascade;
drop tablespace sys_outside including contents and datafiles;

create tablespace sys_outside
datafile ‘/u01/app/oracle/oradata/dbxxx/sys_outside.dbf‘
size 100M autoextend on next 10M maxsize 20000M;

create user sys_outside identified by sys_outside default tablespace sys_outside ;

GRANT
CONNECT,
RESOURCE,
create synonym
TO sys_outside ;
--只在当前表空间有上述权限,如果想要在其他表空间也有权限,可执行以下命令
GRANT
CONNECT,
--RESOURCE,
--DBA,
unlimited tablespace,
create synonym,
CREATE SEQUENCE,
CREATE TABLE,
CREATE VIEW,
CREATE INDEX,
CREATE PROCEDURE,
CREATE DIRECTORY,
ALTER SESSION,
ALTER SEQUENCE,
ALTER TABLE,
ALTER VIEW,
ALTER INDEX,
ALTER PROCEDURE,
--ALTER DIRECTORY,
--DROP SESSION,
DROP SEQUENCE,
DROP TABLE,
DROP VIEW,
DROP INDEX,
DROP PROCEDURE,
--DROP DIRECTORY,
SELECT TABLE,
SELECT DICTIONARY,
INSERT TABLE,
UPDATE TABLE,
DELETE TABLE,
DEBUG ANY PROCEDURE,
DEBUG CONNECT SESSION,
execute any procedure
TO sys_outside ;


--给用户赋予查询其他表空前指定表、视图权限
grant select on SYS_TEST.ZK_VIEW to sys_outside;
grant select on SYS_TEST.ZK_COUNTRY_VIEW to sys_outside;

--登录新创建的用户,创建同义词,使查询语句更简洁
create or replace synonym ZK_VIEW for SYS_TEST.ZK_VIEW;
create or replace synonym ZK_COUNTRY_VIEW for SYS_TEST.ZK_COUNTRY_VIEW;


--当需要赋权的数据过多时,可执行以下语句,将结果复制选取自己想要的进行执行

-- 将结果集取出来,在sql种执行
select ‘grant select on ‘||owner||‘.‘||object_name||‘ to sys_outside;‘
from dba_objects
where owner in (SYS_TEST‘) and object_type=‘TABLE‘;

-- 将结果集取出来,在sql种执行select ‘create or replace synonym ‘||object_name||‘ for ‘||owner||‘.‘||object_name||‘;‘ from dba_objects where owner in (‘SYS_TEST‘) and object_type=‘TABLE‘;

相关文章

Java Oracle 结果集是Java语言中处理数据库查询结果的一种方...
Java AES和Oracle AES是现代加密技术中最常使用的两种AES加密...
Java是一种广泛应用的编程语言,具备可靠性、安全性、跨平台...
随着移动互联网的发展,抽奖活动成为了营销活动中不可或缺的...
Java和Oracle都是在计算机领域应用非常广泛的技术,他们经常...
Java 是一门非常流行的编程语言,它可以运行于各种操作系统上...