0

in SQL Developer when i get session information he return me this error message: (ORA-00942: "table or view does not exist"). Can i resolve this with add grant to privilege of my user? Wich command use for wich table or view system? Best Regards to all. Fabio.

1
1

enter image description here

SQL Developer runs the below query (which you can check by clicking the Run Report in SQL Worksheet button) for its session browser:

with vs as (select rownum rnum,
                            inst_id,
                            sid,
                            serial#,
                            status,
                            username,
                            last_call_et,
                            command,
                            machine,
                            osuser,
                            module,
                            action,
                            resource_consumer_group,
                            client_info,
                            client_identifier,
                            type,
                            terminal,
                            sql_id,
                            sql_child_number
                       from gv$session) 
           select vs.inst_id, vs.sid ,serial# serial, vs.sql_id, vs.sql_child_number,
                  vs.username "Username",
                  case when vs.status = 'ACTIVE' 
                            then last_call_et 
                       else null end "Seconds in Wait",
                  (select command_name from v$sqlcommand where command_type = vs.command ) "Command",
                  vs.machine "Machine",
                  vs.osuser "OS User", 
                  lower(vs.status) "Status",
                  vs.module "Module",
                  vs.action "Action",
                  vs.resource_consumer_group,
                  vs.client_info,
                  vs.client_identifier
             from vs 
            where vs.USERNAME is not null
              and nvl(vs.osuser,'x') <> 'SYSTEM'
              and vs.type <> 'BACKGROUND'
              order by 1,2,3

Based on that, grants needed:

grant select on sys.gv_$session to your_user;
grant select on sys.v_$sqlcommand to your_user;

You may need additional privileges for other options.

1
  • Hi Balazs Papp, into the SQL Developer i can't recover the sql statment, also following your indication (...which you can check by clicking the Run Report in SQL Worksheet button...).
    – Fabio Z.
    Sep 1 '20 at 11:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.