Thursday, July 7, 2011

An operation on a socket could not be performed because the system lacked sufficient buffer space or because a queue was full

The configuration

OS-Windows Server 2003 R2 x86, SP2
Oracle 10gR2 Ent x86 (10.2.0.5.0)
Apex 4.01
Oracle BI configuration:
Oracle Business Intelligence Product Version 10.1.3.4.1 (Build 090414.1900) 
Physical Presentation Catalog Path \\?\C:\OracleBIData\web\catalog\samplesales\root 
Oracle BI Server Data Source AnalyticsWeb 
Available Paging Memory (MB) 1795 
Available Virtual Address Space (MB) 2939 

The problem

When I run XML Publsher report (from Apex, using predefined RTF template) I got a PDF file with the following content:
500 Internal Server Error
Servlet error: An exception occurred. The current application deployment descriptors do not allow for including it in this response. Please consult the application log for details.
Quick look in XML publisher's log file (C:\OracleBI\oc4j_bi\j2ee\home\application-deployments\xmlpserver\application.log) showed me an error:
11/07/06 15:16:28.171 xmlpserver: Servlet error
java.lang.IllegalStateException: IOException: An operation on a socket could not be performed because the system lacked sufficient buffer space or because a queue was full
 at com.evermind[Oracle Containers for J2EE 10g (10.1.3.1.0) ].server.http.EvermindHttpServletRequest.getParameter(EvermindHttpServletRequest.java:2295)
 at oracle.apps.xdo.servlet.Converter.doPost(Converter.java:64)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:763)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
 at com.evermind[Oracle Containers for J2EE 10g (10.1.3.1.0) ].server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:711)
 at com.evermind[Oracle Containers for J2EE 10g (10.1.3.1.0) ].server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:368)
 at com.evermind[Oracle Containers for J2EE 10g (10.1.3.1.0) ].server.http.HttpRequestHandler.doProcessRequest(HttpRequestHandler.java:866)
 at com.evermind[Oracle Containers for J2EE 10g (10.1.3.1.0) ].server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:448)
 at com.evermind[Oracle Containers for J2EE 10g (10.1.3.1.0) ].server.http.HttpRequestHandler.serveOneRequest(HttpRequestHandler.java:216)
 at com.evermind[Oracle Containers for J2EE 10g (10.1.3.1.0) ].server.http.HttpRequestHandler.run(HttpRequestHandler.java:117)
 at com.evermind[Oracle Containers for J2EE 10g (10.1.3.1.0) ].server.http.HttpRequestHandler.run(HttpRequestHandler.java:110)
 at oracle.oc4j.network.ServerSocketReadHandler$SafeRunnable.run(ServerSocketReadHandler.java:260)
 at oracle.oc4j.network.ServerSocketAcceptHandler.procClientSocket(ServerSocketAcceptHandler.java:239)
 at oracle.oc4j.network.ServerSocketAcceptHandler.access$700(ServerSocketAcceptHandler.java:34)
 at oracle.oc4j.network.ServerSocketAcceptHandler$AcceptHandlerHorse.run(ServerSocketAcceptHandler.java:880)
 at com.evermind[Oracle Containers for J2EE 10g (10.1.3.1.0) ].util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:298)
 at java.lang.Thread.run(Thread.java:595)
As you see from highlited row was the core of the problem.

The solution

Solution was found on MS knowledge base page. There stand the very same error with solution described as:
The default maximum number of ephemeral TCP ports is 5000 in the products that are included in the "Applies to" section. A new parameter has been added in these products. To increase the maximum number of ephemeral ports, follow these steps:
Locate the following subkey in the registry:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters
Edit menu, click New, and then add the following registry entry:
Value Name: MaxUserPort
Value Type: DWORD
Value data: 65534
Valid Range: 5000-65534 (decimal)
Default: 0x1388 (5000 decimal)
in our case there was no registry entry (5000 is default) so we set 60000 as a new value.
After we restarted server, XML Publisher report run with no errors.

The End

Java configuration problems has a world wide Google references. Here is AYA Java problem, which arise in Oracle BI on Windows. This one was successfully solved.

So I wrote this post more as a quick guide to someone else in the future.

Cheers!

P.S.
After few days I got mail from other MS consultant, who inform me that in MS Exchange installations steps one of them is setup MaxUserPort value to 60000, as described.
:-)

Sunday, July 3, 2011

impdp and "ORA-00439: feature not enabled: Table compression"

Recently I have to deploy one development solution to client's Oracle 10gR2 database. Deployment solution was compound from few tablespaces, several schemes with data packages/functions/procedures-standard situation. Development was performed on Oracle 10gR2 Enterprise Edition database, what is default platform for any kind of our development. Developers were using advanced Oracle features (compressed tablesapces with some compressed tables), what I didn't found bad at all-contrary I was encouraging them as much as possible!

At the end, deployment was packed through expdp utility.

The problem

When I came to client, who had already installed 10gR2 database (not too bad to mention that mine previously mentioned expdp was done with correct COMPATIBLE parameter), firstly I wanted to create tablespaces on locations where it should be accordind client server partitions.

For that I wanted to use previously generated/modificated tablespace scripts. On mine third script I get error:
ORA-00439: feature not enabled: Table compression
which told me that COMPRESS option is not installed. Quick grep in v$version confirmed mine thoughts ... and I was in question why? Solution on that question came very quickly.
SYS> select * from v$version;

BANNER
----------------------------------------------------------------
Oracle Database 10g Standard Edition Release 10.2.0.4.0 - 64bit
PL/SQL Release 10.2.0.4.0 - Production
CORE    10.2.0.4.0      Production
TNS for 64-bit Windows: Version 10.2.0.4.0 - Production
NLSRTL Version 10.2.0.4.0 - Production

SYS> 
showed me that client is using Standard Edition, which doesn't support compression at all. In this case I said-OK let me create classic tablespaces without compression. No problems. For that remove two lines in create tablespace script
COMPRESS
ONLINE
Happy to solve this issue, I was surprised again (!!) when mine impdp had a lot of errors like:
ORA-39083: Object type TABLE failed to create with error:
ORA-00439: feature not enabled: Table compression
Failing sql is:
CREATE TABLE  ... 
followed by a dozen of
ORA-39112: Dependent object type  ... skipped, base object type TABLE: ... creation failed
which are easily recognized that all tables with COMPRESS option will not be imported because they cannot be created. The same was with table's indexes as well and all dependent objects based on such a tables.

Now, I was in real trouble, expdp file is pure binary file which cannot be easily edited as good old exp dump file, client was far away from mine company location (where I could recreate all the objects again in "no compress" mode) and beside that delivery date was passed, so no excuse was not allowed-it should be done now!

The solution

Now it is time to mention, mine good habit, which now shined in brightest colors. I always have, as a precaution, generated through amazing Toad interface, all necessary scripts (create tablespace, create users, create all schemes objects etc.). Those scripts are plain text and in many cases the only source to finding problems-and that was the case now.

Beside that impdp has many advanced features that will be used now. Because create tablespaces and first (unsuccesfull) import was already done, the plan was:
  1. Create users/tables/indexes from plain scripts (remove any compress definition)
  2. Truncate data in all imported (existing) tables. This step is vital to prevent data duplication.
  3. Import data (impdp) with TABLE_EXISTS_ACTION-APPEND, which would only add data to existing tables.
  4. Rerun create user scripts which will add maybe missing parts in grants etc. (do not run drop user part!!)
  5. Recompile database as sysdba with ?/rdbms/admin/utlrp.sql script
  6. Recreate database statistics for all imported scheme objects and dictionary as well
Looks pretty simple when you have a plan and needed resources. And I was lucky to have it.

The end

From this situation I learned that a list of topics should always be checked. One of them are database editions and it's allowed options!

Cheers!