For a start, check other similar posts on GeoNet:
*You must install ArcGIS 10.5.1 (Desktop, Engine, Server) Oracle critical issues and 12.2.01 Support Patch on all 10.5.1 client machines to use Oracle 12.2.01 with ArcGIS
I think connection from ArcGIS Desktop 10.5 is not supported. You will need Desktop 10.5.1 along with the below patch:
Also, make sure you are putting the correct hostname in the connection file.
You must have ArcGIS 10.5 installed.....the patch is for ArcGIS 10.5.1. Desktop 10.5 and Desktop 10.5.1 are different ArcGIS Desktop versions.
So download the setup for ArcGIS Desktop 10.5.1, install it, install the patch and then try connecting to your Database.
ArcMap or ArcGIS 10.6.1 supports Oracle 12.2 and here is the web help link:
Asrujit suggested the oracle critical patch for ArcMAP 10.5.1 as you are using 10.5.1 with Oracle 12.2. If you upgraded your ArcGIS Desktop or AraMAP to 10.6.1 then you can directly connect to Oracle 12.2 as 10.6.1 supports Oracle 12.2 and do not need the patch. That patch is for ArcMAP 10.5.1.