Na základě dotazu, který jsem dostal mailem, jsem si zkusil změnit port listeneru a hle najednou mě přestal fungovat Enterprise manager database control. Vcelku jednoduchá změna se rázem změnila na problém, kde je potřeba editovat soubory ručně. Zde je postup krok po kroku, co je potřeba udělat a nastavit.
Současný stav:
Databáze běží a listener poslouchá na defaultním portu 1521. Z bezpečnostních důvodů jsem se rozhodl změnit číslo portu na kterém listener poslouchá.[oracle@vserver1 ~]$ lsnrctl statusLSNRCTL for Linux: Version 11.2.0.1.0 – Production on 11-AUG-2010 11:29:53Copyright (c) 1991, 2009, Oracle. All rights reserved.Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))STATUS of the LISTENER————————Alias LISTENERVersion TNSLSNR for Linux: Version 11.2.0.1.0 – ProductionStart Date 11-AUG-2010 11:15:10Uptime 0 days 0 hr. 14 min. 44 secTrace Level offSecurity ON: Local OS AuthenticationSNMP OFFListener Parameter File /u01/app/oracle/product/11.2.0/grid/network/admin/listener.oraListener Log File /u01/app/oracle/diag/tnslsnr/vserver1/listener/alert/log.xmlListening Endpoints Summary… (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521))) (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=vserver1.tomas-solar.com)(PORT=1521)))
Services Summary…Service “+ASM” has 1 instance(s). Instance “+ASM”, status READY, has 1 handler(s) for this service…Service “orclr1.tomas-solar.com” has 1 instance(s). Instance “orclr1”, status READY, has 1 handler(s) for this service…Service “orclr1XDB.tomas-solar.com” has 1 instance(s). Instance “orclr1”, status READY, has 1 handler(s) for this service…The command completed successfully[oracle@vserver1 admin]$ srvctl status listenerListener LISTENER is enabledListener LISTENER is running on node(s): vserver1[oracle@vserver1 admin]$ srvctl config listenerName: LISTENERHome: /u01/app/oracle/product/11.2.0/gridEnd points: TCP:1521Database control mě ukazuje nastavení listeneru a vše je v pořádku.
Změním port listeneru v souboru listener.ora.
Jelikož se jedná o databázi 11R2, tak listener běží pod infrastrukturou gridu (grid infrastructure). Z tohoto důvodu musíte editovat soubor pod ORACLE_HOME gridu a ne databáze.[oracle@vserver1 admin]$ vi /u01/app/oracle/product/11.2.0/grid/network/admin/listener.ora# listener.ora Network Configuration File: /u01/app/oracle/product/11.2.0/grid/network/admin/listener.ora# Generated by Oracle configuration tools.LISTENER = (DESCRIPTION_LIST = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = vserver1.tomas-solar.com)(PORT = 1522)) ) )ADR_BASE_LISTENER = /u01/app/oracleENABLE_GLOBAL_DYNAMIC_ENDPOINT_LISTENER=ON # line added by Agent
Změním port i v souboru 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.ORCLR1 = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = vserver1.tomas-solar.com)(PORT = 1522)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = orclr1.tomas-solar.com) ) )Po restartu listeneru, zde nemám registrovanou svou databázi.[oracle@vserver1 admin]$ lsnrctl status listenerLSNRCTL for Linux: Version 11.2.0.1.0 – Production on 11-AUG-2010 11:49:50Copyright (c) 1991, 2009, Oracle. All rights reserved.Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))STATUS of the LISTENER————————Alias LISTENERVersion TNSLSNR for Linux: Version 11.2.0.1.0 – ProductionStart Date 11-AUG-2010 11:49:13Uptime 0 days 0 hr. 0 min. 37 secTrace Level offSecurity ON: Local OS AuthenticationSNMP OFFListener Parameter File /u01/app/oracle/product/11.2.0/grid/network/admin/listener.oraListener Log File /u01/app/oracle/diag/tnslsnr/vserver1/listener/alert/log.xmlListening Endpoints Summary… (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521))) (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=vserver1.tomas-solar.com)(PORT=1522)))The listener supports no servicesThe command completed successfullyV této chvíli se nemohu přihlásit ani do EM database console a proto musím službu zaregistrovat do listeneru.Při změně portu listeneru je potřeba službu ještě zaregistrovat. To lze udělat více způsoby
Pomocí nastaveni parametru LOCAL_LISTENER nebo
úpravou souboru listener.ora, což je lepší i pro budoucí změny
Přidal jsem informace o databázi přímo do souboru listener.oraLISTENER = (DESCRIPTION_LIST = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = vserver1.tomas-solar.com)(PORT = 1522)) ) )SID_LIST_LISTENER = (SID_LIST = (SID_DESC = (GLOBAL_DBNAME = orclr1.tomas-solar.com) (ORACLE_HOME =/u01/app/oracle/product/11.2.0/dbhome_1) (SID_NAME = orclr1) ) )Jakmile provedete potřebné změny v souboru listener.ora, stačí když ho zastavíte. O opětovný start se postará již grid infrastructure, která kontroluje veškeré služby a zjistí-li, že některá neběží, provede restart.[oracle@vserver1 admin]$ lsnrctl servicesLSNRCTL for Linux: Version 11.2.0.1.0 – Production on 11-AUG-2010 12:52:19Copyright (c) 1991, 2009, Oracle. All rights reserved.Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=vserver1.tomas-solar.com)(PORT=1522)))Services Summary…Service “orclr1.tomas-solar.com” has 1 instance(s). Instance “orclr1”, status UNKNOWN, has 1 handler(s) for this service… Handler(s): “DEDICATED” established:0 refused:0 LOCAL SERVERThe command completed successfully
Do databáze se nyní připojím, ale nikoli do EM
[oracle@vserver1 admin]$ sqlplus system@orclr1SQL*Plus: Release 11.2.0.1.0 Production on Wed Aug 11 12:56:42 2010Copyright (c) 1982, 2009, Oracle. All rights reserved.Enter password:Connected to:Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 – ProductionWith the Partitioning, Automatic Storage Management, OLAP, Data Miningand Real Application Testing options
Zkusil jsem i restart dbconsole, ale stále ta samá chyba.
TNS-12541: TNS:no listener
Důvod je jasný.
EM je směřován stále na port 1521, na kterém již neběží. Je potřeba ještě změnit konfiguraci EM database kontrol.Podle metalinku note 235298.1 je potřeba udělat následující kroky.Typically, the SQL*Net listener will listen on port 1521 for incoming connections to the database. The EM 10g DB Control will connect to the database to store management data from the agent or retrieve information requested by browser clients. It will also connect to the database for administration purposes.To modify this port, changes are necessary in several files:10g DB $ORACLE_HOME:- Stop the DB Control with emctl stop dbconsole- Change the listener.ora file and Restart the listener- Modify the Agent’s $OH/<hostname_sid>/.sysman/emd/targets.xml and change the port number for the Listener- Modify the file $ORACLE_HOME/<hostname_sid>/sysman/config/emoms.properties. Change the emdRepPort property to the new port. Change the oracle.sysman.eml.mntr.emdRepConnectDescriptor to reflect the new listener port- Restart the DB Control with emctl start dbconsole
Postup
Změnit port v souboru targets.xml (na 3 místech)
[oracle@vserver1 emd]$ vi /u01/app/oracle/product/11.2.0/dbhome_1/vserver1.tomas-solar.com_orclr1/sysman/emd/targets.xmlřádek
Změnit port v souboru emoms.properties
[oracle@vserver1 config]$ vi /u01/app/oracle/product/11.2.0/dbhome_1/vserver1.tomas-solar.com_orclr1/sysman/config/emoms.propertiesoracle.sysman.eml.mntr.emdRepPort=1522oracle.sysman.eml.mntr.emdRepConnectDescriptor=(DESCRIPTION\=(ADDRESS_LIST\=(ADDRESS\=(PROTOCOL\=TCP)(HOST\=vserver1.tomas-solar.com)(PORT\=1522)))(CONNECT_DATA\=(SERVICE_NAME\=orclr1.tomas-solar.com)))
Po provedení změn je potřeba restartovat EM.
[oracle@vserver1 log]$ emctl stop dbconsoleOracle Enterprise Manager 11g Database Control Release 11.2.0.1.0Copyright (c) 1996, 2009 Oracle Corporation. All rights reserved.https://vserver1.tomas-solar.com:1158/em/console/aboutApplicationStopping Oracle Enterprise Manager 11g Database Control … … Stopped.[oracle@vserver1 log]$ vi /u01/app/oracle/product/11.2.0/dbhome_1/vserver1.tomas-solar.com_orclr1/sysman/config/emoms.properties[oracle@vserver1 log]$ emctl start dbconsoleOracle Enterprise Manager 11g Database Control Release 11.2.0.1.0Copyright (c) 1996, 2009 Oracle Corporation. All rights reserved.https://vserver1.tomas-solar.com:1158/em/console/aboutApplicationStarting Oracle Enterprise Manager 11g Database Control ………. started.——————————————————————Logs are generated in directory /u01/app/oracle/product/11.2.0/dbhome_1/vserver1.tomas-solar.com_orclr1/sysman/log
Výsledek můžete ověřit i v EM.
Nakonec je potřeba ještě změnit port v grid infrastruktuře tak, aby pracovala se správným portem. Třeba kontrolovala dostupnost a běh listeneru.
[oracle@vserver1 log]$ srvctl config listenerName: LISTENERHome: /u01/app/oracle/product/11.2.0/gridEnd points: TCP:1521[oracle@vserver1 grid]$ srvctl modify listener -p 1522[oracle@vserver1 grid]$ srvctl config listenerName: LISTENERHome: /u01/app/oracle/product/11.2.0/gridEnd points: TCP:1522