linux6.x+oracle11g测试配置ipv6
明确一下:IPv6 Issues In 19c RAC (Doc ID 2924333.1)
oracle的单实例支持ipv6但rac不支持。
In 12.1.0.1 IPv6 is supported for the Public Network, IPv4 must be used for the Private Network.
Starting with 12.2.0.1 IPv6 is fully supported for both the public and private interfaces.
Please see the Oracle Database IPv6 State of Direction technical paper for details.
https://www.oracle.com/docs/tech/database/oracledatabaseipv6sod.pdf
添加ipv6地址:这个值可以任意设置???
[root@lnkf ~]# ifconfig em1 inet6 add 2024::57/64
[root@lnkf ~]# ifconfig -a|more
em1 Link encap:Ethernet HWaddr C8:1F:66:E3:DC:16
inet addr:192.168.205.57 Bcast:192.168.205.255 Mask:255.255.255.0
inet6 addr: 2024::57/64 Scope:Global
inet6 addr: fe80::ca1f:66ff:fee3:dc16/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:6870096 errors:32444 dropped:0 overruns:0 frame:32474
TX packets:4856695 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:1815237566 (1.6 GiB) TX bytes:1623105335 (1.5 GiB)
Interrupt:35
em2 Link encap:Ethernet HWaddr C8:1F:66:E3:DC:17
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)
Interrupt:38
em3 Link encap:Ethernet HWaddr C8:1F:66:E3:DC:18
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)
Interrupt:34
em4 Link encap:Ethernet HWaddr C8:1F:66:E3:DC:19
inet6 addr: fe80::ca1f:66ff:fee3:dc19/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:3 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 b) TX bytes:270 (270.0 b)
Interrupt:36
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:1799265 errors:0 dropped:0 overruns:0 frame:0
TX packets:1799265 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:384973715 (367.1 MiB) TX bytes:384973715 (367.1 MiB)
vmnet1 Link encap:Ethernet HWaddr 00:50:56:C0:00:01
inet addr:172.16.56.1 Bcast:172.16.56.255 Mask:255.255.255.0
inet6 addr: fe80::250:56ff:fec0:1/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:6 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)
vmnet8 Link encap:Ethernet HWaddr 00:50:56:C0:00:08
inet addr:192.168.181.1 Bcast:192.168.181.255 Mask:255.255.255.0
inet6 addr: fe80::250:56ff:fec0:8/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
测试ipv6联通性:
[root@lnkf ~]# ping6 2024::57 -c3
PING 2024::57(2024::57) 56 data bytes
64 bytes from 2024::57: icmp_seq=1 ttl=64 time=0.056 ms
64 bytes from 2024::57: icmp_seq=2 ttl=64 time=0.044 ms
^C
--- 2024::57 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1704ms
rtt min/avg/max/mdev = 0.044/0.050/0.056/0.006 ms
[root@lnkf ~]# ping6 fe80::ca1f:66ff:fee3:dc16%em1 -c3
PING fe80::ca1f:66ff:fee3:dc16%em1(fe80::ca1f:66ff:fee3:dc16) 56 data bytes
64 bytes from fe80::ca1f:66ff:fee3:dc16: icmp_seq=1 ttl=64 time=0.066 ms
64 bytes from fe80::ca1f:66ff:fee3:dc16: icmp_seq=2 ttl=64 time=0.087 ms
^C
--- fe80::ca1f:66ff:fee3:dc16%em1 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1488ms
rtt min/avg/max/mdev = 0.066/0.076/0.087/0.013 ms
配置监听ipv6:
[root@lnkf ~]# su - oracle
[oracle@lnkf ~]$ pwd
/home/oracle
[oracle@lnkf ~]$ cd $ORACLE_HOME/network/admin
[oracle@lnkf admin]$ vi listener.ora
# listener.ora Network Configuration File: /oracle/app/product/11.2.0/db_1/network/admin/listener.ora
# Generated by Oracle configuration tools.
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.205.57)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = 2024::57)(PORT = 1521))
)
)
ADR_BASE_LISTENER = /oracle/app
~
"listener.ora" 14L, 432C written
[oracle@lnkf admin]$ lsnrctl status
LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 20-MAY-2024 14:01:58
Copyright (c) 1991, 2013, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
TNS-12541: TNS:no listener
TNS-12560: TNS:protocol adapter error
TNS-00511: No listener
Linux Error: 2: No such file or directory
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.205.57)(PORT=1521)))
TNS-12541: TNS:no listener
TNS-12560: TNS:protocol adapter error
TNS-00511: No listener
Linux Error: 111: Connection refused
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=2024::57)(PORT=1521)))
TNS-12541: TNS:no listener
TNS-12560: TNS:protocol adapter error
TNS-00511: No listener
Linux Error: 111: Connection refused
[oracle@lnkf admin]$ lsnrctl start
LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 20-MAY-2024 14:02:00
Copyright (c) 1991, 2013, Oracle. All rights reserved.
Starting /oracle/app/product/11.2.0/db_1/bin/tnslsnr: please wait...
TNSLSNR for Linux: Version 11.2.0.4.0 - Production
System parameter file is /oracle/app/product/11.2.0/db_1/network/admin/listener.ora
Log messages written to /oracle/app/diag/tnslsnr/lnkf/listener/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.205.57)(PORT=1521)))
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=2024::57)(PORT=1521)))
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 11.2.0.4.0 - Production
Start Date 20-MAY-2024 14:02:00
Uptime 0 days 0 hr. 0 min. 0 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /oracle/app/product/11.2.0/db_1/network/admin/listener.ora
Listener Log File /oracle/app/diag/tnslsnr/lnkf/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.205.57)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=2024::57)(PORT=1521)))
The listener supports no services
The command completed successfully
[oracle@lnkf admin]$ lsnrctl status
LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 20-MAY-2024 14:02:04
Copyright (c) 1991, 2013, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 11.2.0.4.0 - Production
Start Date 20-MAY-2024 14:02:00
Uptime 0 days 0 hr. 0 min. 3 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /oracle/app/product/11.2.0/db_1/network/admin/listener.ora
Listener Log File /oracle/app/diag/tnslsnr/lnkf/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.205.57)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=2024::57)(PORT=1521)))
The listener supports no services
The command completed successfully
[oracle@lnkf admin]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Mon May 20 14:02:08 2024
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> alter system register;
System altered.
SQL> /
System altered.
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
[oracle@lnkf admin]$ lsnrctl status
LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 20-MAY-2024 14:02:21
Copyright (c) 1991, 2013, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 11.2.0.4.0 - Production
Start Date 20-MAY-2024 14:02:00
Uptime 0 days 0 hr. 0 min. 21 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /oracle/app/product/11.2.0/db_1/network/admin/listener.ora
Listener Log File /oracle/app/diag/tnslsnr/lnkf/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.205.57)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=2024::57)(PORT=1521)))
Services Summary...
Service "lndb" has 1 instance(s).
Instance "lndb", status READY, has 1 handler(s) for this service...
Service "lndbXDB" has 1 instance(s).
Instance "lndb", status READY, has 1 handler(s) for this service...
The command completed successfully
[oracle@lnkf admin]$ ll
total 24
-rw-r--r-- 1 oracle oinstall 432 May 20 14:01 listener.ora
-rw-r--r-- 1 oracle oinstall 357 May 20 13:53 listener.ora20240520
drwxr-xr-x 2 oracle oinstall 4096 Feb 22 2019 samples
-rw-r--r-- 1 oracle oinstall 381 Dec 17 2012 shrept.lst
-rw-r--r-- 1 oracle oinstall 284 Jan 25 2021 sqlnet.ora
-rw-r----- 1 oracle oinstall 497 Apr 10 2019 tnsnames.ora
[oracle@lnkf admin]$ more tnsnames.ora
# tnsnames.ora Network Configuration File: /oracle/app/product/11.2.0/db_1/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.
LNDB =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = lnkf)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = lndb)
)
)
LNDB58 =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.205.58)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = lndb)
)
)
[oracle@lnkf admin]$ vi tnsnames.ora
# tnsnames.ora Network Configuration File: /oracle/app/product/11.2.0/db_1/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.
LNDB57 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 2024::57)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = lndb)
)
)
~
~
"tnsnames.ora" 30L, 671C written
[oracle@lnkf admin]$ cat tnsnames.ora
# tnsnames.ora Network Configuration File: /oracle/app/product/11.2.0/db_1/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.
LNDB =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = lnkf)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = lndb)
)
)
LNDB58 =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.205.58)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = lndb)
)
)
LNDB57 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 2024::57)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = lndb)
)
)
测试ipv6连接:正常
[oracle@lnkf admin]$ sqlplus jyc/jyc@lndb57
SQL*Plus: Release 11.2.0.4.0 Production on Mon May 20 14:07:58 2024
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> exit
Disconnected
[oracle@lnkf admin]$ sqlplus jyc/jyc@[2024::57]:1521/lndb
SQL*Plus: Release 11.2.0.4.0 Production on Mon May 20 14:03:40 2024
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> select table_name from user_tables;
TABLE_NAME
------------------------------
J1
J2
T
T1
T2
SQL>
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
测试ipv4连接同样可以:
[oracle@lnkf admin]$ sqlplus jyc/jyc@192.168.205.57:1521/lndb
SQL*Plus: Release 11.2.0.4.0 Production on Mon May 20 14:07:13 2024
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
[oracle@lnkf admin]$
[root@lnkf ~]# netstat -ano|grep LISTEN|grep 1521
tcp 0 0 192.168.205.57:1521 0.0.0.0:* LISTEN off (0.00/0/0)
tcp 0 0 2024::57:1521 :::* LISTEN off (0.00/0/0)
相关参考:
https://www.modb.pro/db/424161
Enabling IPv6 on Oracle Database Enterprise Edition (文档 ID 783570.1)
How to Configure a Listener for Both IPv6 and IPv4 Addresses (文档 ID 2027612.1)
Configuring an Oracle Database, Enterprise Edition, with the IPv6 IPv4 Mapping Address (Doc ID 831153.1)