Client configuration and error: [oracle @ bys3 admin] $ cat tnsnames. ora
Bysrac =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP) (HOST = 192.168.1.228) (PORT = 1521) -- the ip address here is the scanip address of RAC.
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = bysrac)
)
)
[Oracle @ bys3 admin] $ tnsping bysrac
TNS Ping Utility for Linux: Version 11.2.0.4.0-Production on 01-JAN-2014 20:25:19
Copyright (c) 1997,201 3, Oracle. All rights reserved.
Used parameter files:
Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP) (HOST = 192.168.1.228) (PORT = 1521) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = bysrac )))
OK (10 msec) -- tnsping can be connected normally.
Client using sqlplus bys/bys @ bysrac login error: ORA-12545: Connect failed because target host or object does not exist
[Oracle @ bys3 admin] $ sqlplus bys/bys @ bysrac
SQL * Plus: Release 11.2.0.4.0 Production on Wed Jan 1 20:10:31 2014
Copyright (c) 1982,201 3, Oracle. All rights reserved.
ERROR:
ORA-12545: Connect failed because target host or object does not exist
############### Solution: Modify the local_listener parameter of RAC, change the value of HOST = In the parameter value to the VIP or scanip address of the current node. Note: when the HOST parameter is the IP address of the vip address of the current node, the client can connect to the RAC database through SCANIP or VIP.-- Here is the IP address changed to VIP. -- In fact, it should be changed to SCANIP, and the client uses SCANIP for connection.
The HOST parameter is the scanip address, and after the parameter is modified, scanip can be used normally, but if there is a client configuration using vip, the connection will encounter an error: ORA-12514: TNS: listener does not currently know of service requested in connect descriptor.
Specific modification steps: view the SCANIP status and listening status of RAC [oracle @ bysrac1 ~] $ Su-grid
Password:
[Grid @ bysrac1 ~] $ Srvctl config scan
SCAN name: bysrac-cluster-scan, Network: 1/192. 168.1.128/255.255.255.128/eth0
Scan vip name: scan1, IP:/bysrac-cluster/192.168.1.228
[Grid @ bysrac1 ~] $ Srvctl status scan
Scan vip scan1 is enabled
Scan vip scan1 is running on node bysrac1
[Grid @ bysrac1 ~] $ Lsnrctl status
LSNRCTL for Linux: Version 11.2.0.1.0-Production on 01-JAN-2014 20:10:13
Copyright (c) 1991,200 9, Oracle. All rights reserved.
Connecting to (DESCRIPTION = (ADDRESS = (PROTOCOL = IPC) (KEY = LISTENER )))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 11.2.0.1.0-Production
Start Date 28-DEC-2013 20:06:56
Uptime 4 days 0 hr. 3 min. 17 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File/g01/app/11.2.0/grid/network/admin/listener. ora
Listener Log File/g01/app/grid/diag/tnslsnr/bysrac1/listener/alert/log. xml
Listening Endpoints Summary...
(DESCRIPTION = (ADDRESS = (PROTOCOL = ipc) (KEY = LISTENER )))
(DESCRIPTION = (ADDRESS = (PROTOCOL = tcp) (HOST = 192.168.1.226) (PORT = 1521 )))
(DESCRIPTION = (ADDRESS = (PROTOCOL = tcp) (HOST = 192.168.1.221) (PORT = 1521 )))
Services Summary...
Service "+ ASM" has 1 instance (s ).
Instance "+ ASM1", status READY, has 1 handler (s) for this service...
Service "bysrac" has 1 instance (s ).
Instance "bysrac1", status READY, has 1 handler (s) for this service...
Service "caiwu" has 1 instance (s ).
Instance "bysrac1", status READY, has 1 handler (s) for this service...
Service "jiaoyi" has 1 instance (s ).
Instance "bysrac1", status READY, has 1 handler (s) for this service...
The command completed successfully
[Grid @ bysrac1 ~] $ Exit
[Oracle @ bysrac1 ~] $ Cat/etc/hosts
# Do not remove the following line, or various programs
# That require network functionality will fail.
127.0.0.1 localhost. localdomain localhost
: 1 localhost6.localdomain6 localhost6
192.168.1.221 bysrac1 bysrac1.bys.com
192.168.1.226 bysrac1-vip
192.168.1.222 bysrac2 bysrac2.bys.com
192.168.1.227 bysrac2-vip
192.168.10.1 bysrac1-priv
Bysrac2-priv 192.168.10.2
192.168.1.228 bysrac-cluster-scan Experiment 1: Modify the local_listener parameter of RAC, change the value of HOST = In the parameter value to the VIP value of the current node -- RAC must be changed for multiple nodes [oracle @ bysrac1 ~] $ Sqlplus bys/bys
BYS @ bysrac> select instance_name from v $ instance;
INSTANCE_NAME
----------------
Bysrac1
BYS @ bysrac1> show parameter local_l ------- view the value of the local_listener parameter
NAME TYPE VALUE
-----------------------------------------------------------------------------
Local_listener string (DESCRIPTION = (ADDRESS_LIST = (AD
DRESS = (PROTOCOL = TCP) (HOST = bysr
Ac1-vip) (PORT = 1521 ))))
BYS @ bysrac1> alter system set local_listener = '(DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP) (HOST = 192.168.1.226) (PORT = 1521 )))) 'sid = 'bysrac1 ';
System altered. -- Here HOST = 192.168.1.226 is changed to the IP address of the VIP address of the node.I have modified only one node here. If multiple nodes exist, modify them on other nodes as per this method.
BYS @ bysrac1> show parameter local_l
NAME TYPE VALUE
-----------------------------------------------------------------------------
Local_listener string (DESCRIPTION = (ADDRESS_LIST = (AD
DRESS = (PROTOCOL = TCP) (HOST = 192.
168.1.226) (PORT = 1521 ))))
BYS @ bysrac1> exit --- You can manually register and listen to alter system register before exiting. This is also possible if you have not done so here.
Any SCANIP or VIP client in tnsnames. ora can log on to the RAC database.
1. Use the SCNAIP configuration method to log on to [oracle @ bys3 admin] $ tnsping bysrac
TNS Ping Utility for Linux: Version 11.2.0.4.0-Production on 01-JAN-2014 20:25:19
Copyright (c) 1997,201 3, Oracle. All rights reserved.
Used parameter files:
Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP) (HOST = 192.168.1.228) (PORT = 1521) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = bysrac )))
OK (10 msec) -- tnsping can be connected normally. HOST = 192.168.1.228 the SCANIP of a node in tnsnames. ora has been changed to RAC .. Saves space and does not post tnsnames. ora
[Oracle @ bys3 admin] $ sqlplus bys/bys @ bysrac
SQL * Plus: Release 11.2.0.4.0 Production on Wed Jan 1 20:34:53 2014
Copyright (c) 1982,201 3, Oracle. All rights reserved.
Connected:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0-Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options
BYS @ bysrac> select instance_name from v $ instance;
INSTANCE_NAME
----------------
Bysrac1
BYS @ bysrac> exit
2. The client can also use VIP to connect to the RAC database [oracle @ bys3 admin] $ tnsping bysrac
TNS Ping Utility for Linux: Version 11.2.0.4.0-Production on 01-JAN-2014 20:52:54
Copyright (c) 1997,201 3, Oracle. All rights reserved.
Used parameter files:
Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP) (HOST = 192.168.1.226) (PORT = 1521) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = bysrac )))
OK (10 msec) ----- tnsping can be normally connected, HOST = 192.168.1.226 here tnsnames. ora has changed to the VIP of a node of RAC .. Saves space and does not post tnsnames. ora
[Oracle @ bys3 admin] $ sqlplus bys/bys @ bysrac
SQL * Plus: Release 11.2.0.4.0 Production on Wed Jan 1 20:52:57 2014
Copyright (c) 1982,201 3, Oracle. All rights reserved.
Connected:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0-Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options
BYS @ bysrac> select instance_name, status from v $ instance;
INSTANCE_NAME STATUS
----------------------------
Bysrac1 OPEN
BYS @ bysrac> exit
################
Tutorial 2: Modify the local_listener parameter of RAC and change the value of HOST = In the parameter value to scanip.
[Oracle @ bysrac1 ~] $ Sqlplus bys/bys
BYS @ bysrac1> show parameter local_listener
NAME TYPE VALUE
-----------------------------------------------------------------------------
Local_listener string (DESCRIPTION = (ADDRESS_LIST = (AD
DRESS = (PROTOCOL = TCP) (HOST = 192.
168.1.226) (PORT = 1521 ))))
BYS @ bysrac1> alter system set local_listener = '(DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP) (HOST = 192.168.1.228) (PORT = 1521 ))))';
System altered.
BYS @ bysrac1> show parameter local_listener
NAME TYPE VALUE
-----------------------------------------------------------------------------
Local_listener string (DESCRIPTION = (ADDRESS_LIST = (AD
DRESS = (PROTOCOL = TCP) (HOST = 192.
The client reports an error when using VIP: ORA-12514: TNS: listener does not currently know of service requested in connect descriptor
[Oracle @ bys3 admin] $ tnsping bysrac
TNS Ping Utility for Linux: Version 11.2.0.4.0-Production on 01-JAN-2014 21:12:40
Copyright (c) 1997,201 3, Oracle. All rights reserved.
Used parameter files:
Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP) (HOST = 192.168.1.226) (PORT = 1521) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = bysrac )))
OK (10 msec) ----- tnsping can be connected normally, HOST = 192.168.1.226. Here, the VIP address of a node in tnsnames. ora has been changed to RAC .. Saves space and does not post tnsnames. ora
[Oracle @ bys3 admin] $ sqlplus bys/bys @ bysrac
SQL * Plus: Release 11.2.0.4.0 Production on Wed Jan 1 21:12:44 2014
Copyright (c) 1982,201 3, Oracle. All rights reserved.
ERROR:
ORA-12514: TNS: listener does not currently know of service requested in connect descriptor
The client can use SCANIP to connect normally.
[Oracle @ bys3 admin] $ tnsping bysrac
TNS Ping Utility for Linux: Version 11.2.0.4.0-Production on 01-JAN-2014 21:13:01
Copyright (c) 1997,201 3, Oracle. All rights reserved.
Used parameter files:
Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP) (HOST = 192.168.1.228) (PORT = 1521) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = bysrac )))
OK (10 msec) -- tnsping can be connected normally. HOST = 192.168.1.228 the SCANIP of a node in tnsnames. ora has been changed to RAC .. Saves space and does not post tnsnames. ora
[Oracle @ bys3 admin] $ sqlplus bys/bys @ bysrac
BYS @ bysrac> select instance_name, status from v $ instance;
INSTANCE_NAME STATUS
----------------------------
Bysrac1 OPEN
Elapsed: 00:00:00. 01
BYS @ bysrac>