Could not allocate the Oracle environment

View: New views
11 Messages — Rating Filter:   Alert me  

Could not allocate the Oracle environment

by ibrahim steed :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I can connect to and get data from Oracle database at the same machine with Console Application of Mono.
but I can not Open a OracleConnection in a aspx(web application),  it throw exception:"Could not allocate the Oracle environment"



Your answer will be really appreciatively.


Re: Could not allocate the Oracle environment

by Robert Jordan :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

ibrahimsteed wrote:
> I can connect to and get data from Oracle database at the same machine with
> Console Application of Mono.
> but I can not Open a OracleConnection in a aspx(web application),  it throw
> exception:"Could not allocate the Oracle environment"

http://thread.gmane.org/gmane.comp.gnome.mono.general/38681

If you're using mod_mono, you can set the env vars with MonoSetEnv.
See mod_mono's man page for details.

Robert

_______________________________________________
Mono-aspnet-list mailing list
Mono-aspnet-list@...
http://lists.ximian.com/mailman/listinfo/mono-aspnet-list

Re: Could not allocate the Oracle environment

by ibrahim steed :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Yes, I use mod_mono on apache2.
I added my content into httpd.conf as following:

Include /etc/apache2/conf.d/mod_mono.conf
Alias /cmdgen "/home/ibrahim/cmd"
AddMonoApplications default "/cmdgen:/home/ibrahim/cmd"
<Location /cmdgen>
SetHandler mono
Order allow,deny
Allow from all
</Location>

So could you please tell me how to set the env vars above with MonoSetEnv?


Robert Jordan wrote:
ibrahimsteed wrote:
> I can connect to and get data from Oracle database at the same machine with
> Console Application of Mono.
> but I can not Open a OracleConnection in a aspx(web application),  it throw
> exception:"Could not allocate the Oracle environment"

http://thread.gmane.org/gmane.comp.gnome.mono.general/38681

If you're using mod_mono, you can set the env vars with MonoSetEnv.
See mod_mono's man page for details.

Robert

_______________________________________________
Mono-aspnet-list mailing list
Mono-aspnet-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-aspnet-list

Re: Could not allocate the Oracle environment

by nzsaint :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

ibrahimsteed wrote:
So could you please tell me how to set the env vars above with MonoSetEnv?
As in the example Robert linked to I had the same problem with a Windows Service. I added the required environment variables using 'export' in my service init script. My understanding according to the documentation is that you can do the same with 'MonoSetEnv' for mod_mono e.g

From the shell/script it would be:

export ORACLE_BASE=/usr/lib/oracle/xe/app/oracle

Equivalent for mod_mono would be to add the following to your httpd.conf (based on the example you gave):

MonoSetEnv ORACLE_BASE=/usr/lib/oracle/xe/app/oracle

So probably something like (actual values may differ on your system):

MonoSetEnv ORACLE_SID=XE
MonoSetEnv ORACLE_BASE=/usr/lib/oracle/xe/app/oracle
MonoSetEnv ORACLE_HOME=/usr/lib/oracle/xe/app/oracle/product/10.2.0/server

These were the three values I required to resolve this error on my system.



 

Re: Could not allocate the Oracle environment

by ibrahim steed :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thanks for your instant reply.
I did as you said, and update my httpd.conf as follow, then restart apache2.
but the same error occurs again. I don't know what cause this happen.


#some default settings

MonoSetEnv ORACLE_BASE=/opt/oracle/oradb
MonoSetEnv ORACLE_HOME=/opt/oracle/oradb/home
MonoSetEnv ORACLE_SID=imapdb

Include /etc/apache2/conf.d/mod_mono.conf

Alias /cmdgen "/home/ibrahim/cmd"
AddMonoApplications default "/cmdgen:/home/ibrahim/cmd"
<Location /cmdgen>
SetHandler mono
Order allow,deny
Allow from all
</Location>


nzsaint wrote:
ibrahimsteed wrote:
So could you please tell me how to set the env vars above with MonoSetEnv?
As in the example Robert linked to I had the same problem with a Windows Service. I added the required environment variables using 'export' in my service init script. My understanding according to the documentation is that you can do the same with 'MonoSetEnv' for mod_mono e.g

From the shell/script it would be:

export ORACLE_BASE=/usr/lib/oracle/xe/app/oracle

Equivalent for mod_mono would be to add the following to your httpd.conf (based on the example you gave):

MonoSetEnv ORACLE_BASE=/usr/lib/oracle/xe/app/oracle

So probably something like (actual values may differ on your system):

MonoSetEnv ORACLE_SID=XE
MonoSetEnv ORACLE_BASE=/usr/lib/oracle/xe/app/oracle
MonoSetEnv ORACLE_HOME=/usr/lib/oracle/xe/app/oracle/product/10.2.0/server

These were the three values I required to resolve this error on my system.



 

Re: Could not allocate the Oracle environment

by Robert Jordan :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

ibrahimsteed wrote:

> Thanks for your instant reply.
> I did as you said, and update my httpd.conf as follow, then restart apache2.
> but the same error occurs again. I don't know what cause this
> happen.:confused:
>
>
> #some default settings
>
> MonoSetEnv ORACLE_BASE=/opt/oracle/oradb
> MonoSetEnv ORACLE_HOME=/opt/oracle/oradb/home
> MonoSetEnv ORACLE_SID=imapdb

IIRC, MonoSetEnv must occur only once per application. Otherwise
it would overwrite the previous values. Try this (in one line):

MonoSetEnv
ORACLE_BASE=/opt/oracle/oradb;ORACLE_HOME=/opt/oracle/oradb/home;ORACLE_SID=imapdb


Robert

_______________________________________________
Mono-aspnet-list mailing list
Mono-aspnet-list@...
http://lists.ximian.com/mailman/listinfo/mono-aspnet-list

Re: Could not allocate the Oracle environment

by ibrahim steed :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I did as you said. But it doesn't work.

Robert Jordan wrote:
ibrahimsteed wrote:
> Thanks for your instant reply.
> I did as you said, and update my httpd.conf as follow, then restart apache2.
> but the same error occurs again. I don't know what cause this
> happen.:confused:
>
>
> #some default settings
>
> MonoSetEnv ORACLE_BASE=/opt/oracle/oradb
> MonoSetEnv ORACLE_HOME=/opt/oracle/oradb/home
> MonoSetEnv ORACLE_SID=imapdb

IIRC, MonoSetEnv must occur only once per application. Otherwise
it would overwrite the previous values. Try this (in one line):

MonoSetEnv
ORACLE_BASE=/opt/oracle/oradb;ORACLE_HOME=/opt/oracle/oradb/home;ORACLE_SID=imapdb


Robert

_______________________________________________
Mono-aspnet-list mailing list
Mono-aspnet-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-aspnet-list

Re: Could not allocate the Oracle environment

by ibrahim steed :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Could it be a bug of Mono?

Robert Jordan wrote:
ibrahimsteed wrote:
> Thanks for your instant reply.
> I did as you said, and update my httpd.conf as follow, then restart apache2.
> but the same error occurs again. I don't know what cause this
> happen.:confused:
>
>
> #some default settings
>
> MonoSetEnv ORACLE_BASE=/opt/oracle/oradb
> MonoSetEnv ORACLE_HOME=/opt/oracle/oradb/home
> MonoSetEnv ORACLE_SID=imapdb

IIRC, MonoSetEnv must occur only once per application. Otherwise
it would overwrite the previous values. Try this (in one line):

MonoSetEnv
ORACLE_BASE=/opt/oracle/oradb;ORACLE_HOME=/opt/oracle/oradb/home;ORACLE_SID=imapdb


Robert

_______________________________________________
Mono-aspnet-list mailing list
Mono-aspnet-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-aspnet-list

Re: Could not allocate the Oracle environment

by adler5 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I make the Oracle enviroment like this. In my httpd.conf file put line
Include conf/website.conf
My website.conf file contains
Alias /website /var/www/html/website
MonoApplicationsConfigFile website /var/www/mono/website.webapp
MonoServerPath website "/usr/local/bin/mod-mono-server2"
<Location /website>
        Allow from all
        Order allow,deny
        SetHandler mono
        MonoSetServerAlias website
</Location>
I set Oracle enviroments in script /usr/local/bin/mod-mono-server2
ORACLE_BASE=/opt/oracle
ORACLE_HOME=$ORACLE_BASE/9.2
NLS_LANG=POLISH_POLAND.EE8MSWIN1250
LD_LIBRARY_PATH=$ORACLE_HOME/lib:$LD_LIBRARY_PATH
LIBPATH=$ORACLE_HOME/lib
LD_LIBRARY_PATH_32=$ORACLE_HOME/lib32
PATH=$PATH:$ORACLE_HOME/bin
LD_ASSUME_KERNEL=2.4.19
LANG=pl_PL.iso88592
export ORACLE_BASE ORACLE_HOME ORACLE_SID LD_LIBRARY_PATH LD_LIBRARY_PATH_32 PATH LD_ASSUME_KERNEL NLS_LANG LIBPATH
LANG
before line
exec /usr/local/bin/mono $MONO_OPTIONS "/usr/local/lib/mono/2.0/mod-mono-server2.exe" "$@"
Now you can connect to Oracle database.
MK

Re: Could not allocate the Oracle environment

by ibrahim steed :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thanks a lot.

what does "before line " mean?


adler5 wrote:
I make the Oracle enviroment like this. In my httpd.conf file put line
Include conf/website.conf
My website.conf file contains
Alias /website /var/www/html/website
MonoApplicationsConfigFile website /var/www/mono/website.webapp
MonoServerPath website "/usr/local/bin/mod-mono-server2"
<Location /website>
        Allow from all
        Order allow,deny
        SetHandler mono
        MonoSetServerAlias website
</Location>
I set Oracle enviroments in script /usr/local/bin/mod-mono-server2
ORACLE_BASE=/opt/oracle
ORACLE_HOME=$ORACLE_BASE/9.2
NLS_LANG=POLISH_POLAND.EE8MSWIN1250
LD_LIBRARY_PATH=$ORACLE_HOME/lib:$LD_LIBRARY_PATH
LIBPATH=$ORACLE_HOME/lib
LD_LIBRARY_PATH_32=$ORACLE_HOME/lib32
PATH=$PATH:$ORACLE_HOME/bin
LD_ASSUME_KERNEL=2.4.19
LANG=pl_PL.iso88592
export ORACLE_BASE ORACLE_HOME ORACLE_SID LD_LIBRARY_PATH LD_LIBRARY_PATH_32 PATH LD_ASSUME_KERNEL NLS_LANG LIBPATH
LANG
before line
exec /usr/local/bin/mono $MONO_OPTIONS "/usr/local/lib/mono/2.0/mod-mono-server2.exe" "$@"
Now you can connect to Oracle database.
MK

Re: Could not allocate the Oracle environment

by nzsaint :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


ibrahim steed wrote:
what does "before line " mean?
I just encountered this error on a new system I setup for development purposes after cloning the hard disk of my original (for some reason it wasn't occuring on the original). What adler5 meant was to modify your 'mod-mono-server2' script file (in my case at /opt/mono/bin) so it reads similar to as follows:

#!/bin/sh
export ORACLE_SID=XE
export ORACLE_BASE=/usr/lib/oracle/xe/app/oracle
export ORACLE_HOME=/usr/lib/oracle/xe/app/oracle/product/10.2.0/server
exec /opt/mono/bin/ $MONO_OPTIONS "/opt/mono/lib/mono/2.0/mod-mono-server2.exe" "$@"

N.B The paths on your system will vary and you may need to export more variables than I did (just 3) as adler5 listed.