Closed phisii closed 3 months ago
Hi @phisii,
Thanks a lot for using these images to extend your CI/CD workflows!
Hm, ORA-12514 usually means either a typo in the service name or that the service is not yet registered with the Listener.
However, the service itself is registered when the database is started up, i.e. once you see DATABASE IS READY TO USE!
.
From above, everything seems correct, the only thing I can think of and have seen in the past is that the app tries to connect before the database is fully started.
Do your tests wait/check for DATABASE IS READY TO USE!
?
If not, you may run into a race condition and the service is indeed not yet registered with the Listener by the time the app is trying to connect to the database.
Thanks for the response. We are still searching for a solution.
Yes, we are waiting for the database to startup. Our logs also show this.
We also tried the Oracle 21 Images and your new Oracle 23 Free Images as Base Image (with the appropriate connection strings with "/XEPDB1" and "/FREEPDB1"), but still got the same error.
The issue https://github.com/gvenzl/oci-oracle-xe/issues/126 seems somewhat similar to our problem. We are working in a large enterprise IT infrastructure, so we don't have direct access to the Gitlab Runner/Docker settings, and can not easily test the suggested solutions. But we will further investigate this.
Hey @phisii,
I think I missed a crucial part of your first message:
When starting the container local a connection from outside the container is possible. Also we tried to get our program files into the image and starting the tests in the container, everything works fine.
Given that everything works fine locally and inside the container, it would suggest that the issue isn't so much with the Listener/container itself, but getting to wherever the container is running.
Could it be perhaps a firewall/config issue (I know you just said that getting to the Docker settings, etc. is hard because of the enterprise IT infrastructure)? Is there any way for you to spin up a container on some other machine and see whether you can connect to that, outside of GitLab? If so, that would suggest the issue is isolated to the GitLab CI/CD environment.
Hope this helps.
Today I spent like 4 hours around ORA-12514
error.
(at least in my case) it is a server issue.
When I run the server using:
docker run -it --network=host -eORACLE_PASSWORD=atk4_pass gvenzl/oracle-xe:21-slim
I always get the ORA-12514
error when I try to connect from OCI client or via sqlplus executable.
The fix is to run the server using:
docker run -it -p 1521:1521 -eORACLE_PASSWORD=atk4_pass gvenzl/oracle-xe:21-slim
Notice the --network=host
vs. -p 1521:1521
difference. I can reproduce it repeatably. I also tried to spin MySQL, PostgreSQL, MSSQL server containers and none of them suffer this issue. A listening port on *:1521
is opened correctly + DATABASE IS READY TO USE!
is shown in both cases.
The question is, why with --network=host
the Oracle server cannot be accessed? Is this something that can be fixed?
Hi everyone,
@gvenzl thanks for the input:
We were able to set up a local runner on our own PC, there the Image and Connection to the application is running without the problem (So Gitlab does the same thing, just on our PC instead of the cloud instances, and it's working). We are now talking to the administration of the cloud environment, to find out what the issue is. Will keep you updated, if we find something.
@mvorisek interesting, thanks. But I don't know if this is relate to our problem. I couldn't replicate it on my pc.
Managed to get this working on the CI pipeline referenced above by adding .WithHostname("localhost")
(this is TestContainers.Net using the image).
I was seeing a strange ORA-12514 error message Service XEPDB1 is not registered with the listener at host 127.0.0.1/127.0.0.1 - that "127.0.0.1/127.0.0.1" at the end was bugging me, so on a bit of a whim I tried setting localhost and it worked.
It's worth saying the original code worked fine on my desktop and laptop, like the original issue this was only failing on the CI runner (I don't know the specifics of the setup there).
Just want to say @cmdkeen thank you for provided solution. I've had the same issue running oracle-free container in podman. I was also using --network host
and connection attempt was giving me the same error:
ORA-12514: Cannot connect to database. Service FREEPDB1 is not registered with the listener at host 127.0.0.1 port 1521.
Adding --hostname localhost
to executed command fixed the issue. Thanks!
Hello,
first I want to thank @gvenzl for providing these images. They are very helpful for us.
We want to use a Oracle DB for automatic testing on our Gitlab CI Pipeline. We have a Java-Spring application that wants to connect to a Oracle 11 Database. On our local systems everything works without a problem, but when we try our image on the CI we get the error:
We use a self build image based on the Oracle 11 Images: (We choose to create our own image because we need to import a big dataset, which is to large for importing on every start. For this we use the entrypoint scripts.) (Usernames, passwords, .. set like this for display reasons).
Our import scripts: 1-setup-db.sql:
2-import-dump.sh: (We had a problem with the impdp command, but fixed thanks to this thread: https://github.com/gvenzl/oci-oracle-xe/issues/156)
When starting the container local a connection from outside the container is possible. Also we tried to get our program files into the image and starting the tests in the container, everything works fine.
But on the Gitlab Pipeline we get the ORA-12514 error.
Our connection string (localhost or the container hostname when used as service):
Startup log of DB:
We would be thankful for any ideas. Thanks.