Build Oracle Client Environment remote connection database under Linux

Source: Internet
Author: User
Tags dba sqlplus

First, Root user operation:(# is the root user,$ is Oracle User ) 1. download two rpm packages from Oracle website and place them under any path, using an rpm installation:

RPM-IVH oracle-instantclient11.2-basic-11.2.0.3.0-1.x86_64.rpm

RPM-IVH oracle-instantclient11.2-sqlplus-11.2.0.3.0-1.x86_64.rpm

The default installation is under/usr/lib/oracle/this path.

( Note: Need to register account before downloading, free, can register with confidence )

To Configure environment variables: ( my Profile )

#vim ~/.bash_profile

Path= $PATH: $HOME/bin

Export oracle_home=/usr/lib/oracle/11.2/client64/

Export tns_admin= $ORACLE _home/network/admin

Export ORACLE_BASE=/USR/LIB/ORACLE/11.2/

Export ld_library_path= $ORACLE _home/lib: $LD _library_path

Export PATH

Exit and save

# source ~/.bash_profile ( make it effective )

Create A tnsnames.ora configuration file

#cd/usr/lib/oracle/11.2/client64/ or #cd $ORACLE _home

#mkdir-P/network/admin ( create both directories )

#vim/usr/lib/oracle/11.2/client64/network/admin/tnsnames.ora

1 JK1 =

2 (DESCRIPTION =

3 (address_list =

4 (ADDRESS = (PROTOCOL = TCP) (HOST = 173.16.21.132) (PORT = 1521))

5)

6 (Connect_data =

7 (SERVER = dedicated)

8 (service_name = JK)

9)

0)

1: The name of the connection descriptor that you define.

4:host the IPof the database to be connected remotely , Port 1521 default .

8: The instance name of the database.

( Note: view instance name # ps-ef |grep Pmon

Oracle 3894 1 0 08:30? 00:00:00 ORA_PMON_JK

Root 5154 4546 0 09:56 pts/1 00:00:00 grep pmon

JK is the instance name )

2. Connect to the database:

# cd/usr/lib/oracle/11.2/client64/bin/

Error (1)

#./sqlplus System/[email Protected] (System: user name oracle: password jk1: Name of the connection descriptor you define )

Sql*plus:release 11.2.0.3.0 Production on Tue Dec 27 09:56:54 2016

Copyright (c) 1982, Oracle. All rights reserved.

ERROR:

Ora-21561:oid generation failed

Error Found: Error:ora-21561:oid generation failed

Workaround:

# hostname ( view machine name inconsistent with localhost after 127.0.0.1 )

Cenos

# cat/etc/hosts

127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4

:: 1 localhost localhost.localdomain localhost6 localhost6.localdomain6

# hostname localhost ( temporary modification )

# hostname

localhost

# vim/etc/sysconfig/network ( permanently modified, restart effective )

1 Networking=yes

2 Hostname=localhost ( modified )

Error (2)

Execute again:

#./sqlplus System/[email protected]

Sql*plus:release 11.2.0.3.0 Production on Tue Dec 27 10:08:11 2016

Copyright (c) 1982, Oracle. All rights reserved.

ERROR:

Ora-12541:tns:no Listener

error found : Error:ora-12541:tns:no listener

workaround : Check that the database server is listening ? whether the database is up ?

$ lsnrctl Start ( open monitor )

$ sqlplus/as SYSDBA ( Access database Admin user )

Sql*plus:release 10.2.0.4.0-production on mainlandclean? T. 10:17:40

Copyright (c) 1982, Oracle. All rights Reserved.

Connected to an idle instance.

Sql> Startup ( startup database )

ORACLE instance started.

Total System Global area 226492416 bytes

Fixed Size 2082912 bytes

Variable Size 184551328 bytes

Database buffers 33554432 bytes

Redo buffers 6303744 bytes

Database mounted.

Database opened.

Sql> ( database up!!) )

Error (3)

Execute again:

#./sqlplus System/[email Protected]

Sql*plus:release 11.2.0.3.0 Production on Tue Dec 27 10:15:06 2016

Copyright (c) 1982, Oracle. All rights reserved.

ERROR:

Ora-12543:tns:destination Host Unreachable

Error Found: Error:ora-12543:tns:destination Host Unreachable

Workaround: The service side firewall should be on, shut down the firewall.

# service Iptables Stop ( immediate effect, restart Recovery )

Clear Firewall rules: [ OK ]

set chains to ACCEPT Policy:Filter [ OK ]

Unloading in progress Iiptables module: [ OK ]

Success (4)

Execute again:

#./sqlplus System/[email Protected]

Sql*plus:release 11.2.0.3.0 Production on Tue Dec 27 10:18:26 2016

Copyright (c) 1982, Oracle. All rights reserved.

Connected to:

Oracle Database 10g Enterprise Edition Release 10.2.0.4.0-64bit Production

With the partitioning, OLAP, Data Mining and Real application testing options

Sql>

Connection Successful!!

Second, create oralce users and oinstall groups, easy to manage the database: (1)

To create a group:

#groupadd Oinstall

#groupadd DBA

Create a user home directory /home/oracle:

#mkdir-P/home/oracle

Create user Oracle to Primary group Oinstall, Sub-group dba, home directory /home/oracle:

#useradd-G oinstall-g dba-d/home/oracle/oracle

to view the addition of user Oracle:

# ID Oracle

uid=501 (Oracle) gid=503 (oinstall) Group =503 (Oinstall), 504 (DBA)

Copy the Oracle directory under/usr/lib/oracle/to /home/oracle

#cp-R/usr/lib/oracle//home/oracle

Change owner/home to Oracle

#chown-R Oracle:oinstall/home

#ll/home/( view )

Oracle Oinstall 4096 19:14 Oracle

Error (2)

#su-oracle ( enter oracle user )

-bash-3.2$

And not

[Email protected] ~]$

workaround : the . bash* profile is missing under The Oracle User , and the root user is copied over

#ll-A ~ ( see what the bash configuration file is under root )

-RW-------. 1 root root 14941 10:24. Bash_history

-rw-r--r--. 1 root root 5 months . Bash_logout

-rw-r--r--. 1 root root 368 18:16. Bash_profile

-rw-r--r--. 1 root root 176 9 months 2004. BASHRC

copy these to /home/oracle/ and chown change their user group to Oracle:oinstall.

again :

# su-oracle

[[email protected] ~]$ pwd ( normal )

/home/oracle/

Error (3) The following are performed under Oracle user

To start connecting to the database:

$ sqlplus System/[email protected]

-bash:sqlplus:command not found

problem found:sqlplus Command not found, should be not configured environment variable

Workaround:

$ vim ~/.bash_profile

( Add this )

Export path= $PATH: $HOME/bin: $ORACLE _home/bin

Exit and save

$ source ~/.bash_profile ( make it effective )

Success (4)

Execute again:

$ sqlplus System/[email protected]

Sql*plus:release 11.2.0.3.0 Production on Tue Dec 27 11:05:09 2016

Copyright (c) 1982, Oracle. All rights reserved.

Connected to:

Oracle Database 10g Enterprise Edition Release 10.2.0.4.0-64bit Production

With the partitioning, OLAP, Data Mining and Real application testing options

Sql>

Connection Successful!!

Recently set up Oracle client environment on the collation of the error and solution, the big God passing if found wrong place want to point out!!

Build Oracle Client Environment remote connection database under Linux

Related Article

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.