oracle11g - How to find schema name in Oracle ? when you are connected in sql session using read only user -


i connected oracle database read user , used service name while setting connection in sql developer hence dont know sid ( schema ).

how can find out schema name connected ?

i looking because want generate er diagram , in process @ 1 step asks select schema. when tried select user name , dint tables guess tables mapped schema user.

edit: got answer partially below sql frank provided in comment , gave me owner name schema in case. not sure if generic solution applicable cases.

select owner, table_name all_tables. 

edit: think above sql correct solution in cases because schema owner of db objects. either schema or owner both same. earlier understanding schema not correct , gone through question , found schema user.

frank/a_horse_with_no_name put in answer can accept it.

to create read-only user, have setup different user 1 owning tables want access.

if create user , grant select permission read-only user, you'll need prepend schema name each table name. avoid this, have 2 options:

  1. set current schema in session:
alter session set current_schema=xyz 
  1. create synonyms tables:
create synonym reader_user.table1 xyz.table1 

so if haven't been told name of owner schema, have 3 options. last 1 should work:

  1. query current schema setting:
select sys_context('userenv','current_schema') dual 
  1. list synonyms:
select * all_synonyms owner = user 
  1. investigate tables (with exception of well-known standard schemas):
select * all_tables owner not in ('sys', 'system', 'ctxsys', 'mdsys'); 

Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -