Home
All Oracle Error Codes
Oracle DBA Forum

Frequent Oracle Errors

TNS:could not resolve the connect identifier specified
Backtrace message unwound by exceptions
invalid identifier
PL/SQL compilation error
internal error
missing expression
table or view does not exist
end-of-file on communication channel
TNS:listener unknown in connect descriptor
insufficient privileges
PL/SQL: numeric or value error string
TNS:protocol adapter error
ORACLE not available
target host or object does not exist
invalid number
unable to allocate string bytes of shared memory
resource busy and acquire with NOWAIT specified
error occurred at recursive SQL level string
ORACLE initialization or shutdown in progress
archiver error. Connect internal only, until freed
snapshot too old
unable to extend temp segment by string in tablespace
Credential retrieval failed
missing or invalid option
invalid username/password; logon denied
unable to create INITIAL extent for segment
out of process memory when trying to allocate string bytes
shared memory realm does not exist
cannot insert NULL
TNS:unable to connect to destination
remote database not found ora-02019
exception encountered: core dump
inconsistent datatypes
no data found
TNS:operation timed out
PL/SQL: could not find program
existing state of packages has been discarded
maximum number of processes exceeded
error signaled in parallel query server
ORACLE instance terminated. Disconnection forced
TNS:packet writer failure
see ORA-12699
missing right parenthesis
name is already used by an existing object
cannot identify/lock data file
invalid file operation
quoted string not properly terminated

Re: dblink in PL/SQL block..

Edgar Chupit

2006-01-23

Replies:
Dear Onkar,

First of all to query dynamic performance views from remote
destination, you should grant your dblink user access to underlying
view/fixed table. In your case you should grant select on v_$session
and v_$sqltext_with_newlines to your dblink user. For example, suppose
that I have dblink trex_tt that will connect using user zulu
credentials:

SQL> grant select on v_$session to zulu;
Grant succeeded

SQL> grant select on v_$sqltext_with_newlines to zulu;
Grant succeeded

After that you can run your queries to
v$session/v$sqltext_with_newlines to query from dblink.

Than after small changed in your code, it compiles and executes just
fine (I've changed line 14 and 25):

SQL> create or replace procedure showsql as
2 --   x number;
3    cursor c1 is
4  select username||'('||sid||','||serial#||
5            ') ospid = ' || process ||
6            ' program = ' || program username,
7          to_char(LOGON_TIME,' Day HH24:MI') logon_time,
8          to_char(sysdate,' Day HH24:MI') current_time,
9          sql_address, LAST_CALL_ET
10       from v$session@(protected)
11      where status = 'ACTIVE'
12       and rawtohex(sql_address) <> '00'
13       and username is not null order by last_call_et;
14    cursor c2(x c1%rowtype) is
15  select max(decode(piece,0,sql_text,null)) ||
16                   max(decode(piece,1,sql_text,null)) ||
17                   max(decode(piece,2,sql_text,null)) ||
18                   max(decode(piece,3,sql_text,null))
19                      sql_text
20               from v$sqltext_with_newlines@(protected)
21               where address = x.sql_address
22                and piece < 4;
23 begin
24    for x in c1 loop
25       for y in c2(x) loop
26         if ( y.sql_text not like '%listener.get_cmd%' and
27             y.sql_text not like '%RAWTOHEX(SQL_ADDRESS)%')
28         then
29            dbms_output.put_line( '--------------------' );
30            dbms_output.put_line( x.username );
31            dbms_output.put_line( x.logon_time || ' ' ||
32                           x.current_time||
33                           ' last et = ' ||
34                           x.LAST_CALL_ET);
35            dbms_output.put_line(
36                   substr( y.sql_text, 1, 250 ) );
37         end if;
38       end loop;
39    end loop;
40 end;
41
42
43 /

Procedure created.

SQL> sho err
No errors.


On 1/23/06, Onkar N Tiwary <onkarnath.tiwary@(protected):
> hi all,
>
> I have one small problem. Below is my query which is running on the sql
> prompt:
>
>
> Any idea???????
>
> --
> Thanks & Regards,
> T. Onkar Nath
> OneAPPS Enterprise Technology Pvt. Ltd.
>     to_onkar@(protected)
>     onkarnath.tiwary@(protected)
>


--
Best regards,
Edgar Chupit
callto://edgar.chupit
--
http://www.freelists.org/webpage/oracle-l