i have this problem, into my oracle db i have too much cursor still opened that increase the mamory usage. The cursor was opened by C# and i can't modify the program.
Is it possible to close all cursor open in a session from oracle with a query withous close session?
Only the session that opened the cursor can close the cursor; you cannot close cursors from another session.
This means that your solutions are:
Fix the C# program that opened the cursors. (See java.sql.SQLException: - ORA-01000: maximum open cursors exceeded for some generic advice on this);
Kill the session that the C# program is using, which will automatically close all its cursors (and hope that the application is robust enough to recover and open a new session); or
Change the database settings to increase the maximum number of cursors (this may not fix the problem but it may delay it; however, it may cause other problems if the database starts using too many resources to manage all those open cursors).
Related
i am using Toad for Oracle V11.
And i'm already using View>Toad Options> File to execute on new connections to set some parameters when i start a new connection.
Here is also the option File to load on startup, but here i can only select a single file to open on startup. But I always need three different scripts when I open Toad and i don't want to merge them to one file.
Is it somehow possible to always open those three different scripts when i open toad?
You can't do that, as far as I can tell.
See whether creating a project (using the Project Manager; it's the 6th icon in my TOAD 14 toolbar) helps, as you can add folders or folder items (that would be your scripts) to it.
After I run a query, SELECT SomeColumn FROM SomeTable, via the command window in VFP, I'm unable to access that table from C# using the OleDb Provider until I close VFP.
System.Data.OleDb.OleDbException: 'Cannot open file \\some-server\some-share\SomeTable.dbf.'
It's like VFP is not closing the file handle after executing the query.
How do tell VFP to close the file/table w/o having to close VFP?
use
without any argument closes the table\cursor in current work area.
use in (select('SomeTable'))
closes it in any work area, only if it is open.
Both commands are scoped to current data session. If you are using any sessions other than the default one, then you need to loop those sessions and close in there.
An easier way would be to execute:
set exclusive off
in VFP before opening any tables. Then the tables would be opened shared, and you could open them both from VFP and outside.
Or make that a permanent setting by going to Tools -> Options -> Data and unchecking "Open Exclusive":
BTW, I replied thinking about any table that you would open by using "use" or "select ... from thatTable".
Your question is vague though, maybe you mean the table is created as a result of the query (your query doesn't have that destination though). If that is the case, then the created table is in exclusive use until you close it (using one the commands at top).
I started to use Datagrip for my PL/SQL (school) projects that need the use of DBMS_OUTPUT.PUT_LINE. Before this I was using Oracle SQL developer and I was able to use DBMS_OUTPUT by adding the following:
SET serveroutput ON;
There is a related question that shows how to enable or disable showing the contents of the DBMS_OUTPUT buffer but this only works for the Database Console tool window. How can I apply this to any .sql file? Currently, I am copying the content of my .sql files and run it in the Console tool window but there must be a better way.
Turn on this setting in the Output pane:
I second the comment from Prometheos II. Jakob also seems to say the same.
As you might know, the .sql scratch files HAVE to be associated with a console.
You need to toggle the Enable SYS.DBMS_OUTPUT option icon in the associated console and you do see the effect when executing from the associated .sql file.
Steps:
Open your .sql file
Associate it with a console
Open the console and enable Enable SYS.DBMS_OUTPUT option
Go back to the .sql file and run your code. You'll be able to get the DBMS_OUTPUT in the console output.
Suboptimal design by JetBrains, but it works.
My IDE version: IntelliJ 2018.3 Ultimate (DataGrip uses the same code, I think)
Couldn't comment to existing sections due to low rep. Hence, added a new answer.
When everything else fails, read the documentation: Showing DBMS_OUTPUT for Oracle:
For Oracle, you can enable or disable showing the contents of the
DBMS_OUTPUT buffer in the output pane. To do that, use
the apropriate icon (note by LF; can't reference that image) on the toolbar
of the Database Console tool window (Ctrl+F8).
For all that are reading this for version(s) > 2021.1
You can enable the output in the connection properties.
Source
This also works for sql files in DataGrip. Like moscas writes you need to activate the output console toggle button 'Enable SYS.DBMS_OUTPUT'.
Also you need to wrap it with begin end:
begin
dbms_output.put_line('test');
end;
Finaly found it! The previous answer didn't read the question and answer for intelij instead of datagrip which have completely different interface.
For 2021.1 right click on the console list in the service window and there should be a enable DBMS_OUTPUT when you right click.
I'm new to PL/SQL Developer and have session problems.
Everytime I open an SQL file, Developer opens a new session to the database.
I have a limit of 2 sessions, so I can't open more then 2 SQL files at the same time.
I would like to open as many SQL files as I want with the same session.
Does PL/SQL Developer have settings for this somewhere?
I couldn't find it in Preferences but I hope there is one.
Thanks!
In the menu Tools/Preferences "Oracle Connection" chose "Session Mode" Single session or Dual session.
And restart plsql developer.
Say I open paint.exe from a c++ code using windows apis or just by clicking it.
After app opened up. I resized it(by hand or programmaticly) . And closed the app.
Next time I open it, it gives me the size from where I left off.
Is there a place where I can query the default size of apps(sizes when you see the apps when you first open it (for the very fist time) before you re size any windows)
And If i can, maybe I can call SetWindowPos to set the original position for that app.
Maybe this is not exactly a programming question.
This is always going to be different between applications.
Most application will remember their window size/position by using the registry. In the case of "paint", it stores this information in the registry at:
HKCU\Software\Microsoft\Windows\CurrentVersion\Applets\Paint\View
Notepad stores similar information in HKCU\Software\Microsoft\Notepad - in an entirely different schema of registry key values.