docker-images icon indicating copy to clipboard operation
docker-images copied to clipboard

how to prepare sqlnet.ora on first startup

Open AlBundy33 opened this issue 2 years ago • 14 comments

I need to set DISABLE_OOB=ON in sqlnet.ora according to https://github.com/oracle/docker-images/blob/main/OracleDatabase/SingleInstance/FAQ.md#ora-12637-packet-receive-failed

but how can i do this on first start? My current approach is to start the container with docker run wait for the output, that the database is ready (periodically check docker logs) execute the mentioned echo-command with docker exec and finally run docker restart

is there maybe an easier way to add this setting to sqlnet.ora?

AlBundy33 avatar Apr 07 '22 21:04 AlBundy33

You can also add the setting (if you actually need it) to your application "client-side" sqlnet.ora files.

cjbj avatar Apr 08 '22 01:04 cjbj

I'd like to have it on the server-side. So I don't have to care about the clients

AlBundy33 avatar Apr 08 '22 06:04 AlBundy33

or has someone a hint why on some systems DISABLE_OOB=ON is necessary and how to fix this on docker or operating system level?

e.g. to connect from my windows vm to the oracle container on my mac does not need the setting. but running it on a debian 11 machine and connecting from another container running on the same machine needs the setting.

AlBundy33 avatar Apr 08 '22 21:04 AlBundy33

what do you think about an environment-variable DISABLE_OOB that is automatically added to sqlnet.ora on first start?

AlBundy33 avatar Apr 12 '22 18:04 AlBundy33

Please try out the approach I suggested in #2338

yunus-qureshi avatar Apr 13 '22 09:04 yunus-qureshi

using a setup-script seems to work but requires an additional folder an file this and my workaround

# executed after container is started and prepared
docker exec oracle1 "/bin/sh" -c "echo DISABLE_OOB=ON>>/opt/oracle/oradata/dbconfig/XE/sqlnet.ora"
docker restart oracle1

are working but maybe you'd consider to add DISABLE_OOB as envorinment-variable because it seems to be a required setting on some networks to avoid ORA-12637: Packet receive failed

AlBundy33 avatar Apr 14 '22 11:04 AlBundy33

As this is not a server side param but related to client connections, having it as an env passed to DB docker image does not seem correct. You can always install Oracle instance client locally and have this added permanently for client connections

yunus-qureshi avatar Apr 19 '22 05:04 yunus-qureshi

@yunus-qureshi the name is "Oracle Instant Client" :)

cjbj avatar Apr 19 '22 06:04 cjbj

@cjbj Tnx, yes that's what I meant

yunus-qureshi avatar Apr 19 '22 06:04 yunus-qureshi

Of course it os a server-side param - I set it currently only on the server because the are multiple clients (jdbc, odbc, crystal reports, ...)

AlBundy33 avatar Apr 19 '22 09:04 AlBundy33

No it is not, you are just using the client pieces of the software in the docker image to connect to the DB.

The same can be achieved by installing Oracle instant client pieces anywhere on your host https://www.oracle.com/se/database/technologies/instant-client/downloads.html

yunus-qureshi avatar Apr 19 '22 10:04 yunus-qureshi

for jdbc I do not have to install oracle instant client and I currently set DISABLE_OOB only in the server container and leave the clients untouched.

I was pretty sure that there was a hint in the FAQ that it can be set on the server-side but maybe I got this information from another site.

oracle documentation says The sqlnet.ora file is the Net Services profile configuration file. The sqlnet.ora file resides on clients and databases.

https://docs.oracle.com/en/database/oracle/oracle-database/21/netrf/parameters-for-the-sqlnet.ora.html#GUID-19423B71-3F6C-430F-84CC-18145CC2A818

AlBundy33 avatar Apr 19 '22 10:04 AlBundy33

For JDBC have you tried setting oracle.net.disableOob=true

May be put on the Java cmd line -Doracle.net.disableOob=true

https://docs.oracle.com/cd/E18283_01/appdev.112/e13995/constant-values.html#oracle_jdbc_OracleConnection_CONNECTION_PROPERTY_THIN_NET_DISABLE_OUT_OF_BAND_BREAK_DEFAULT

yunus-qureshi avatar Apr 19 '22 11:04 yunus-qureshi

No - because I didn't want to change all client-settings.

Therefore I've added DISABLE_OOB=ON to sqlnet.ora on the server-side which works as expected for java applications as well as for the oracle instant client. All clients are NOT running in the server container.

Because this problem seems to be occur on some networks and is so easy to fix I thought it would be a good idea to have an environment-variable for the docker run command to automatically add the line to sqlnet.ora

AlBundy33 avatar Apr 19 '22 11:04 AlBundy33