ORA-01435: user does not exist

I got this error when I tried to connect to Oracle within Apache Airflow. 

I am using docker oracle from gvenzl in M1 macbook. You can read the details on this page https://hub.docker.com/r/gvenzl/oracle-xe.

And in my db connection in Airflow, I defined my connection as

oracle://[username]:[pwd]@host.docker.internal:1521/XEPDB1?encoding=UTF-8&nencoding=UTF-8&threaded=False&events=False&mode=sysdba&purity=new&service_name=XEPDB1

XEPDB1 is the service name that is provided by gvenzl/oracle-xe by default.

In the beginning, I thought it was because the user I used does not exist or could not be found. So these are the step I did:

  1. I checked if the user exist. select * from all_users
  2. I found that the user does exist. So I did grant all to the user.
  3. I tried to connect to database via SQL Developer. And the connection is established!
  4. And various other things such as re-init the airflow and dockers, re-build, remove, etc. But it did not bring any result. 

In the end, I tried to read the airflow documentation again. And I saw that after port there should be no service name defined. 

AIRFLOW_CONN_ORACLE_DEFAULT='oracle://oracle_user:XXXXXXXXXXXX@1.1.1.1:1521?encoding=UTF-8&nencoding=UTF-8&threaded=False&events=False&mode=sysdba&purity=new'

So I tried it out by removing the service name defined there after port. And voila! It is working!

So, it seems that Airflow uses the wrong schema to Oracle. And of course Oracle usually use the same name for username and schema. The difference is schema is in capital and username is not in capital. 

So if the error message can be clearer, then it might help me to troubleshoot it faster. I was hoping that the error should be like

user or schema does not exist

Leave a Reply

Your email address will not be published. Required fields are marked *