How to connect to a remote database using SQL*Plus?

To connect to a remote database, you can use the following command to connect using SQL*Plus.

sqlplus username/password@hostname:port/service_name

Among these, username is the username for the remote database, password is the password, hostname is the remote database’s host name or IP address, port is the remote database’s port number, and service_name is the service name of the remote database.

For example, if you wish to connect to a remote database with the hostname example.com, port number 1521, service name orcl, and using the username scott and password tiger, you can use the following command:

sqlplus scott/tiger@example.com:1521/orcl

After successfully connecting, you will enter the SQL*Plus command line interface, where you can perform SQL queries and other operations.

bannerAds