简体   繁体   中英

How to connect oracle Cloud Instance using Oracle Cloud Shell?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM