How to connect oracle Cloud Instance using Oracle Cloud Shell? - oracle

I am using following Command to connect oracle cloud instance 19c using Oracle Cloud Shell
sqlplus username/password#db
It shows following error
SQL*Plus: Release 19.0.0.0.0 - Production on *******
Version 19.5.0.0.0
Copyright (c) 1982, 2019, Oracle. All rights reserved.
ERROR:
ORA-12154: TNS:could not resolve the connect identifier specified

Depending on the type of Database you have in OCI, you can connect from Cloud Shell to that database via a Service Gateway.
https://docs.cloud.oracle.com/en-us/iaas/Content/Network/Tasks/servicegateway.htm
Both Cloud Shell and Cloud Infrastructure Databases (such as Autonomous Transaction Processing database) can be accessed via a Service Gateway without using the public internet.
https://www.oracle.com/cloud/networking/service-gateway.html

The Cloud Shell isn't connected to your VCNs - it will need to access your database through internet. For this to happen, you'll need to open your database's listener port to the internet, and this is a "VERY BAD IDEA" generally speaking.
Best is to create a VM instance in the same VCN and connect to the DB from the VM.
If you want to eliminate all the intermediate layers for your test, even the local VCN network, then you can connect directly to the DB node using ssh and emit your select from there.

Here's a quick how-to guide on how to connect your on-prem SQL Dev tool to Oracle Cloud Database. https://www.youtube.com/watch?v=3bJ3JlpGlPo&list=PLdtXkK5KBY56jDbMevAMIbZGVAGUz9aYQ&index=14 You can create a bastion session, use ssh port forwarding to connect your local DB tools to cloud database instance using DB listener port for sqlnet.

Related

GCP Datafusion oracle connectivity issues

We're currently having issues setting up a connection to oracle datasources in datafusion (via jdbc) and i'm not sure if i am missing something.
Bit of a background, we had issues connecting to any data source initially so in gcp i setup a vm instance to act as a proxy server (due to it being a private datafusion instance) and used iptables to register the connections.
After this i can successfully connect to sql server datasources, on the vm instance i can ping and telnet all oracle and sql datasources.
Network connectivity tests show datafusion can connect to the proxy and also that the proxy can hit datasources on-prem.
The following pics are of my connection to oracle under namespace admin in datafusion
The ip address is of the proxy instance and the port is what was assigned in the iptable entry
Again this works for sql server. Our datateam can connect to these datasources via bigquery using odbc, but it looks like you cannot use that connection type in datafusion.
Think we have resolved the issue. We noticed the logins being used had older password versioning for oracle 10, 11 etc. Got the oracle dba to create a new user to test and connection successful instantly :)

Connection to Oracle Autonomous Database using sqlplus without wallet

I'm trying to connect to Oracle Autonomous Database using EZ CONNECT string: user/password#host:port/service_name
I have configured the access from the IP addresses I need to connect and set mTLS as not required:
As a result, I can successfully connect to the database when I use the wallet downloaded from the console.
But if I try to connect to the DB using EZ CONNECT string, I get the following error:
sqlplus -l user/password#tcp://adb.us-sanjose-1.oraclecloud.com:1521/service_name_high.adb.oraclecloud.com
SQL*Plus: Release 19.0.0.0.0 - Production on Wed May 25 00:19:38 2022
Version 19.8.0.0.0
Copyright (c) 1982, 2020, Oracle. All rights reserved.
ERROR:
ORA-12547: TNS:lost contact
SP2-0751: Unable to connect to Oracle. Exiting SQL*Plus
Is it possible to connect to Autonomous Database using EZ CONNECT string? If yes, then what am I doing wrong?
Update 1:
I also tried to use a full connect string
sqlplus -l user/pass#'(description= (retry_count=20)(retry_delay=3)(address=(protocol=tcps)(port=1521)(host=adb.us-sanjose-1.oraclecloud.com))(connect_data=(service_name=xxxxxxx_high.adb.oraclecloud.com))(security=(ssl_server_dn_match=yes)(ssl_server_cert_dn="CN=adb.us-sanjose-1.oraclecloud.com, OU=Oracle ADB SANJOSE, O=Oracle Corporation, L=Redwood City, ST=California, C=US")))'
but then the connection fails with the following error ORA-28759: failure to open file.
I suspect that it's some security settings, but I can clearly see that my IP is enabled and since with the same security settings I can connect with mutual TLS and wallet, I don't understand where the problem might be.
You can configure Autonomous to allow connection without a WALLET:
https://docs.oracle.com/en/cloud/paas/autonomous-database/adbsa/support-tls-mtls-authentication.html
(Which looks like you done that)
However you still need TCPS and not TCP:
https://docs.oracle.com/en/cloud/paas/autonomous-database/adbsa/connect-jdbc-thin-tls.html - and you need to pass the security part, which cannot be passed today in the short format (see connecting without a wallet).
PS: Autonomous Dedicated (ADB-D) allows connecting with pure TCP.

Connecting to On-Premises Oracle DB from Azure Data Factory

Trying to connecting to On-Premises Oracle DB from Azure Data Factory.
Current Setup:
Oracle db - On Premises
VM with Self Hosted Integration Runtime on Azure - Tested with other MSSQL Server Databases - can connect successfully - This VM is managed by ITP (our Cloud Hosting Team), developers don't have access to it.
Azure Data Factory - configured to consume above Self Hosted Integration Runtime.
I can connect to Oracle db from my local machine, using Taod for Oracle. When passed same credential details - connection fails from ADF.
Do I need to ask ITP to install ODAC on VM for the connectivity?
Congratulations that #Sreedhar have figured out the error by himself:
"Figured out, just need to install Oracle Data Access Components (ODAC) on the VM and everything works."
I help him post it as answer and this can be beneficial to other community members.

SQL Plus: How do I specify a database or instance to connect to when multiple instances are installed

On Windows Server 2012 R2, I have Oracle 11G and Oracle 12C installed.
Everyting is working as needed, I am able to use SQL Developer to connect to individual instances.
However, in addition to using SQL Developer, I need to use SQL Plus.
How do I specify which Instance to connect to using commands?
In the TNS file, each instance is on a separate port and has a different SID but uses the same IP.
Thanks
you can always
connect user/password#server:port/SID|SERVICE

Connecting to remote Oracle database using Oracle Client

I have to connect to a remote Oracle database. Connection will only work with a VPN access to the remote network. I have already setup the VPN, and that is working.
Remote team has passed TNS.ORA settings. I have hardly worked on configuring oracle and neither I am aware of the setup that I need to have on my machine. I just need to run few queries to test the data.
Can somebody guide me on the setup and the configuration I need to have on my windows 7 to connect to a remote Oracle database ?.
My first assumption was to download Oracle client. I downloaded Oracle Insta Client files, but I have no idea how to configure it to connect to a remote database. I couldn't even find any ORA file in the installed files of Insta client.
One you installed the instant client and installed it, you can conect to the remote database by using an easyconnect string. If you are in sqlplus you can do the following:
CONNECT username#[//]host[:port][/service_name][:server][/instance_name]
Lets assume your remote host is remote1 and the service_name is test (This can be retrieved from the tnsnames.ora)
connect username#//remote1/test

Resources