|
Dynamic and static dynamic registry registration registration is an important way to build links between Oracle instances and listeners. From now on trend, the default listener + dynamic registration Oracle has become the standard default configuration. In some scenarios, the reason is security may need to modify the standard monitor configuration and registration mode. This part describes how to implement non-1521 port for dynamic registration method.
1, the default port 1521 and listens
Oracle Net Service core three profiles: listener.ora, tnsnames.ora and sqlnet.ora. Wherein, listener.ora file for the profile Listener related information. About listener parameter personalized content, are set in the file.
In the default installation, we usually $ ORACLE_HOME / network / admin directory can not listener.ora file.
[Oracle @ aaalife admin] $ ls -l
-rw-r -----. 1 oracle oinstall 332 Aug 7 01:44 tnsnames.ora
At this time, Oracle will be the default port 1521, supports a default listener configuration file. Also, the program supports dynamic registration function.
[Oracle @ aaalife admin] $ lsnrctl start
LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 07-SEP-2015 01:08:10
Copyright (c) 1991, 2013, Oracle. All rights reserved.
Starting /u01/app/oracle/product/11.2.0/dbhome_1/bin/tnslsnr: please wait ...
TNSLSNR for Linux: Version 11.2.0.4.0 - Production
Log messages written to /u01/app/oracle/diag/tnslsnr/aaalife/listener/alert/log.xml
Listening on: (DESCRIPTION = (ADDRESS = (PROTOCOL = tcp) (HOST = localhost) (PORT = 1521)))
Connecting to (ADDRESS = (PROTOCOL = tcp) (HOST =) (PORT = 1521))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 11.2.0.4.0 - Production
Start Date 07-SEP-2015 01:08:10
Uptime 0 days 0 hr. 0 min. 0 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
- Here there is no description Listener configuration file path.
Listener Log File /u01/app/oracle/diag/tnslsnr/aaalife/listener/alert/log.xml
Listening Endpoints Summary ...
(DESCRIPTION = (ADDRESS = (PROTOCOL = tcp) (HOST = localhost) (PORT = 1521)))
The listener supports no services
The command completed successfully
Register for the Oracle instance in terms of the behavior of the other side, by default Oracle instance dynamically register operation, will listen to the 1521 port listener registration operation.
[Oracle @ aaalife admin] $ lsnrctl status
LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 07-SEP-2015 01:14:54
Copyright (c) 1991, 2013, Oracle. All rights reserved.
Connecting to (ADDRESS = (PROTOCOL = tcp) (HOST =) (PORT = 1521))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 11.2.0.4.0 - Production
Start Date 07-SEP-2015 01:08:10
Uptime 0 days 0 hr. 6 min. 43 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Log File /u01/app/oracle/diag/tnslsnr/aaalife/listener/alert/log.xml
Listening Endpoints Summary ...
(DESCRIPTION = (ADDRESS = (PROTOCOL = tcp) (HOST = localhost) (PORT = 1521)))
Services Summary ...
Service "aaadb" has 1 instance (s).
Instance "aaadb", status READY, has 1 handler (s) for this service ...
Service "aaadbXDB" has 1 instance (s).
Instance "aaadb", status READY, has 1 handler (s) for this service ...
The command completed successfully
2, a non-default port listener
In some scenes the security requirements, we will be asked to change the listening port to non-port 1521, so as to avoid being scanned invasion. In fact, this scanner for the attack in terms of little significance, because most hackers will scan all ports.
If we need to change the port number, you must create a special listener.ora file contents for configuration. The following content can be configured to monitor a non-standard program.
[Oracle @ aaalife admin] $ cat listener.ora
# Listener.ora Network Configuration File: /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora
# Generated by Oracle configuration tools.
MY_LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP) (HOST = localhost) (PORT = 1531))
(ADDRESS = (PROTOCOL = IPC) (KEY = EXTPROC1531))
)
)
ADR_BASE_LISTENER = / u01 / app / oracle
Profile, including a 1531 port listener. See below listener case.
[Oracle @ aaalife admin] $ lsnrctl start
LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 07-SEP-2015 01:27:53
Copyright (c) 1991, 2013, Oracle. All rights reserved.
Starting /u01/app/oracle/product/11.2.0/dbhome_1/bin/tnslsnr: please wait ...
TNSLSNR for Linux: Version 11.2.0.4.0 - Production
System parameter file is /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora
Log messages written to /u01/app/oracle/diag/tnslsnr/aaalife/listener/alert/log.xml
Listening on: (DESCRIPTION = (ADDRESS = (PROTOCOL = tcp) (HOST = localhost) (PORT = 1521)))
Connecting to (ADDRESS = (PROTOCOL = tcp) (HOST =) (PORT = 1521))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 11.2.0.4.0 - Production
Start Date 07-SEP-2015 01:27:53
Uptime 0 days 0 hr. 0 min. 0 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora
Listener Log File /u01/app/oracle/diag/tnslsnr/aaalife/listener/alert/log.xml
Listening Endpoints Summary ...
(DESCRIPTION = (ADDRESS = (PROTOCOL = tcp) (HOST = localhost) (PORT = 1521)))
The listener supports no services
The command completed successfully
The default port 1521 is displayed as well as the listener. At the same time, in fact, we found on the current server by running two listeners.
[Oracle @ aaalife admin] $ lsnrctl status listener
LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 07-SEP-2015 01:30:13
Copyright (c) 1991, 2013, Oracle. All rights reserved.
Connecting to (ADDRESS = (PROTOCOL = tcp) (HOST =) (PORT = 1521))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 11.2.0.4.0 - Production
Start Date 07-SEP-2015 01:27:53
Uptime 0 days 0 hr. 2 min. 19 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora
Listener Log File /u01/app/oracle/diag/tnslsnr/aaalife/listener/alert/log.xml
Listening Endpoints Summary ...
(DESCRIPTION = (ADDRESS = (PROTOCOL = tcp) (HOST = localhost) (PORT = 1521)))
Services Summary ...
Service "aaadb" has 1 instance (s).
Instance "aaadb", status READY, has 1 handler (s) for this service ...
Service "aaadbXDB" has 1 instance (s).
Instance "aaadb", status READY, has 1 handler (s) for this service ...
The command completed successfully
[Oracle @ aaalife admin] $
[Oracle @ aaalife admin] $ lsnrctl status my_listener
LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 07-SEP-2015 01:30:29
Copyright (c) 1991, 2013, Oracle. All rights reserved.
Connecting to (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP) (HOST = localhost) (PORT = 1531)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 11.2.0.4.0 - Production
Start Date 07-SEP-2015 01:17:52
Uptime 0 days 0 hr. 12 min. 37 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora
Listener Log File /u01/app/oracle/diag/tnslsnr/aaalife/listener/alert/log.xml
Listening Endpoints Summary ...
(DESCRIPTION = (ADDRESS = (PROTOCOL = tcp) (HOST = localhost) (PORT = 1531)))
(DESCRIPTION = (ADDRESS = (PROTOCOL = ipc) (KEY = EXTPROC1531)))
The listener supports no services
The command completed successfully
The above information shows a few details:
ü We configured a custom listener my_listener, listening 1531 port in the listener.ora file. But the current system default listener still exists, and can be run in the 1521 port. my_listener Listener runs on port 1531;
ü Oracle instances of dynamic movement is registered on port 1521 listening proceedings, port 1531 has not been registered;
Problems default listener a good solution, as long as we can keep only one listener. So, how to make Oracle instance in 1531 the port register, not the port 1521 to register it?
The solution is to use local_listener configuration parameters. By default, this parameter is empty.
SQL> show parameter listener;
NAME TYPE VALUE
------------------------------------ ----------- --- ---------------------------
listener_networks string
local_listener string
remote_listener string
This parameter is used to explicitly specify the Oracle instance on which a listener registered operation. For non-standard port is usually registered, you need to register your listener with information to modify the parameters.
SQL> show parameter local
NAME TYPE VALUE
------------------------------------ ----------- --- ---------------------------
local_listener string (ADDRESS_LIST = (Address = (Protoc ol = tcp) (HOST = AAALIFE) (Port = 1531)))
log_archive_local_first boolean TRUE
parallel_force_local boolean FALSE
Note: This parameter local_listener modify the scope of support both ways, does not need to immediately restart the instance.
In this case, the listener state as follows:
[Oracle @ aaalife dbs] $ lsnrctl status
LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 07-SEP-2015 02:32:25
Copyright (c) 1991, 2013, Oracle. All rights reserved.
Connecting to (ADDRESS = (PROTOCOL = tcp) (HOST =) (PORT = 1521))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 11.2.0.4.0 - Production
Start Date 07-SEP-2015 01:27:53
Uptime 0 days 1 hr. 4 min. 32 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora
Listener Log File /u01/app/oracle/diag/tnslsnr/aaalife/listener/alert/log.xml
Listening Endpoints Summary ...
(DESCRIPTION = (ADDRESS = (PROTOCOL = tcp) (HOST = localhost) (PORT = 1521)))
The listener supports no services
The command completed successfully
[Oracle @ aaalife dbs] $ lsnrctl status my_listener
LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 07-SEP-2015 02:32:33
Copyright (c) 1991, 2013, Oracle. All rights reserved.
Connecting to (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP) (HOST = localhost) (PORT = 1531)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 11.2.0.4.0 - Production
Start Date 07-SEP-2015 01:17:52
Uptime 0 days 1 hr. 14 min. 41 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora
Listener Log File /u01/app/oracle/diag/tnslsnr/aaalife/listener/alert/log.xml
Listening Endpoints Summary ...
(DESCRIPTION = (ADDRESS = (PROTOCOL = tcp) (HOST = localhost) (PORT = 1531)))
(DESCRIPTION = (ADDRESS = (PROTOCOL = ipc) (KEY = EXTPROC1531)))
Services Summary ...
Service "aaadb" has 1 instance (s).
Instance "aaadb", status READY, has 1 handler (s) for this service ...
Service "aaadbXDB" has 1 instance (s).
Instance "aaadb", status READY, has 1 handler (s) for this service ...
The command completed successfully
Examples of the 1531 port to dynamically register the original 1521 default listener was not registered.
So, there is a problem that local_listener setting. The value is in brackets written expression, is a way of Oracle Net Service internal use. From a management point of view, this strategy is not a good way. We write directly to the port number in the database parameters, not only easy to deploy information leak, and the migration occurs, change the action, this approach also has some problems.
Therefore, Oracle officially supported method listener alias configured local_listener.
3, setting a listener alias
A very interesting phenomenon is that in the configuration issues local_listener, MOS and network of colleagues is a big difference. MOS is the official view of the listener alias on settings and network colleagues invariably choose "bracket expression."
To the author of the experiment is set directly listener alias, Oracle is not recognized.
SQL> alter system set local_listener = 'my_listener' scope = both;
alter system set local_listener = 'my_listener' scope = both
*
ERROR at line 1:
ORA-02097: parameter can not be modified because specified value is invalid
ORA-00119: invalid specification for system parameter LOCAL_LISTENER
ORA-00132: syntax error or unresolved network name 'my_listener'
Oracle can not resolve my_listener name, because it is neither a bracket expression, nor is an alias set. There is more strange, we have clearly defined name in the listener.ora file.
To 00132 error, Oracle officially explained as follows:
[Oracle @ aaalife admin] $ oerr ora 00132
00132, 00000, "syntax error or unresolved network name '% s'"
// * Cause: Listener address has syntax error or can not be resolved.
// * Action: If a network name is specified, check that it corresponds
// To an entry in TNSNAMES.ORA or other address repository
// As configured for your system. Make sure that the entry
// Is syntactically correct.
Oracle believes the server side tnsnames.ora file, not been able to find my_listener corresponding name. Tnsnames.ora we save a local connection corresponds to the name of the place, whether the means here to say aliases here, is certainly defined in the tnsnames.ora file. Local Naming alias definition is familiar to us. Listener program how to define an alias?
After the query Oracle documentation and early treatment, from one corner to find the definition of the format and method.
[Oracle @ aaalife admin] $ cat tnsnames.ora # tnsnames.ora Network Configuration File: /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.
MY_LISTENER =
(Description =
(Address = (protocol = tcp) (host = AAALIFE) (port = 1531)))
Whim, tnsping side effects parse command format. Can it succeed?
[Oracle @ aaalife admin] $ tnsping my_listener
TNS Ping Utility for Linux: Version 11.2.0.4.0 - Production on 07-SEP-2015 20:43:58
Copyright (c) 1997, 2013, Oracle. All rights reserved.
Used parameter files:
Used TNSNAMES adapter to resolve the alias
Attempting to contact (description = (address = (protocol = tcp) (host = AAALIFE) (port = 1531)))
OK (0 msec)
Resolution succeeds, at least no major problems on the format.
SQL> alter system set local_listener = 'MY_LISTENER' scope = both;
System altered.
SQL> show parameter local;
NAME TYPE VALUE
------------------------------------ ----------- --- ---------------------------
local_listener string MY_LISTENER
log_archive_local_first boolean TRUE
parallel_force_local boolean FALSE
Start manual registration, view the listener status.
SQL> alter system register;
System altered.
[Oracle @ aaalife admin] $ lsnrctl status my_listener
LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 07-SEP-2015 20:50:47
Copyright (c) 1991, 2013, Oracle. All rights reserved.
Connecting to (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP) (HOST = localhost) (PORT = 1531)))
STATUS of the LISTENER
------------------------
Alias my_listener
Version TNSLSNR for Linux: Version 11.2.0.4.0 - Production
Start Date 07-SEP-2015 19:48:50
Uptime 0 days 1 hr. 1 min. 59 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora
Listener Log File /u01/app/oracle/diag/tnslsnr/aaalife/my_listener/alert/log.xml
Listening Endpoints Summary ...
(DESCRIPTION = (ADDRESS = (PROTOCOL = tcp) (HOST = localhost) (PORT = 1531)))
(DESCRIPTION = (ADDRESS = (PROTOCOL = ipc) (KEY = EXTPROC1531)))
Services Summary ...
Service "aaadb" has 1 instance (s).
Instance "aaadb", status READY, has 1 handler (s) for this service ...
Service "aaadbXDB" has 1 instance (s).
Instance "aaadb", status READY, has 1 handler (s) for this service ...
The command completed successfully
Set successfully, the listener state my_listener alias alias appears in the status information.
4 Conclusion
Dynamic registration is our most common registration mode. Multiple profiles (Oracle Net Service), Oracle parameter settings Listener Interaction intertwined, there are multiple factors network card, domain name resolution, it is prone to failure during question. More experimental, more testing, can help us to unraveling the gradual deepening of understanding of the system, more at ease in their daily work. |
|
|
|