rpm -ivh oracle-instantclient11.2-basic-11.2.0.4.0-1.x86_64.rpm rpm -ivh oracle-instantclient11.2-devel-11.2.0.4.0-1.x86_64.rpm rpm -ivh oracle-instantclient11.2-jdbc-11.2.0.4.0-1.x86_64.rpm rpm -ivh oracle-instantclient11.2-odbc-11.2.0.4.0-1.x86_64.rpm rpm -ivh oracle-instantclient11.2-sqlplus-11.2.0.4.0-1.x86_64.rpm rpm -ivh oracle-instantclient11.2-tools-11.2.0.4.0-1.x86_64.rpm
vim /etc/profile export ORACLE_HOME=/usr/lib/oracle/11.2/client64 export TNS_ADMIN=/usr/lib/oracle/11.2/client64 export LD_LIBRARY_PATH=/usr/lib/oracle/11.2/client64/lib export ORABIN=/usr/lib/oracle/11.2/client64/bin export PATH=$PATH:$ORABIN export PATH=$ORACLE_HOME:$PATH export PATH=$PATH:$HOME/bin:$ORACLE_HOME/bin
source /etc/profile
mkdir -p /usr/lib/oracle/11.2/client64/network/admin/ vim /usr/lib/oracle/11.2/client64/network/admin/tnsnames.ora TEST = (DESCRIPTION = (ENABLE = BROKEN) (FAILOVER = YES) (LOAD_BALANCE = OFF) (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.20.201)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = testdb) (FAILOVER_MODE = (TYPE = session) (METHOD = BASIC) (RETRIES = 30) (DELAY = 10) ) ) ) 192.168.1.10 = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.10)(PORT = 1521)) ) (CONNECT_DATA = (SERVICE_NAME = macpdb) ) )
登录本机数据库
sqlplus / as sysdba sqlplus username/password
登录远程数据库
sqlplus username/password@orcl sqlplus username/password@hosrIP:port/sid
sqlplus abc/abc#123@192.168.20.201:1521/testdb