Dnes je: 20. května 2012

Ostatní

Autor knihy

Oracle Database 11g - Hotová řešení

Kdo je online

Právě připojeni - hostů: 16 

Přihlásit se




Změna portu listeneru a následná konfigurace EM database control

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 status

LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 11-AUG-2010 11:29:53

Copyright (c) 1991, 2009, 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.1.0 - Production
Start Date                11-AUG-2010 11:15:10
Uptime                    0 days 0 hr. 14 min. 44 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /u01/app/oracle/product/11.2.0/grid/network/admin/listener.ora
Listener Log File         /u01/app/oracle/diag/tnslsnr/vserver1/listener/alert/log.xml
Listening 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 listener
Listener LISTENER is enabled
Listener LISTENER is running on node(s): vserver1

[oracle@vserver1 admin]$ srvctl config listener
Name: LISTENER
Home: /u01/app/oracle/product/11.2.0/grid
End points: TCP:1521

Database control mě ukazuje nastavení listeneru a vše je v pořádku.

gc_1
gc_1 gc_1
gc_2
gc_2 gc_2

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/oracle
ENABLE_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 listener

LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 11-AUG-2010 11:49:50

Copyright (c) 1991, 2009, 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.1.0 - Production
Start Date                11-AUG-2010 11:49:13
Uptime                    0 days 0 hr. 0 min. 37 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /u01/app/oracle/product/11.2.0/grid/network/admin/listener.ora
Listener Log File         /u01/app/oracle/diag/tnslsnr/vserver1/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=vserver1.tomas-solar.com)(PORT=1522)))
The listener supports no services
The command completed successfully

V 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

  1. Pomocí nastaveni parametru LOCAL_LISTENER nebo
  2. úpravou souboru listener.ora, což je lepší i pro budoucí změny

Přidal jsem informace o databázi přímo do souboru listener.ora

LISTENER =
(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 services

LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 11-AUG-2010 12:52:19

Copyright (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 SERVER
The command completed successfully

Do databáze se nyní připojím, ale nikoli do EM

[oracle@vserver1 admin]$ sqlplus system@orclr1

SQL*Plus: Release 11.2.0.1.0 Production on Wed Aug 11 12:56:42 2010

Copyright (c) 1982, 2009, Oracle.  All rights reserved.

Enter password:

Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Partitioning, Automatic Storage Management, OLAP, Data Mining
and Real Application Testing options

Zkusil jsem i restart dbconsole, ale stále ta samá chyba.

TNS-12541: TNS:no listener

gc_3
gc_3 gc_3

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 <Property NAME="Port" VALUE="1522"/>

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.properties

oracle.sysman.eml.mntr.emdRepPort=1522
oracle.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 dbconsole
Oracle Enterprise Manager 11g Database Control Release 11.2.0.1.0
Copyright (c) 1996, 2009 Oracle Corporation.  All rights reserved.
https://vserver1.tomas-solar.com:1158/em/console/aboutApplication
Stopping 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 dbconsole
Oracle Enterprise Manager 11g Database Control Release 11.2.0.1.0
Copyright (c) 1996, 2009 Oracle Corporation.  All rights reserved.
https://vserver1.tomas-solar.com:1158/em/console/aboutApplication
Starting 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.

gc_4
gc_4 gc_4

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 listener
Name: LISTENER
Home: /u01/app/oracle/product/11.2.0/grid
End points: TCP:1521

[oracle@vserver1 grid]$ srvctl modify listener -p 1522
[oracle@vserver1 grid]$ srvctl config listener
Name: LISTENER
Home: /u01/app/oracle/product/11.2.0/grid
End points: TCP:1522

 

Anketa

Využívají vaše databáze pro ukládání souborů ASM? (automatic storage management)
 

Certifikát Oracle Certifikát Oracle Certifikát Oracle Certifikát Oracle Certifikát Oracle Certifikát Oracle

Partnerské internetové stránky:
www.oracledba.cz www.asktom.cz www.tomas-solar.cz