oracle 建只讀賬號用來編寫報表,或做BI 原

參考於: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';

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章