Too many open cursors
Could someone help me understand this problem, and how to remedy it? We're getting warnings as the number of open cursors nears 1200. I've located the V$OPEN_CURSOR view, and after investigating it, this is what I think:
Currently:
SQL> select count(*)
2 from v$open_cursor;
COUNT(*)
535
1) I have one session open in the database, and 40 records in this view. Does that mean my cursors are still in the cursor cache?
2) Many of these cursors are associated with our analysts, and it looks like they are likely queries TOAD runs in order to gather meta-data for the interface. Can I overcome this?
3) I thought that the optimizer only opened a new cursor when a query that didn't match one in the cache was executed. When I run the following, I get 105 SQL statements with the same hash_value and sql_id, of which, they total 314 of the 535 open cursors (60% of the open cursors):
SQL> ed
Wrote file afiedt.buf
1 SELECT COUNT(*), SUM(cnt)
2 FROM (SELECT hash_value,
3 sql_id,
4 COUNT(*) as cnt
5 FROM v$open_cursor
6 GROUP BY hash_value, sql_id
7* HAVING COUNT(*) > 1)
SQL> /
COUNT(*) SUM(CNT)
104 314
4) Most of our connections in production will use Oracle Forms. Is there something we need to do in order to get Forms to use bind variables, or will it do so by default?
Thanks for helping me out with this.
-Chuck
CURSOR_SHARING=EXACT
OPEN_CURSORS=500
CURSOR_SHARING
From what I've read, cursor sharing is always in effect, although we have the most conservative method set. So I'm not sure how this affects things. Several identical queries are being submitted in several separate cursors.
OPEN_CURSORS
This value corresponds with the maximum number of cursors allowed for a single session. We're using shared servers, so I'm exactly sure if this is still 'per session' or 'per shared server', but 500 should be more than enough.
It sounds like you're suggesting that a warning is being triggered based upon our init params. If that's the case, then what are people seeing as a limit for cursors on a 2-CPU Linux box with 2G of memory?
-Chuck
Similar Messages
-
Report causes too many open cursors
Hello there!
I've got the following situation:
I've a very heavy report used for generating our Users Manual. In Reports 6i this Report works fine, generating the Manual works.
In 10g the Report starts, and formats about 240 pages (in 6i I can generate over 1000 pages and more with this report), and cancels with the message "too many open cursors".
So I took a look at the open cursors:
In 6i there are about 100 open cursors caused by this report; in 10g there are...uhm...in all cases to much for the max_open_cursors parameter of the database (standard value which is used by our application is 1000; increasing this to e.g. 5000 resulted in the same behaviour => too many open cursors).
Checked the open cursors while running the report which showed the following behaviour:
The report formats about 230 pages, and opens about 20 cursors (~30 sec.). for the next 10 sites the report opens the pending 980 cursors (~5 sec.), and stops formatting...
So it seems the report server causes some bad recursion: When restarting the reports server and re-running the report, I get sometimes the following error:
Mit Fehler beendet: REP-536870981: Interner Fehler REP-62204: Interner Fehler beim Schreiben des Bildes BandCombine: a row of the matrix does not have the correct number of entries, should be OpImage.getExpandedNumBands(source0.getSampleModel(), source0.getColorModel()) + 1.. REP-0069: Interner Fehler REP-50125: Exception abgefangen: java.lang.NullPointerException REP-0002: Unable to retrieve a string from the Report Builder message file. REP-536870981:
or maybe the report server tries to paralellize some querys (as this report consists of about 5 querys)?
As said - this is a very complex report (my colleague spent about 3 months of his life with creating it and that's not why he is a lamer in reports ;-)) so it's very hard to give you a repcase, but if anyone knows some advice like "edit the <repservername>.conf; append 'DO NEVER EVER PARALLELYZE QUERYS' to the config" or something this would be very useful ;-).
many thanks
best regards
ChristianI've now located the problem:
The report consists of several querys based on a ref cursor; and this cursors are opend and not closed in 10g...
I'll open a SR on metalink....
best regards
Christian -
TOO many OPEN CURSORS during loop of INSERT's
Running ODP.NET beta2 (can't move up yet but will do that soon)
I don't think it is related with ODP itself but probably on how .Net works with cursors. We have a for/next loop that executes INSERT INTO xxx VALUES (:a,:b,:c)
statements. Apparently, when monitoring v$sysstat (current open cursors) we see these raising with 1 INSERT = 1 cursor. If subsequently we try to perform another action, we get max cursors exceeded. We allready set open_cursor = 1000, but the number of inserts can be very high. Is there a way to release these cursors (already wrote oDataAdaptor.dispose, oCmd.dispose but this does not help.
Is it normal that each INSERT has it's own cursor ? they all have the same hashvalue in v$open_cursor. They seem to be released after a while, especially when moving to another asp.net page, but it's not clear when that happens and if it is possible to force the release of the (implicit?) cursors faster.
Below is a snippet of the code, I unrolled a couple of function-calls into the code so this is just an example, not sure it will run without errors like this, but the idea should be clear (the code looks rather complex for what it does but the unrolled functions make the code more generic and we have a database-independend datalayer):
Try
' Set the Base Delete statement
lBaseSql = _
"INSERT INTO atable(col1,col2,col3) " & _
"VALUES(:col1,:col2,:col3)"
' Initialize a transaction
lTransaction = oConnection.BeginTransaction()
' Create the parameter collection, containing for each
' row in the list the arguments
For Each lDataRow In aList.Rows
lOracleParamters = New OracleParameterCollection()
lOracleParameter = New OracleParameter("luserid", OracleDbType.Varchar2,
_ CType(aCol1, Object))
lOracleParamters.Add(lOracleParameter)
lOracleParameter = New OracleParameter("part_no", OracleDbType.Varchar2, _
CType(lDataRow.Item("col2"), Object))
lOracleParamters.Add(lOracleParameter)
lOracleParameter = New OracleParameter("revision", OracleDbType.Int32, _
CType(lDataRow.Item("col3"), Object))
lOracleParamters.Add(lOracleParameter)
' Execute the Statement;
' If the execution fails because the row already exists,
' then the insert should be considered as succesfull.
Try
Dim aCommand As New OracleCommand()
Dim retval As Integer
'associate the aConnection with the aCommand
aCommand.Connection = oConnection
'set the aCommand text (stored procedure name or SQL statement)
aCommand.CommandText = lBaseSQL
'set the aCommand type
aCommand.CommandType = CommandType.Text
'attach the aCommand parameters if they are provided
If Not (lOracleParameters Is Nothing) Then
Dim lParameter As OracleParameter
For Each lParameter In lOracleParameters
'check for derived output value with no value assigned
If lParameter.Direction = ParameterDirection.InputOutput _
And lParameter.Value Is Nothing Then
lParameter.Value = Nothing
End If
aCommand.Parameters.Add(lParameter)
Next lParameter
End If
Return
' finally, execute the aCommand.
retval = cmd.ExecuteNonQuery()
' detach the OracleParameters from the aCommand object,
' so they can be used again
cmd.Parameters.Clear()
Catch ex As Exception
Dim lErrorMsg As String
lErrorMsg = ex.ToString
If Not lTransaction Is Nothing Then
lTransaction.Rollback()
End If
End Try
Next
lTransaction.Commit()
Catch ex As Exception
lTransaction.Rollback()
Throw New DLDataException(aConnection, ex)
End TryI have run into this problem as well. To my mind
Phillip's solution will work but seems completey unnecessary. This is work the provider itself should be managing.
I've done extensive testing with both ODP and OracleClient. Here is one of the scenarios: In a tight loop of 10,000 records, each of which is either going to be inserted or updated via a stored procedure call, the ODP provider throws the "too many cursor errors at around the 800th iteration. With over 300 cursors being open. The exact same code with OracleClient as the provider never throws an error and opens up 40+ cursors during execution.
The applicaation I have updates a Oracle8i database from a DB2 database. There are over 30 tables being updated in near real time. Reusing the command object is not an option and adding all the code Phillip did for each call seems highly unnecessary. I say Oracle needs to fix this problem. As much as I hate to say it the microsoft provider seems superior at this point. -
Runtime Error - DBIF_RSQL_INVALID_RSQL - Too many OPEN CURSOR
When I try to train a Decision Tree Model via an APD process in RSANWB, I get a runtime error when my model is configured with too many parameter fields or too many leaves (with 2 leaves it works, with more it fails).
By searching SAP Notes I see that there are many references to this kind of runtime errors. But no note on occurences of it in RSANWB / RSDMWB .
Any information on this anyone?
Claudio Ciardelli
Runtime Errors DBIF_RSQL_INVALID_RSQL
Date and Time 29.07.2005 16:19:21
|ShrtText |
| Error in RSQL module of database interface. |
|What happened? |
| Error in ABAP application program. |
| |
| The current ABAP program "SAPLRS_DME_DECISION_TREE_PRED" had to be terminated |
| because one of the |
| statements could not be executed. |
| |
| This is probably due to an error in the ABAP program. |
| |
|Error analysis |
| The system attempted to open a cursor for a SELECT or OPEN CURSOR |
| statement but all 16 cursors were already in use. |
| The statement that failed accesses table "/BIC/0CDT000030 ". |
| The erroneous statement accesses table "/BIC/0CDT000030 ". |
|Trigger Location of Runtime Error |
| Program SAPLRS_DME_DECISION_TREE_PRED |
| Include LRS_DME_DECISION_TREE_PREDU06 |
| Row 103 |
| Module type (FUNCTION) |
| Module Name RS_DME_DTP_EVALUATE |
|Source Code Extract |
|Line |SourceCde |
| 73|* Prepare for Data evaluation |
| 74| CATCH SYSTEM-EXCEPTIONS OTHERS = 15. |
| 75| CREATE DATA ref TYPE (i_enum_dbtab). |
| 76| ASSIGN ref->* TO <fs_wkarea>. |
| 77| ASSIGN COMPONENT gv_class_dbposit OF STRUCTURE |
| 78| <fs_wkarea> TO <fs_class>. |
| 79| CREATE DATA ref TYPE TABLE OF (i_enum_dbtab). |
| 80| ASSIGN ref->* TO <ft_data>. |
| 81| |
| 82| ENDCATCH. |
| 83| IF sy-subrc = 15. |
| 84|* Error on Assignment. |
| 85| CALL FUNCTION 'RS_DME_COM_ADDMSG_NOLOG' |
| 86| EXPORTING |
| 87| i_type = 'E' |
| 88| i_msgno = 301 |
| 89| i_msgv1 = 'EVALUATION_PHASE' |
| 90| IMPORTING |
| 91| es_return = ls_return. |
| 92| APPEND ls_return TO e_t_return. |
| 93| EXIT. |
| 94| ENDIF. |
| 95| |
| 96|* For the un-trained Rec-Ids, evaluate..... |
| 97| REFRESH lt_recinp. |
| 98| APPEND LINES OF i_t_records TO lt_recinp. |
| 99| SORT lt_recinp . |
| 100|* Open Cursor.. |
| 101| DATA: l_curs TYPE cursor. |
| 102| DATA: l_psize TYPE i VALUE 10000. |
|>>>>>| OPEN CURSOR WITH HOLD l_curs FOR |
| 104| SELECT * FROM (i_enum_dbtab) |
| 105| WHERE rsdmdt_recid NOT IN |
| 106| ( SELECT rsdmdt_recid FROM |
| 107| (i_learn_tab) ). |
| 108| |
| 109|* Start Fetch... |
| 110| DO. |
| 111| FETCH NEXT CURSOR l_curs |
| 112| INTO CORRESPONDING FIELDS OF TABLE <ft_data> |
| 113| PACKAGE SIZE l_psize. |
| 114| IF sy-subrc NE space. |
| 115| EXIT. |
| 116| ENDIF. |
| 117| |
| 118|* Process records... |
| 119| LOOP AT <ft_data> ASSIGNING <fs_wkarea>. |
| 120| |
| 121|* Call Prediction Function. |
| 122| CALL FUNCTION 'RS_DME_DTP_PREDICT_STRUCTURE' |Hi Claudio,
well the message is very clear and I think in your case you need to split your model into a few somehow equal models, each not having more than 2 leaves.
Another option might be to do more things serially instead of parallel.
Hope it helps
regards
Siggi -
Too many open cursors exception caused by LRS Iterator
Using Kodo4.1.4 with Oracle10, and Large Result Set Proxies, I encountered
the error "maximum number of open cursors exceeded".
It seems to have been caused because of incomplete LRSProxy iterators within
the context of a single PersistenceManager. These iterators were over
collections obtained by reachability, not directly from Queries or Extents.
The Iterator is always closed, but the max-cursors exception still occurs.
Following is a pseudocode example of the case... Note that if the code is
refactored to remove the break; statement, then the program works fine, with
no max-cursors exception.
Any suggestions?
// This code pattern is called hundreds of times
// within the context of a PersistenceManager
Collection c = persistentObject.getSomeCollection(); // LRS Collection
Iterator i = c.iterator()
try
while(i.hasNext())
Object o = i.next();
if (someCondition)
break; // if this break is removed, everything is fine
finally
KodoJDOHelper.close(i);
}XSQL Servlet v. 0.9.9.1
Netscape Enterprise / JRUN 2.3.3 / Windows NT
I modified the document demo (insert request).
The XSQL document:
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="newdocinsform.xsl"?>
<page connection="demo" xmlns:xsql="urn:oracle-xsql">
<xsql:insert-request table="xmlclob" transform="newdocins.xsl"/>
<data>
<xsql:query null-indicator="yes" max-rows="4">
select id, doc
from xmlclob
order by id desc
</xsql:query>
</data>
</page>
The difference between this and your demo is the table: the table xmlclob has
ID NUMBER and DOC CLOB. No constraints were enforced, so I was inserting the ID and the DOC. Upon page reload, several rows with the same values were inserted.
I had a similar problem in the previous release.
As a general question, how can I configure the XSQLConfig file for optimal performance?
Although you provided default values, I'm not sure how much is necessary for connection pooling. -
ORA-01000: Too many open cursors -- Need Help
Hi All,
Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - 64bit Production
PL/SQL Release 11.1.0.7.0 - Production
I am getting error ora-01000 for the following procedures gather stats
Could you please guide how to get-rid-off this error.
thanks in advance;
CREATE OR REPLACE PROCEDURE SHEMA_NAME ANALYZE_TABLES IS
rec_table_name VARCHAR2 (30);
CURSOR c1
IS
SELECT table_name
FROM USER_tables; ------ 18000 table for this cursor
BEGIN
OPEN c1;
LOOP
FETCH c1 INTO rec_table_name;
EXIT WHEN c1%NOTFOUND;
-- block was hereÿÿÿ
BEGIN
DBMS_STATS.
GATHER_TABLE_STATS (
OWNNAME => 'SHEMA_NAME',
TABNAME => rec_table_name,
PARTNAME => NULL,
ESTIMATE_PERCENT => 30,
METHOD_OPT => 'FOR ALL COLUMNS SIZE AUTO',
DEGREE => 5,
CASCADE => TRUE);
END;
END LOOP;
CLOSE c1;
EXCEPTION
WHEN OTHERS
THEN
raise_application_error (
-20001,
'An error was encountered - ' || SQLCODE || ' -ERROR- ' || SQLERRM);
END;Look at the following:
SQL> begin
2 raise no_data_found;
3 end;
4 /
begin
ERROR at line 1:
ORA-01403: no data found
ORA-06512: at line 2
The error code the caller executing this code receive is -01403. A unique error number that has a known and specific meaning.
In addition, the error stack tells the caller that this unique error occurred on line 2 in the source code.
The caller knows EXACTLY what the error is and where it occurred.
SQL> begin
2 raise no_data_found;
3 exception when OTHERS then
4 raise_application_error(
5 -20000,
6 'oh damn some error happened. the error is '||SQLERRM
7 );
8 end;
9 /
begin
ERROR at line 1:
ORA-20000: oh damn some error happened. the error is ORA-01403: no data found
ORA-06512: at line 4
In this case the caller gets the error code -20000. It is meaningless as the same error code will be use for ALL errors (when OTHERS). So the caller will never know what the actual real error is.
For the caller to try and figure that out, it will need to parse and process the error message text to look for the real error code. A very silly thing to do.
In addition, the error stack says that the error was caused by line 4 in the code called.. except that this is the line that raised the meaningless generic error and not the actual line causing the error.
There are 3 basic reasons for writing an exception handler:
- the exception is not an error
- the exception is a system exception (e.g. no data found) and needs to be turned into meaningful application exceptions (e.g. invoice not found, customer not found, zip code not found, etc)
- the exception handler is used as a try..finally resource protection block (which means it re-raises the exception)
If your exception handler cannot tick one of these three reasons for existing, you need to ask yourself why you are writing that handler. -
TOO MANY OPEN CURSORS PROBLEM ... PLEASE HELP
Hi,
my problem is the following :
I got data from a system in flat file format. ( ascii, semicolon separated )
I wrote mapping classes to different tables and insert via Oracle thin driver.
The data I got isn't 100% consistent. It may happen that there are double
records for tables whith unique indexes.
I catched the Exception like in the segment below
Statement insertStmnt = null;
try{
insertStmnt = connection.createStatement();
insertStmnt.execute(insertString);
connection.commit(); // autocommit is diabled
} catch ( Exception sql ) {
System.out.println(sql.toString());
connection.rollback();
insertStmnt.close();
The Problem : when receiving the SQLException ( UNIQUE CONSTRAINT VIOLATED )
the cursor remains open.
After exeeding the open_cursors system property ( Oracle )
no more data is loaded.
( the input files contains sometimes more than one million rows )
Any suggestion to my Mail
[email protected]
ThanksHi!
Now you only close your statement when you catch an error. You will have to close it if things works out fine as well:
Statement insertStmnt = null;
try{
insertStmnt = connection.createStatement();
insertStmnt.execute(insertString);
connection.commit(); // autocommit is diabled
insertStmnt.close();
} catch ( Exception sql ) {
System.out.println(sql.toString());
connection.rollback();
insertStmnt.close();
Good luck!
/Tale -
ORA-29270: too many open HTTP requests
Hi,
We have a requirement like, we will get bulk data (2 GB) data file with different languages(Russian, chinese, Japanese, German) etc. and we need to load these data into our databse also we have to translate the same.
We are using Oracle 11g.
We had used Oracle httpuritype - And the below mentioned procedure PROCEDURE TEST.PRC_TRANS_GERMAN will call the function - trans_jef
Input parameter for PRC_TRANS_GERMAN - > To_language and from Language. and this procedure will store the translated word in the seperate table.
Input parameter for the function trans_jef - > Word to be translated , from languae, to_language. And this function will return the translated word.
The issue I am facing is when I am passing the table of around 10000 records, around 4000 rows are not getting translated. So when i try to capture the error in exception- the error is
ORA-29273: HTTP request failed
ORA-06512: at "SYS.UTL_HTTP", line 1819
ORA-29270: too many open HTTP requests
When I try to re execute the missed words, they were translated. But they are not getting translated in one go because of the too many http open request.
So could you please let me know how to resolve this ORA-29270 errror. I know we have to end the request and start again. But not sure how to do. Can some one help with this~!!!!
Translator
CREATE OR REPLACE FUNCTION trans_jef (v_RawText IN VARCHAR2,
v_SrcLang IN VARCHAR2,
v_DestLang IN VARCHAR2)
RETURN CLOB
IS
v_EscRawText VARCHAR2 (3000);
v_XlateUrl VARCHAR (3000);
--v_SrcLang Varchar(10) ;-- := 'de';
--v_DestLang Varchar(10) ; -- := 'en';
v_XlateResult CLOB;
l_result CLOB;
BEGIN
DBMS_OUTPUT.ENABLE (10000000);
v_EscRawText := UTL_URL.escape (v_RawText, TRUE, 'UTF-8');
v_XlateUrl :=
'http://translate.google.com/translate_a/t?client=t&text='
|| v_EscRawText
|| '&hl='
|| v_DestLang
|| '&sl='
|| v_SrcLang
|| '&tl='
|| v_DestLang
|| '&ie=UTF-8&oe=UTF-8&multires=1&oc=1&prev=btn&ssel=0&tsel=0&sc=1';
v_XlateResult := httpuritype (v_XlateUrl).getclob ();
-- dbms_output.put_line (v_XlateResult);
l_result := TRIM (BOTH '"' FROM REGEXP_SUBSTR (v_XlateResult, '"[^"]+"'));
RETURN l_result;
END;
/* Formatted on 07-09-2012 09:21:05 (QP5 v5.215.12089.38647) */
CREATE OR REPLACE PROCEDURE TEST.PRC_TRANS_GERMAN (TO_LANG1 IN VARCHAR2,
FROM_LANG1 IN VARCHAR2)
IS
P_CHINESE VARCHAR2 (3000);
FROM_LANG VARCHAR2 (3000);
FROM_LANG_CODE VARCHAR2 (3000);
TO_LANG_CODE VARCHAR2 (3000);
FROM_LANG_CODE1 VARCHAR2 (3000);
TO_LANG_CODE1 VARCHAR2 (3000);
cnt NUMBER := 1;
counter NUMBER;
CURSOR C1
IS
SELECT RAW_VAL_TXT FROM T_TRANS_VAL;
VC1 C1%ROWTYPE;
BEGIN
OPEN C1;
LOOP
FETCH C1 INTO VC1;
EXIT WHEN C1%NOTFOUND;
BEGIN
TO_LANG_CODE :=
CASE TO_LANG1
WHEN 'English' THEN 'en'
WHEN 'Chinese Simplified' THEN 'zh-CN'
WHEN 'Chinese Tradational' THEN 'zh-TW'
WHEN 'German' THEN 'de'
WHEN 'Japanese' THEN 'ja'
--other languages
END;
FROM_LANG_CODE :=
CASE FROM_LANG1
WHEN 'English' THEN 'en'
WHEN 'Chinese Simplified' THEN 'zh-CN'
WHEN 'Chinese Tradational' THEN 'zh-TW'
WHEN 'German' THEN 'de'
WHEN 'Japanese' THEN 'ja'
other languages
-- else 'auto'
END;
SELECT trans_jef (VC1.RAW_VAL_TXT, FROM_LANG_CODE, TO_LANG_CODE)
INTO P_CHINESE
FROM DUAL;
-- same translator function is used. Language used is simplied chinese.
-- We can use traditional Chinese as well ('zh-TW'), which works perfectly.
FROM_LANG_CODE1 := --decode(from_lang,'en','English','ar','Arabic', from_lang);
CASE FROM_LANG_CODE
WHEN 'en' THEN 'English'
WHEN 'zh-CN' THEN 'Chinese Simplified'
WHEN 'zh-TW' THEN 'Chinese Tradational'
WHEN 'de' THEN 'German'
WHEN 'ja' THEN 'Japanese'
--other languages
END;
TO_LANG_CODE1 := --decode(from_lang,'en','English','ar','Arabic', from_lang);
CASE TO_LANG_CODE
WHEN 'en' THEN 'English'
WHEN 'zh-CN' THEN 'Chinese Simplified'
WHEN 'zh-TW' THEN 'Chinese Tradational'
WHEN 'de' THEN 'German'
WHEN 'ja' THEN 'Japanese'
-- other languages
END;
INSERT INTO t_trans
VALUES (FROM_LANG_CODE1,
VC1.RAW_VAL_TXT,
TO_LANG_CODE1,
P_CHINESE);
COMMIT;
EXCEPTION
WHEN OTHERS
THEN
INSERT INTO excep_trans (P_WORD_EXP, UPDATE_TIME, COUNTER)
VALUES (VC1.RAW_VAL_TXT, SYSDATE, cnt);
INSERT INTO error_message
VALUES (DBMS_UTILITY.FORMAT_ERROR_STACK);
COMMIT;
END;
END LOOP;
CLOSE C1;
END;
/Edited by: 950814 on 6 Sep, 2012 11:16 PMSimply add the call to your exception hander. E.g.
EXCEPTION
WHEN OTHERS
THEN
UTL_TCP.Close_All_Connections;
INSERT INTO excep_trans (P_WORD_EXP, UPDATE_TIME, COUNTER)
VALUES (VC1.RAW_VAL_TXT, SYSDATE, cnt);
..etc..
END;Also consider using proper coding standards. There is NO modern day programming language standard that says to write (selective) reserved words in uppercase. Write in lowercase. Use camelcase and pascalcase for variable names and procedures/functions/methods. Restrict the use of uppercase to defining identifiers such as compiler macros or constants.
Do yourself a favour and read, understand and apply the basic naming standards as detailed in .Net Guidelines for Names and Code Conventions for the Java Programming Language. -
Too Many open connections. UTL_HTTP
I am submiiting The URL for multiple times.
So i am getting the too many open connections error. How to avoid the code.
For your reference i have attached my code.
DECLARE
req UTL_HTTP.REQ;
resp UTL_HTTP.RESP;
value VARCHAR2(1024);
url VARCHAR2(4000);
OPT varchar2(1000);
CURSOR MOB IS SELECT MOB FROM MOBILE_NUMBER;
BEGIN
-- UTL_HTTP.SET_PROXY('proxy.my-company.com', 'corp.my-company.com');
FOR I IN MOB
LOOP
DBMS_OUTPUT.PUT_LINE(I.MOB);
URL:='http://www.meru.co.in/wip/sendsms?username=11|'&'||'password=11|'&'||'to='||I.MOB||'&'||'message=this%20is%20shanmugam';
DBMS_OUTPUT.PUT_LINE(URL);
req := UTL_HTTP.begin_REQUEST(url);
UTL_HTTP.SET_HEADER(req, 'User-Agent', 'Mozilla/4.0');
resp := UTL_HTTP.GET_RESPONSE(req);
UTL_HTTP.READ_LINE(resp, value, TRUE);
DBMS_OUTPUT.PUT_LINE(value);
END LOOP;
UTL_HTTP.END_RESPONSE(resp);
EXCEPTION
WHEN UTL_HTTP.END_OF_BODY THEN
UTL_HTTP.END_RESPONSE(resp);
END;how to close the connection for each record????
Can anyone help me out in this??
Thanks in Advance.
Cheers,
ShanMove UTL_HTTP.END_RESPONSE(resp); inside the loop. I mean
UTL_HTTP.END_RESPONSE(resp);
END LOOP; -
hi
I am getting the following error while calling the procedure in the batch process
ORA-06512: at "SYS.UTL_HTTP", line 1022
ORA-29270: too many open HTTP requests
Could you please help me on this? As this is getting affected in the live databases.
ORA-06512: at "SYS.UTL_HTTP", line 1022
ORA-29270: too many open HTTP requests
CREATE OR REPLACE PROCEDURE Send_To_Spg(
PTRANSACTION_ID IN VARCHAR2,
PCHANNEL_TYPE IN VARCHAR2 DEFAULT NULL,
PCSS_ORDER_NUMBER IN VARCHAR2 DEFAULT NULL,
PTELEPHONE_NUMBER IN VARCHAR2 DEFAULT NULL,
PSCENARIO_TYPE IN VARCHAR2 DEFAULT NULL,
PCUSTOMER_REQUIRED_DATE IN VARCHAR2 DEFAULT NULL,
PCUSTOMER_REQUIRED_TIME IN VARCHAR2 DEFAULT NULL,
PCANCELLATION_REASON IN VARCHAR2 DEFAULT NULL,
PCANCELLATION_NOTES IN VARCHAR2 DEFAULT NULL,
PSMPF_RETENTION IN VARCHAR2 DEFAULT NULL,
PEMERGENCY_WINBACK IN VARCHAR2 DEFAULT NULL,
PCSS_PROJECT_ID IN VARCHAR2 DEFAULT NULL,
PCSS_ORDER_NOTES IN VARCHAR2 DEFAULT NULL,
PREASON_FOR_CESSATION IN VARCHAR2 DEFAULT NULL,
P_RESPONSE OUT VARCHAR2,
PSMART_USER_ID IN VARCHAR2 DEFAULT NULL,
PORACLE_ERROR OUT VARCHAR2,
PORACLE_ERROR_MESSAGE OUT VARCHAR2,
PRESPONSE_TIME OUT NUMBER,
PDATA_TRANSFER_STATUS OUT VARCHAR2)
IS
v_scenario_type VARCHAR2(20); -- Varialble to Hold Time Out of every request to SPG
v_transaction_time NUMBER; -- Total time in which Request to SPG was processed
v_record_inserted_at DATE; -- Date/Time about the record insertion to the Error Handler
v_start_time NUMBER; -- Variable to hold Start Time for calculationg Transaction Time
v_url VARCHAR2(32767);-- URL to use when sending data to SPG
vtransaction_id VARCHAR2(18); -- Variable to hold Transaction ID for the request
v_buffer VARCHAR2(32760);-- Variable to read response from the SPG interface
v_timeout PLS_INTEGER; -- Time Out for each Transaction
v_oracle_err_msg VARCHAR2(600); -- Variable to hold Oracle Error Message
v_resp UTL_HTTP.RESP; -- Response Object
v_req UTL_HTTP.REQ; -- Request Object
v_userid_pwd SMT_ORACLE_PARAMETERS%ROWTYPE; --Variable declared to contain User ID & Password
vl_RetCode VARCHAR2(5000);
vl_std_returnCode VARCHAR2(3000);
--PDATA_TRANSFER_STATUS Holds the Data Transfer Status which can have possible values as
-- N => Data Has not been sent to SPG
-- Y => Received Successful response from SPG
-- F => On the First try to Send data to SPG Oracle Error Occured or response from SPG was a faulure
-- S => On the Second try to Send data to SPG Oracle Error Occured or response from SPG was a faulure
-- T => Data Has been transferred to the Error Log Table
-- X => Data need not be transfered to Error Log Table.
--Location of the timeout, URL & User Id & Password in Standing Data.
c_url_stopwlr SMT_ORACLE_PARAMETERS.PARAMETER_CODE%TYPE:='SPG_WLR';-- Stop WLR URL
c_url_cancelown SMT_ORACLE_PARAMETERS.PARAMETER_CODE%TYPE:='SPG_OWN';-- Cancel own URL
c_url_cancelother SMT_ORACLE_PARAMETERS.PARAMETER_CODE%TYPE:='SPG_OTH';-- Cancel other URL
c_url_amendcrd SMT_ORACLE_PARAMETERS.PARAMETER_CODE%TYPE:='SPG_CRD';--Amend CRD URL
c_spg_useridpwd SMT_ORACLE_PARAMETERS.PARAMETER_CODE%TYPE:='SPGIDPWD'; --Contains user id and pwd
ctimeout smt_parameters.parameter_code%TYPE:='SPGTO'; --This holds the timeout parameter
BEGIN
--In case the calling batch process can pass this value this SQL read will not be required & can be deleted
--Read data transfer status for the transaction Id
SELECT data_transfer_status INTO PDATA_TRANSFER_STATUS FROM SPG_INTERFACE_TABLE
WHERE transaction_id = PTRANSACTION_ID;
--Record the start time
v_start_time:=DBMS_UTILITY.GET_TIME;
--If Data transfer status is S then send the record to error handler
IF PDATA_TRANSFER_STATUS = 'S' THEN
Error_Handler(PTRANSACTION_ID,PSMART_USER_ID,PORACLE_ERROR,PORACLE_ERROR_MESSAGE,v_record_inserted_at,PDATA_TRANSFER_STATUS);
ELSE
--In case Data Tranfer Status is something other than S then send the request to SPG
--Initialise other variables which will be populated during the journey
P_RESPONSE := '';
PORACLE_ERROR := NULL;
PORACLE_ERROR_MESSAGE := NULL;
PRESPONSE_TIME := 0;
--Read timeout parameter from standing data.
BEGIN
SELECT VALUE INTO v_timeout FROM smt_parameters WHERE parameter_code=ctimeout;
EXCEPTION
WHEN NO_DATA_FOUND THEN
v_timeout:=30;
WHEN OTHERS THEN
v_timeout:=30;
END;
-- Construct the URL for Stop WLR Scenario
IF PSCENARIO_TYPE = 'STOP_WLR' THEN
BEGIN
-- Read the Initial URL from Standing Data
SELECT VALUE
INTO v_url
FROM SMT_ORACLE_PARAMETERS
WHERE parameter_code = c_url_stopwlr
AND host_id = ( SELECT host_id
FROM SMART_HOSTS A
WHERE EXISTS ( SELECT 1
FROM DB_PARAMETERS b
WHERE A.hostname = b.hostname
AND A.database_id = b.database_id));
--handle unforseen exception
EXCEPTION
WHEN NO_DATA_FOUND THEN
v_url:='Http://wls.brassi1c.devenv1.bt.co.uk:64738/pls/spgenv/spg_btrc.add_btrc_winback_details'; --After testing the same, URL will be fetched from the Query
WHEN OTHERS THEN
v_url:='Http://wls.brassi1c.devenv1.bt.co.uk:64738/pls/spgenv/spg_btrc.add_btrc_winback_details'; --After testing the same, URL will be fetched from the Query
END;
--construct the URL depending on the parameters to be passed to the url
v_url := v_url || '?';
v_url := v_url || 'p_data_entered=' || Smart_Urlencode('xmloverhttp') || '&';
v_url := v_url || 'p_channel_type=' || Smart_Urlencode(PCHANNEL_TYPE)|| '&';
v_url := v_url || 'p_css_start_order_no=' || Smart_Urlencode(PCSS_ORDER_NUMBER)|| '&';
v_url := v_url || 'p_tel_no=' || Smart_Urlencode(PTELEPHONE_NUMBER)|| '&';
v_url := v_url || 'p_crd=' || Smart_Urlencode(PCUSTOMER_REQUIRED_DATE)|| '&';
v_url := v_url || 'p_take_over_time=' || Smart_Urlencode(PCUSTOMER_REQUIRED_TIME)|| '&';
v_url := v_url || 'p_retainsmpf=' || Smart_Urlencode(PSMPF_RETENTION)|| '&';
--v_url := v_url || 'p_emergency_winback=' || Smart_Urlencode(PEMERGENCY_WINBACK)|| '&';
v_url := v_url || 'p_projectno=' || Smart_Urlencode(PCSS_PROJECT_ID)|| '&';
v_url := v_url || 'p_ordernotes=' || Smart_Urlencode(PCSS_ORDER_NOTES)|| '&';
v_url := v_url || 'p_reason_cessation=' || Smart_Urlencode(PREASON_FOR_CESSATION);
ELSIF PSCENARIO_TYPE='CANCEL_OWN' THEN
--Fetch the URL for cancel own from standing data.
BEGIN
SELECT VALUE
INTO v_url
FROM SMT_ORACLE_PARAMETERS
WHERE parameter_code = c_url_cancelown
AND host_id = ( SELECT host_id
FROM SMART_HOSTS A
WHERE EXISTS ( SELECT 1
FROM DB_PARAMETERS b
WHERE A.hostname = b.hostname
AND A.database_id = b.database_id));
--handle unforseen exception
EXCEPTION
WHEN NO_DATA_FOUND THEN
v_url := 'Http://wls.brassi1c.devenv1.bt.co.uk:64738/pls/spgenv/spg_btrc.add_btrc_cancelown_details'; --After testing the same, URL will be fetched from the Query
WHEN OTHERS THEN
v_url := 'Http://wls.brassi1c.devenv1.bt.co.uk:64738/pls/spgenv/spg_btrc.add_btrc_cancelown_details'; --After testing the same, URL will be fetched from the Query
END;
--construct the URL
v_url := v_url || '?';
v_url := v_url || 'p_data_entered=' ||Smart_Urlencode('xmloverhttp')|| '&';
v_url := v_url || 'p_channel_type=' ||Smart_Urlencode(PCHANNEL_TYPE)|| '&';
v_url := v_url || 'p_css_start_order_no=' ||Smart_Urlencode(PCSS_ORDER_NUMBER)|| '&';
v_url := v_url || 'p_tel_no=' ||Smart_Urlencode(PTELEPHONE_NUMBER)|| '&';
v_url := v_url || 'p_cancel_reason=' ||Smart_Urlencode(PCANCELLATION_REASON)|| '&';
v_url:= v_url || 'p_cancel_notes=' ||Smart_Urlencode(PCANCELLATION_NOTES);
ELSIF PSCENARIO_TYPE='CANCEL_OTHER' THEN
--Fetch the URL for cancel own from standing data.
BEGIN
SELECT VALUE
INTO v_url
FROM SMT_ORACLE_PARAMETERS
WHERE parameter_code = c_url_cancelother
AND host_id = ( SELECT host_id
FROM SMART_HOSTS A
WHERE EXISTS ( SELECT 1
FROM DB_PARAMETERS b
WHERE A.hostname = b.hostname
AND A.database_id = b.database_id));
--handle unforseen exception
EXCEPTION
WHEN NO_DATA_FOUND THEN
v_url := 'Http://wls.brassi1c.devenv1.bt.co.uk:64738/pls/spgenv/spg_btrc.add_btrc_cancelother_details'; --After testing the same, URL will be fetched from the Query
WHEN OTHERS THEN
v_url := 'Http://wls.brassi1c.devenv1.bt.co.uk:64738/pls/spgenv/spg_btrc.add_btrc_cancelother_details'; --After testing the same, URL will be fetched from the Query
END;
--construct the URL
v_url := v_url || '?';
v_url := v_url || 'p_data_entered=' ||Smart_Urlencode('xmloverhttp')|| '&';
v_url := v_url || 'p_channel_type=' ||Smart_Urlencode(PCHANNEL_TYPE)|| '&';
v_url := v_url || 'p_css_stop_order_no=' ||Smart_Urlencode(PCSS_ORDER_NUMBER)|| '&';
v_url := v_url || 'p_tel_no=' ||Smart_Urlencode(PTELEPHONE_NUMBER)|| '&';
v_url := v_url || 'p_cancel_reason=' ||Smart_Urlencode(PCANCELLATION_REASON);
ELSIF Pscenario_type='AMEND_CRD' THEN
--Fetch the URL for cancel own from standing data.
BEGIN
SELECT VALUE
INTO v_url
FROM SMT_ORACLE_PARAMETERS
WHERE parameter_code = c_url_amendcrd
AND host_id = ( SELECT host_id
FROM SMART_HOSTS A
WHERE EXISTS ( SELECT 1
FROM DB_PARAMETERS b
WHERE A.hostname = b.hostname
AND A.database_id = b.database_id));
--handle unforseen exception
EXCEPTION
WHEN NO_DATA_FOUND THEN
v_url := 'Http://wls.brassi1c.devenv1.bt.co.uk:64738/pls/spgenv/spg_btrc.add_btrc_amendcrd_details'; -- After testing the same , URL will be fetched from the Query
WHEN OTHERS THEN
v_url := 'Http://wls.brassi1c.devenv1.bt.co.uk:64738/pls/spgenv/spg_btrc.add_btrc_amendcrd_details'; -- After testing the same , URL will be fetched from the Query
END;
--construct the URL
v_url := v_url || '?';
v_url := v_url || 'p_data_entered=' ||Smart_Urlencode('xmloverhttp')|| '&';
v_url := v_url || 'p_channel_type=' ||Smart_Urlencode(PCHANNEL_TYPE)|| '&';
v_url := v_url || 'p_css_start_order_no=' ||Smart_Urlencode(PCSS_ORDER_NUMBER)|| '&';
v_url := v_url || 'p_tel_no=' ||Smart_Urlencode(PTELEPHONE_NUMBER)|| '&';
v_url := v_url || 'p_crd=' ||Smart_Urlencode(PCUSTOMER_REQUIRED_DATE)|| '&';
v_url := v_url || 'p_css_change_order_numbers='||Smart_Urlencode(PCANCELLATION_REASON);
END IF;
--this is start of setting parameters for utl http object. the show begins...
utl_http.set_transfer_timeout(v_timeout);
--Set the wallet
--XXXXX e.g.UTL_HTTP.SET_WALLET(?file:DirectoryPath?,'put password here?);
--Set proxy
--YYYYY e.g. utl_http.set_proxy(p_proxy_in, p_no_proxy_domains_in);
v_url := REPLACE(v_url,'%27%27','%27'); -- Fix to ensure Double Quotes are converted to Single Quotes
--set the required URL to utl http.
v_req := utl_http.begin_request(v_url);
--Authentication setting
--Fetch the user id and password from stnding data.
BEGIN
SELECT *
INTO v_userid_pwd
FROM SMT_ORACLE_PARAMETERS
WHERE PARAMETER_CODE=c_spg_useridpwd
AND HOST_ID = ( SELECT HOST_ID
FROM SMART_HOSTS A
WHERE EXISTS ( SELECT 1
FROM DB_PARAMETERS B
WHERE A.HOSTNAME = B.HOSTNAME
AND A.DATABASE_ID = B.DATABASE_ID));
EXCEPTION
WHEN NO_DATA_FOUND THEN
P_RESPONSE := 'ORACLE_ERROR: USER id AND Password NOT configured IN SMT_ORACLE_PARAMETERS:SPGIDPWD';
WHEN OTHERS THEN
P_RESPONSE := 'ORACLE_ERROR: USER id AND Password NOT configured IN SMT_ORACLE_PARAMETERS:SPGIDPWD';
END;
--utl_http.set_authentication(v_req, p_username_in, p_password_in);
utl_http.set_authentication(v_req, v_userid_pwd.description, v_userid_pwd.VALUE);
v_resp := utl_http.get_response(v_req);
--Fill in the the response time
PRESPONSE_TIME := (DBMS_UTILITY.GET_TIME - v_start_time)/100;
IF v_resp.reason_phrase = 'OK' THEN
-- Fetch the response
BEGIN
LOOP
utl_http.read_line(v_resp, v_buffer);
P_RESPONSE := P_RESPONSE || v_buffer;
END LOOP;
utl_http.end_response(v_resp);
EXCEPTION
WHEN utl_http.end_of_body THEN
utl_http.end_response(v_resp);
P_RESPONSE := P_RESPONSE || v_buffer;
END;
ELSIF v_resp.reason_phrase <> 'OK' OR P_RESPONSE = '' THEN
--error handling starts
--If the HTTP Status is not OK then store the error information
PORACLE_ERROR_MESSAGE := 'Status Code: '|| v_resp.STATUS_CODE||'. Reason Phrase ' ||v_resp.reason_phrase;
P_RESPONSE := 'ORACLE_ERROR: '|| ' Reason Phrase ' || v_resp.reason_phrase;
PORACLE_ERROR := v_resp.STATUS_CODE;
END IF;
--In case we got successful response from SPG
IF P_RESPONSE LIKE '%<RetCde>0</RetCde>%' THEN
PDATA_TRANSFER_STATUS := 'Y';
ELSE
BEGIN
SELECT message
INTO vl_std_returnCode
FROM SMT_MESSAGES
WHERE MESSAGE_CODE='SPGANTIDTS';
EXCEPTION
WHEN NO_DATA_FOUND THEN
vl_std_returnCode := '-12545,-29273,-1,401,';
WHEN OTHERS THEN
vl_std_returnCode := '-12545,-29273,-1,401,';
END;
--In case there was an error do not update Data Transfer Status
IF PORACLE_ERROR <> NULL AND INSTR(vl_std_returnCode, PORACLE_ERROR || ',', 1, 1) <> 0 THEN
PDATA_TRANSFER_STATUS:=PDATA_TRANSFER_STATUS;
ELSE
vl_RetCode := SUBSTR(P_RESPONSE, INSTR(P_RESPONSE,'<RetCde>', 1, 1),
INSTR(P_RESPONSE,'</RetCde>',1,1)+9 - INSTR(P_RESPONSE,'<RetCde>', 1, 1));
BEGIN
SELECT VALUE
INTO vl_std_returnCode
FROM SMT_ORACLE_PARAMETERS
WHERE PARAMETER_CODE='SPGRCS'
AND HOST_ID = ( SELECT HOST_ID
FROM SMART_HOSTS A
WHERE EXISTS ( SELECT 1
FROM DB_PARAMETERS B
WHERE A.HOSTNAME = B.HOSTNAME
AND A.DATABASE_ID = B.DATABASE_ID));
EXCEPTION
WHEN NO_DATA_FOUND THEN
vl_std_returnCode := '<RetCde>4244</RetCde><RetCde>4245</RetCde><RetCde>4246</RetCde>';
WHEN OTHERS THEN
vl_std_returnCode := '<RetCde>4244</RetCde><RetCde>4245</RetCde><RetCde>4246</RetCde>';
END;
IF INSTR(vl_std_returnCode, vl_RetCode, 1, 1) <> 0 THEN
--needs not to re attempted.
PDATA_TRANSFER_STATUS:='X';
ELSE
--In case we did'nt got SUCCESSFUL response FROM SPG THEN UPDATE the Data Transfer Status so that the failed requests can be picked up BY the NEXT batch job RUN
IF PDATA_TRANSFER_STATUS='N' THEN
--initially if data transfer status was N then update it now to F
PDATA_TRANSFER_STATUS := 'F';
ELSIF PDATA_TRANSFER_STATUS='F' THEN
--initially if data transfer status was N then update it now to S
PDATA_TRANSFER_STATUS := 'S';
END IF;
END IF;
END IF;
END IF;
--Now Update all the modified Values
UPDATE SPG_INTERFACE_TABLE
SET response = P_RESPONSE,
data_transfer_status = PDATA_TRANSFER_STATUS,
oracle_error = PORACLE_ERROR,
oracle_error_message = PORACLE_ERROR_MESSAGE,
response_time = PRESPONSE_TIME
WHERE transaction_id = PTRANSACTION_ID;
COMMIT;
END IF;
EXCEPTION
WHEN OTHERS THEN
--Handling the unhandled exception
PORACLE_ERROR := SQLCODE;
PORACLE_ERROR_MESSAGE := SQLERRM;
P_RESPONSE := 'ORACLE_ERROR: '|| PORACLE_ERROR_MESSAGE;
PRESPONSE_TIME := (DBMS_UTILITY.GET_TIME - v_start_time)/100;
SELECT data_transfer_status INTO PDATA_TRANSFER_STATUS
FROM SPG_INTERFACE_TABLE
WHERE transaction_id=PTRANSACTION_ID;
--New functionality to update the oracle error and oracle error message and not the Data Transfer Status
BEGIN
SELECT message
INTO vl_std_returnCode
FROM SMT_MESSAGES
WHERE MESSAGE_CODE='SPGANTIDTS';
EXCEPTION
WHEN NO_DATA_FOUND THEN
vl_std_returnCode := '-12545,-29273,-1,';
WHEN OTHERS THEN
vl_std_returnCode := '-12545,-29273,-1,';
END;
vl_RetCode := PORACLE_ERROR || ',';
IF INSTR(vl_std_returnCode, vl_RetCode, 1, 1) <> 0 THEN
--If the error is found in above maintained standing data do not change the Data Transfer Status
pdata_transfer_status:=pdata_transfer_status;
ELSE
IF pdata_transfer_status='N' THEN
PDATA_TRANSFER_STATUS := 'F';
DBMS_OUTPUT.PUT_LINE('DUE TO ERROR DATA COULDN''T GET TRANSFERED TO SPG FOR TRANSACTION'||' '||PTRANSACTION_ID);
DBMS_OUTPUT.PUT_LINE(SQLERRM);
ELSIF pdata_transfer_status='F' THEN
PDATA_TRANSFER_STATUS := 'S';
DBMS_OUTPUT.PUT_LINE('DUE TO ERROR DATA COULDN''T GET TRANSFERED TO SPG FOR TRANSACTION'||' '||PTRANSACTION_ID);
DBMS_OUTPUT.PUT_LINE(SQLERRM);
ELSE
DBMS_OUTPUT.PUT_LINE('Failure WHEN sending data TO Error LOG. Data Transfer Status IS ' || PDATA_TRANSFER_STATUS || '. TRANSACTION ID '|| PTRANSACTION_ID);
END IF;
END IF;
--Now update all the information gathered above to the table
UPDATE SPG_INTERFACE_TABLE
SET response = P_RESPONSE,
data_transfer_status = PDATA_TRANSFER_STATUS,
oracle_error = PORACLE_ERROR,
oracle_error_message = PORACLE_ERROR_MESSAGE,
response_time = PRESPONSE_TIME
WHERE transaction_id = PTRANSACTION_ID;
COMMIT;
END;
/I have fixed the problem by own.
Seems there are some while space in the endpoint url.
Fix
http_req:= utl_http.begin_request
trim(l_endpoint_url)
,'POST'
,'HTTP/1.1'
It works...
Regards
BS -
Operation Could Not Be Completed: Too Many Open...
I've had this error showing up a lot in the Safari 3.2 and 4.0 beta activity window when loading multiple tabs of pages with many images (usually gallery type pages or blogs with lots of thumbnails). The result is that some images or other elements like style sheets don't load, leading to the blue question mark, or messed up formatting. Unfortunately, the activity window can't be stretched wide enough to see the whole error, but in fact it's "Operation Could Not Be Completed: Too Many Open Files". The error "socket(PF_ROUTE) failed: Too many open files" shows up in the Console as well, at least with Safari 4. I had also experienced similar problems with "Operation Timed Out" errors as well.
I've been pulling my hair out on this one, because it's rather inconsistent, not to mention annoying. You can usually get an individual page to load completely by refreshing it, but that kind of defeats the purpose of loading multiple tabs all at once. It's also less of a problem if more of those pages are already cached, but you never know for sure. Running your connection through a proxy also helps a bit, but not always.
I found a fix, but it's actually not Safari's "fault" per se. The issue lies in the allowable number of open files per user process, which is set by the system's launchd process at boot time. Note that Safari is not entirely innocent, as FireFox doesn't have this problem. It Seems that Safari just tries to load everything all at once, whereas FireFox does a better job of managing its load requests. Anyway if you run the following command in Terminal:
sudo launchctl limit
the following list should show up (with perhaps slightly different values)
cpu unlimited unlimited
filesize unlimited unlimited
data 6291456 unlimited
stack 8388608 67104768
core 0 unlimited
rss unlimited unlimited
memlock unlimited unlimited
maxproc 200 532
maxfiles 256 unlimited
The second column is a "soft limit" and the third column is a "hard limit", though to be honest I'm not exactly sure what the difference entails. The image loading problem is caused by hitting the maxfiles limit of just 256 files. The solution is to change maxfiles to 4096/unlimited, and also change maxproc to 1000/2000 since it's pretty low as well. That sounds like a pretty big change, but OS X server is supposed to change them to numbers like this when services like Apache are enabled, and Apple even mentions how to change maxproc at http://support.apple.com/kb/TS1659
To make these changes, run the following two commands in Terminal and restart the computer:
echo "limit maxproc 1000 2000" | sudo tee -a /etc/launchd.conf
echo "limit maxfiles 4096 unlimited" | sudo tee -a /etc/launchd.conf
The commands add the two lines in quotes to the launchd.conf file in /etc/ (if no file exists yet, it creates it). That should clear up the loading issues. I haven't noticed any other problems with these increased numbers, but I'll report back if anything seems to go amiss. Hopefully this will be helpful to someone.I faced the same problem with an image gallery using css for image resizing. Thanks for the explanation.
-
Java.io.IOException: Too many open files while deploying in soa 11g
hi all,
I am getting a strange error while deploying any composite .. it's a hello world kinda composite but while i am trying to deploy it i am getting "java.io.IOException: Too many open files" while deployment.. i have tried to deploy it in 2-3 ways but all of them resulted in the same error..bouncing the soa server might be an option but can someone give an insight as why it is happening and can it be resolved without restarting the server..
Thanksyes..so this problem is with unix only ..coz i previously worked in Windows ..never got this problem..
-
STARTING DATABASE : PROBLEM OF Linux Error: 23: Too many open files in syst
Hi everybody,
I am running an RMAN script and get this error,
9> @/u01/app/oracle/admin/devpose/backup/configuration.rcv
RMAN> ###################################################################
2> # Configuration file used to set Rman policies.
3> #
4> ###################################################################
5>
6> CONFIGURE DEFAULT DEVICE TYPE TO DISK;
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of configure command at 08/26/2009 20:03:30
RMAN-06403: could not obtain a fully authorized session
ORA-01034: ORACLE not available
RMAN> CONFIGURE RETENTION POLICY TO REDUNDANCY 1;
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of configure command at 08/26/2009 20:03:30
RMAN-06403: could not obtain a fully authorized session
ORA-01034: ORACLE not available
RMAN> #CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 7 DAYS;
2> CONFIGURE DEVICE TYPE DISK PARALLELISM 2;
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of configure command at 08/26/2009 20:03:30
RMAN-06403: could not obtain a fully authorized session
ORA-01034: ORACLE not available
RMAN>
RMAN> CONFIGURE CHANNEL DEVICE TYPE DISK FORMAT '/u01/app/oracle/backup/db/ora_df%t_s%s_s%p';
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of configure command at 08/26/2009 20:03:30
RMAN-06403: could not obtain a fully authorized session
ORA-01034: ORACLE not available
But this problem is understandable, as the database is not running. The main problem why database is not running, I have found the reason but do not understand how to solve the problem.
Since, the database was not running, I tried to startup the database, I then came across the following which is my problem (Why so many files are open? Linux OS error says too many files open. See below,
SQL> conn /as sysdba
Connected to an idle instance.
SQL> startup
ORACLE instance started.
Total System Global Area 419430400 bytes
Fixed Size 779516 bytes
Variable Size 258743044 bytes
Database Buffers 159383552 bytes
Redo Buffers 524288 bytes
Database mounted.
ORA-00313: open failed for members of log group 2 of thread 1
ORA-00312: online log 2 thread 1: '/u01/app/oracle/oradata/devpose/redo02.log'
ORA-27041: unable to open file
Linux Error: 23: Too many open files in system
Can anybody has run into such problem and guide me to a solution, please?
ThanksHi,
yes, this DB was functioning o.k. this configuration script was part of RMAN daily backup.
Last night the backup failed. So, when I opened "Failed job" in the EM, I saw this type of messages.
That was the starting point. Gradually, I tried to narrow down on to the actual problem and found the findings as I have posted.
One way of sovling problem, I thought that, all these processes I would kill and then try to open the database, it might startup. However, that wouldnot lead me in ensuring this won't occur again.
That's why I am trying to understand why it should open, so many processes (why spawn so many .flb files?) Any thoughts you have around this?
I will try to restart the OS as the last resort.
Thanks for your help and suggestions.
Regards, -
"java.io.IOException: Too many open files" in LinuX
Hi Developers,
* I am continiously running and processing more than 2000 XML files by using SAX and DOM.....
* My process is as follows,
- Converting the XML file as Document object by DOM....
- And that DOM will be used while creating log file report, that log file will be created after executing all XML files..
* After processing approx 1000 files, it throws *"java.io.IOException: Too many open files" in LinuX system* ....
* I have googled more and more in all sites including sun forum also, but they are telling only to increase the system config by ULIMIT in linux....If i increase that its executing well without exception........
* My question is, Is it possible to do it by JAVA code itself or any other VM arguments like -Xms512m and -Xmx512m.....
* Please let me know , if you have any idea.....
Thanks And Regards,
JavaImranDoh! I forgot to post my little code sample...
package forums.crap;
import java.io.*;
import java.util.*;
public class TooManyFileHandles
private static final int HOW_MANY = 8*1024;
public static void main(String[] args) {
List<PrintWriter> writers = new ArrayList<PrintWriter>(HOW_MANY);
try {
try {
for (int i=1; i<=HOW_MANY; i++ ) {
writers.add(new PrintWriter("file"+i+".txt"));
} finally {
for (PrintWriter w : writers) {
if(w!=null)w.close();
} catch (Exception e) {
e.printStackTrace();
}... and the problem still isn't OOME ;-)
Cheers. Keith. -
WLS 10.3.5 on RHEL 5.4, SocketException: Too many open files
Hi
I'm running Weblogic server 10.3.5 on Red Hat Enterprise Linux Server release 5.4 (Tikanga), with Java jdk1.6.0_27.
My order handling application, when receiving client orders, needs to make outbound SOAP calls to fulfill the order. During a performance test, we got following errors:
####<Feb 10, 2012 2:28:41 PM ICT> <Critical> <Server> <KKMOMAPP2> <KKMOMPE2> <DynamicListenThread[Default]> <<WLS Kernel>> <> <> <1328858921806> <BEA-002616> <Failed to listen on channel "Default" on 172.24.106.81:4095, failure count: 1, failing for 0 seconds, java.net.SocketException: Too many open files>
I monitored the java process of this application, when the "Too many open files" error happened, it had 1388 open file descriptors, among which 655 were sockets.
I also monitored the total open file descriptors of the weblogic user account, the count was around 6300 during this error.
These numbers are far smaller than the file limits configured on OS:
- Under weblogic account, ulimit -n shows 65536
- /proc/sys/fs/file-max shows 772591
- Following lines are already in /etc/security/limits.conf
weblogic soft nofile 65536
weblogic hard nofile 65536
weblogic soft nproc 16384
weblogic hard nproc 16384
I did another test using a simple java program to open large number of sockets under weblogic account. It has no problem to open 15,000 sockets. It seems the file descriptor limit is indeed quite high, but for some reasons, the Weblogic process fails even when it has merely 1388 open files. Are there other Linux or Weblogic parameters I should tune? Or anything else I missed?
Thank you very much
NingHi All,
Any help on this issue ?
Thank you,
Ram
Maybe you are looking for
-
GM Resource Related Billing based on Cash
Hi Folks, I'm relatively new to SAP and my users have asked for a modification to the billing process for NIH and NSF grants(letter of credit). Right now they are drawing down based on expenditures, but would like to change so it's based on cash disb
-
Repeating Regions and Editable Tag Attributes?
I want to produce a template that will let users create pages that list items as a thumbnail image and a short text description, one after the other. I can set this up as a repeating region, but I would also like to make only certain attributes of th
-
Is it necessary to include the add-on when R/3 4.7 x110 upgrade to ECC 6 ?
Dear Expert: I trying to do the R/3 4.7 x110 upgrade to ECC 6 at the PREPARE process >> extension model >> UPLOAD_REQUEST phase. it asked me about the add-on CDs or support package.Yes or No I'm wondering do i need to put any add-on CDs or components
-
ABAP Certification -- Important
Hi Can any one tell me the procedure for ABAP certification. Where can i get documents to prepare myself for the examination? Where and how can i take this certification examination? What is the eligibility criteria and need information on fees struc
-
Eroro while tryin gto see the setup table content
HI gurus, i would like to see the setup table content for 2lis_11_vahdr. when iam trying to got to T-cOde -OLI11BW it is saying that " No extract structure is activated or bw not connected" , i checked that extract structure is in active state . plas