您的位置:首页 > 数据库 > Oracle

oracle 建只读账号用来编写报表,或做BI

2018-09-11 18:17 375 查看
参考于:https://blog.csdn.net/lyxxwzj/article/details/80021237

[oracle@ftpc_prd ~]$ sqlplus /nolog

SQL*Plus: Release 11.2.0.4.0 Production on Tue Sep 11 15:14:41 2018

Copyright (c) 1982, 2013, Oracle.  All rights reserved.

SQL> conn /as sysdba
Connected.
SQL> create user macs identified by 123456 default tablespace pdsci;

create user macs identified by 123456 default tablespace pdsci
*

#创建用户名为macs 密码为:123456
SQL> create user macs identified by 123456 ;

User created.
#给他一些权限,包括连接权限,因为他要创建同义词,还需要给他同义
SQL> grant connect to macs;

Grant succeeded.

SQL> SQL> grant create synonym to macs;

Grant succeeded.

SQL> SQL> grant create session to macs;

Grant succeeded.
#查询某个账号上建的表
登陆建立账号的用:plsql

select 'grant select on '||owner||'.'||object_name||' to macs;' from dba_objects where owner in ('FTPC_AYO') and object_type='TABLE';

#查询某个账号 有的同义词

同义语
SELECT 'create or replace SYNONYM  macs. ' || object_name|| ' FOR ' || owner || '.' || object_name|| ';'  from dba_objects  where owner in ('FTPC_AYO') and object_type='TABLE';
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  Oracle