主要转发过程 通过客户端的 1555 端口 转发到服务器的 1521端口上具体步骤
1、在客户端上执行
[oracle@normal admin]$ ssh -CNfg -L 1555:192.168.137.11:1521 oracle@192.168.137.11
oracle@192.168.137.11''s password:2、使用netstat查看信息(这里我客户端和服务器是在同一台机器上)
[oracle@normal admin]$ netstat -an | grep 155
tcp 0 0 0.0.0.0:1555 0.0.0.0:* LISTEN
tcp 0 0 :::1555 :::* LISTEN3、在客户端上配置tnsname.ora
normal1 = (
DESCRIPTION = (
ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.137.11)(PORT = 1555)
)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = normal)
)
)4、测试转发功能
[oracle@normal admin]$ sqlplus chenhao/oracle@normal1
SQL*Plus: Release 11.2.0.3.0 Production on Tue Aug 26 17:30:10 2014
Copyright (c) 1982, 2011, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL>5、停用SSH转发功能
[oracle@normal admin]$ ps -ef | grep ssh
oracle 2861 1 0 17:28 ? 00:00:00 ssh -CNfg -L 1555:192.168.137.11:1521 oracle@192.168.137.1
[oracle@normal admin]$ kill -9 28616、测试停用
[oracle@normal admin]$ sqlplus chenhao/oracle@normal1
SQL*Plus: Release 11.2.0.3.0 Production on Tue Aug 26 17:40:01 2014
Copyright (c) 1982, 2011, Oracle. All rights reserved.
ERROR:
ORA-12541: TNS:no listener