How do I work around the Oracle DBLinks limit in Entity Framework? - oracle

I am creating an MVC application using Oracle's Entity Framework, and am writing a bit of code to iterate through all relevant DBLinks and testing them out, returning a grid of results (success/fail). My problem is that after using the fourth DBLink, I get an error "ORA-02020: too many database links in use".
I have tried to explicitly close each DBLink after using it ("alter session close database link LinkName"), but I then receive an error "ORA-02080: database link is in use".
I have tried issuing "COMMIT" statement before attempting to close the DBLink, but that doesn't change the error ("database link is in use").
I have tried to closing the database connection, but I still receive the "database link is in use" error when I create a new connection and try to close the DBLink.
Unfortunately, increasing the number of DBLinks available (open_links, open_links_per_instance) is not an option.
Has anyone seen this with Entity Framework and discovered a solution? Does anyone have any ideas of what else to try?

VICTORY! I found that if I set "Pooling=false" in my connection string, then this error goes away in all of the offending scenarios. This is viable for me since this is just used to test the DBLinks on demand, so I can safely turn off pooling in this scenario. Thanks so much for your responses. I was ready to turn in the towel and admit defeat

To see how many db links are open i syour session use the GV$DBLINK view
select DB_LINK from GV$DBLINK;
DB_LI
-----
LEDRP
YDO
To close a db link you must do two things.
First commit or rollback the transaction. Note that even if you do not change anything a transaction is open due to the use of the DB LINK.
Second you must CLOSE DATABASE LINK using the ALTER SESSION statement.
rollback;
ALTER SESSION CLOSE DATABASE LINK LEDRP;
You see, that link is closed and appears not in the view:
select DB_LINK from GV$DBLINK;
DB_LI
-----
YDOV

Related

oracle - Schemas issues when migration from discoverer to OBIEE

I'm working on migrating some reports from Oracle Discoverer to OBIEE. I've already exported the layouts from discoverer to OBIEE. I have all I need in the OBIEE Admin tool now, but when I try to perform this operation:
I got this message:
I've read in many forums that this is because of the query (enter link description here) but I've executed the query in SQL Developer and all is fine.
Any idea?
Thanks,
I can see from the icon on your object that it is an Opaque View that your trying to run View Data on.
This is probably because of a syntax issue in your opaque view. Make sure the code in the opaque view doesn't end with a semi-colon or slash, that will cause problems. Try eliminating any blank lines, if there are any. However, without knowing exactly the syntax of the code it's impossible to say exactly what the cause is.
It's also possible that there is a connection script attached to the connection pool you are using to View Data, running on connection or before execution with bad syntax.
Otherwise have a look in the Admin Tool log to see if there's more information about what is causing the error. It will usually contain more detailed information than is passed back through the GUI.

Read only ODBC connection

Good Morning!
I'm working on a VB6 project which reads/writes to its database via an ODBC data source stored in the system. What I'm hoping to accomplish, is to temporarily set the ODBC connection to "Read Only" so that I can see what SQL the system would generate in particular scenario without it actually writing the change to the database. The application already takes care of logging all SQL queries. Is there a way to set the system ODBC connection to "Read Only" (within the "ODBC Data Source Administrator") immediately before I perform the action I care about within the system?
I appreciate any insight!
There is no connection parameter you can set to make the session read only. Your best bet is to either use a different user ID (that has only SELECT authority), although it would seem that this might cause your app to fail when it gets errors trying to perform inserts, updates and/or deletes.

VB6 user requested cancel of current operation Oracle error

I'm currently troubleshooting a VB6 application that sporadically comes up with the following error:
[Oracle][ODBC][Ora]ORA-01013: user requested cancel of current operation
All of the research I've done on this error states that it is either an actual request for cancellation by the user or a timeout. It can't be a request for cancellation because the input is coming in from an automated source, so it must be a timeout. One thing I read online was to un-check the query timeout checkbox in the DSN configuration box but my program uses a DSN-less connection to the database, which is an Oracle 10g database.
There are several queries in this program but it always fails on one query in particular, however I can't reproduce the error in a test environment using all of the same input to the program that caused the error in the first place.
A co-worker of mine suggested doing a rollback after each query even though the queries are read only because some kind of buffer might be getting filled up or something of the like, but this didn't work. At this point I don't even know how to continue troubleshooting it because I can't reproduce the error. If someone could give me any idea of what is going on and how to fix the problem I'd greatly appreciate it. Thanks in advance!
All of the options that you can choose when setting up a DSN can be specified in the connection string if you are using a DSN-less connection. If you want to disable query timeouts, you would add
QTO=F
to the connection string. So your new connection string would be something like
DRIVER={Oracle ODBC Driver};UID=Kotzwinkle;PWD=whatever;DBQ=instl_alias;QTO=F;

Is there a tool for tracing SQLs executed on Oracle

Is there a tool (that already comes with Oracle) for tracing SQLs that have been executed? In DB2 there is something called an 'event monitor' which I use to track the tables that have been updated. Is there an equivalent tool in Oracle?
I plan to
enable tracing
go on the website (that uses the db) and change an entry
disable tracing
see output file and record which table has been updated.
There is a table I am looking that should be updated when the entry is changed. I do not know what the name of the table is (and there are many tables), and so I need to trace the SQL executed to find out.
I have tried:
ALTER SESSION SET sql_trace = true;
-- go on website and change an entry
ALTER SESSION SET sql_trace = false;
tkprof the_trace_file.trc file.out EXPLAIN=system/manager SYS=no
However when following those steps above, no SQLs were recorded.
Is there a tool that Oracle provides? (I would like to avoid downloading external software)
There is a table I am looking that
should be updated when the entry is
changed. I do not know what the name
of the table is (and there are many
tables), and so I need to trace the
SQL executed to find out.
I'm thinking you are using the word "trace" here with another meaning than what is usually meant in the Oracle world.
You basically hit some button in the app, and by looking at what SQL queries are running, you want to find what table that code was referencing? Did I get it right?
In that case, you could have a look at v$sql, and look at columns SQL_TEXT and SQL_FULLTEXT.
The ALTER SESSION commands work at the session level (ie your current connection).
The website will use a different session (probably from a connection pool).
You can enable tracing for all sessions using the ALTER SYSTEM SET sql_trace = true;
The main reason you didn't get anything in the trace file is because you didn't do anything in the session where trace was enabled.
If you'd have done:
alter system set sql_trace = true;
-- fiddle around with the website
alter system set sql_trace = false;
You'd have gotten one or more trace files, one for each session which had activity while you were fiddling with the website.
The problem is that if the website uses connection pooling, your user activity may have been spread across several connections, and may be intermingled with other concurrent user activity.
Maybe Oracle Audit will help you.
Here is a good explanation: http://www.oracle-base.com/articles/10g/Auditing_10gR2.php
You have to enable audit by setting the parameter AUDIT_TRAIL.
That is at server level. You can audit at client level using a third party sql tracer for OCI:
http://sourceforge.net/projects/ocimonitor/
I find the Enterprise Manager the most useful tool for this. As has already been noted you have to alter the session that the web site is using and not your own. If you set your connection pool limit to 1 connection, you can easily find the session in the enterprise manager and then turn on the tracing. Usually a find the the top queries display in the enterprise manager tells me what queries are taking too long without having to trace anything.

Oracle ODP.NET BulkCopy to temporary table issue

I'm using BulkCopy method from ODP.NET to insert a DataTable to a temporary table.
If the temporary table is simple (no triggers or indexes) it works, fine, but as soon as I create an index or trigger, i get the "End-of-file on communication channel" error at BulkCopy.WriteToServer() method.
Any idea how could i fix this?
Thank you!
In case of an ORA-03113: end-of-file on communication channel, the server process dedicated to your session died because of a bug or error. The client process detects that the server process is missing and raises the ORA-03113. The server process has written its error message to the alert file. Check this file on the server to find out what went wrong. You may have to ask your DBA to do this for you.
Regards,
Rob.
I concur with the posters above. Check your alert log file. If you see an ORA-600 there, you (or your DBA) should contact Oracle support because you may need a patch.
Christian Shay
Oracle
Temporary tables in Oracle are almost always a bad idea. Can you re-design the program to use either a regular table or a PL/SQL collection?
I've contacted Oracle about this. Apparently it's a bug, that was fixed in 11g. They're now trying to release a patch

Resources