Home » SQL & PL/SQL » SQL & PL/SQL » Userenv getting in my way!
Userenv getting in my way! [message #2202] Thu, 27 June 2002 05:27 Go to next message
Tim Vistisen Baldwin
Messages: 3
Registered: June 2002
Junior Member
Hi I want to run a script that selects from v$ and dba views and inserts the results into a table in another database. The script I use looks like this:
insert into cc.tablespace_log@CC
SELECT f.instance_name,
t.tablespace_name,
t.totalspace_mb,
f.freespace_mb,
round((t.totalspace_mb - f.freespace_mb) * 100 / t.totalspace_mb, 2) "PCT_USED",
sysdate
FROM (SELECT f.tablespace_name "TABLESPACE_NAME",
round(sum(f.bytes/(1024*1024)), 2) "FREESPACE_MB",
i.instance_name
FROM dba_free_space f, v$instance i
GROUP BY f.tablespace_name, i.instance_name ) f,
-- TOTAL DATA VIEW
(SELECT t.name "TABLESPACE_NAME",
round(sum(d.bytes/(1024*1024)), 2) "TOTALSPACE_MB"
FROM v$tablespace t, v$datafile d
WHERE t.ts# = d.ts#
GROUP BY t.name) t
WHERE t.tablespace_name = f.tablespace_name;

If I run it on CC it works fine, If Comment out the insert statement and run it on another database it works fine. But when I run it on another database and try to insert the results into CC I get the folowing error:
ORA-02070: database CC does not support operator USERENV in this context

Why does this happen?
Re: Userenv getting in my way! [message #2205 is a reply to message #2202] Thu, 27 June 2002 06:39 Go to previous message
Mahesh Rajendran
Messages: 10707
Registered: March 2002
Location: oracleDocoVille
Senior Member
Account Moderator
I beleive this is reported bug.
Change the statement so that the insert is done locally, and the select
statement uses the DBLINK. or
Create a view for the select statement you are using. Then try the insert using the view to select from instead of the actual tables.
Previous Topic: Pl/SQL CURSORS
Next Topic: Re: Error: ORA-29540: class oracle/plsql/net/TCPConnection does not exist
Goto Forum:
  


Current Time: Thu Apr 25 01:44:42 CDT 2024