Search code examples
oracleoracle11gprivilegesysdba

Access table user in sysdba privilege


I created some tables as a normal user, and when I change the privilege to sysdba I didn't fiund my tables!
I get this message: table or view does not exist

This is what I do:
First of all, with a normal user's privilege I create tab1:

create table tab1 …;

and I insert some values, when I

select * from tab1;

all my rows are displayed, but when I connect as sysdba; with this current user, no row is displayed!!


Solution

  • When you login as sysdba, you literally become the the sys user, and as such, you're connected to the sys schema, not your own:

    sqlplus kjohnston as sysdba
    *connected*
    SQL> show user;
    USER is "SYS"
    

    Since you are in the sys schema, you have to reference your tables in your schema by prefixing the tablename with the schema name, as in:

    select * from kati_ais.tab1;  //assuming kati_ais is your schema name
    

    As a side note, you should not get in the habit of logging in as sysdba unless you really need those higher level privileges for that session.