Sqlplus remote Oracle access tutorial in Linux, sqlplusoracle

Source: Internet
Author: User

Sqlplus remote Oracle access tutorial in Linux, sqlplusoracle

Step 1: Download instantclient

Instantclient-basic-linux.x64-12.1.0.2.0.zip // required

Instantclient-sqlplus-linux.x64-12.1.0.2.0.zip // required

Instantclient-odbc-linux.x64-12.1.0.2.0.zip // This is not required, the package to be used for unixODBC connection

Decompress the above two zip packages to any location, such as/opt/oracle/instantclient_12_1.

The following is an official oracle document.

3. Create the appropriate libclntsh. so and libocci. so links for the version of Instant Client. For example:

Cd/opt/oracle/instantclient_12_1

Ln-s libclntsh. so.12.1 libclntsh. so

Ln-s libocci. so.12.1 libocci. so

4. Install the libaio package, for example on Oracle Linux, run this as the root user: // note that I have not installed the libaio package

Yum install libaio

On some Linux distributions the package is called libaio1.

Step 2:

Configure environment variables:

Export LD_LIBRARY_PATH =/opt/oracle/instantclient_12_1: $ LD_LIBRARY_PATH

Export PATH =/opt/oracle/instantclient_12_1: $ PATHNLS_LANG = "AMERICAN_AMERICA.AL32UTF8"

Query the database service name in the database

select value from v$parameter where name='service_names'

Logon: sqlplus username/passwd @ IP: port/servicename // note that the port is servicename instead of instance name.

Step 3: Access oracle by configuring tnsnames. ora

Configure Environment Variables

Export TNS_ADMIN =/opt/oracle/instantclient_12_1

Create a tnsnames. ora file under TNS_ADMIN

Content:

Oracledb = // login SID (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP) (HOST = 192.168.103.20.) (PORT = 1521 )) // IP address and port number (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = orc9i) // you need to connect to the database servicename ))

Log on to sqlplus username/passwd @ oracledb

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.