Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Static and dynamic registration

2025-01-15 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

Create a listener

The listener is defined in the listener.ora file, which is stored in the ORACLE_HOME/network/admin directory by default. The listener.ora file must declare at least one listener's name and the protocol and listening address it uses. Multiple listeners can be configured in a file, but they must have different names and addresses.

Like other files used to configure Oracle Net, listener.ora files are very concerned about seemingly minor syntax problems.

[oracle@localhost admin] $cat listener.ora

# listener.ora Network Configuration File: / u01/app/oracle/product/11.2.0/db_1/network/admin/listener.ora

# Generated by Oracle configuration tools.

LISTENER =

(DESCRIPTION =

(ADDRESS = (PROTOCOL = TCP) (HOST = localhost.localdomain) (PORT = 1521))

)

ADR_BASE_LISTENER = / u01/app/oracle

[oracle@localhost admin] $vi. / listener.ora

[oracle@localhost admin] $cat listener.ora

# listener.ora Network Configuration File: / u01/app/oracle/product/11.2.0/db_1/network/admin/listener.ora

# Generated by Oracle configuration tools.

LISTENER =

(DESCRIPTION =

(ADDRESS = (PROTOCOL = TCP) (HOST = localhost.localdomain) (PORT = 1521))

)

ADR_BASE_LISTENER = / u01/app/oracle

WYH =

(DESCRIPTION =

(ADDRESS_LIST =

(ADDRESS = (PROTOCOL = TCP) (HOST = localhost.localdomain) (PORT = 1522))

)

)

[oracle@localhost admin] $

Database registration

There are two ways to register an instance with a database: static registration and dynamic registration. For static registration, we can hard-code a list of instances in the listener.ora file. Dynamic registration means that the instance needs to locate the listener and register with the listener at startup.

1. Static registration

Add entries in the listener.ora file

SID_LIST_WYH =

(SID_LIST =

(SID_DESC =

(ORACLE_HOME = / u01/app/oracle/product/11.2.0/db_1)

(SID_NAME = orcl)

)

)

Test static registration

[oracle@localhost admin] $lsnrctl

LSNRCTL for Linux: Version 11.2.0.3.0-Production on 14-APR-2016 11:17:49

Copyright (c) 1991, 2011, Oracle. All rights reserved.

Welcome to LSNRCTL, type "help" for information.

LSNRCTL > start WYH

Starting / u01/app/oracle/product/11.2.0/db_1/bin/tnslsnr: please wait...

TNSLSNR for Linux: Version 11.2.0.3.0-Production

System parameter file is / u01/app/oracle/product/11.2.0/db_1/network/admin/listener.ora

Log messages written to / u01/app/oracle/diag/tnslsnr/localhost/wyh/alert/log.xml

Listening on: (DESCRIPTION= (ADDRESS= (PROTOCOL=tcp) (HOST=localhost) (PORT=1522)

Connecting to (DESCRIPTION= (ADDRESS= (PROTOCOL=TCP) (HOST=localhost.localdomain) (PORT=1522)

STATUS of the LISTENER

-

Alias WYH

Version TNSLSNR for Linux: Version 11.2.0.3.0-Production

Start Date 14-APR-2016 11:17:58

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/db_1/network/admin/listener.ora

Listener Log File / u01/app/oracle/diag/tnslsnr/localhost/wyh/alert/log.xml

Listening Endpoints Summary...

(DESCRIPTION= (ADDRESS= (PROTOCOL=tcp) (HOST=localhost) (PORT=1522))

Services Summary...

Service "orcl" has 1 instance (s).

Instance "orcl", status UNKNOWN, has 1 handler (s) for this service...

The command completed successfully

LSNRCTL >

2. Dynamic testing

The initialization parameter local_listener tells the instance that it should contact so that it can find the network address of the listener that registered the instance. When the instance is started, the PMON process uses this parameter to locate a listener and notify it of the instance name and the name of the service provided by the instance.

[oracle@localhost admin] $sqlplus / nolog

SQL*Plus: Release 11.2.0.3.0 Production on Thu Apr 14 12:12:37 2016

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

SQL > conn / as sysdba

Connected to an idle instance.

SQL > startup pfile='/u01/app/oracle/product/11.2.0/db_1/dbs/initorcl.ora'

ORACLE instance started.

Total System Global Area 1436389376 bytes

Fixed Size 2228384 bytes

Variable Size 855641952 bytes

Database Buffers 570425344 bytes

Redo Buffers 8093696 bytes

Database mounted.

Database opened.

SQL > alter system register

System altered.

SQL > ho lsnrctl

LSNRCTL for Linux: Version 11.2.0.3.0-Production on 14-APR-2016 12:14:17

Copyright (c) 1991, 2011, Oracle. All rights reserved.

Welcome to LSNRCTL, type "help" for information.

LSNRCTL > status

Connecting to (ADDRESS= (PROTOCOL=tcp) (HOST=) (PORT=1521))

TNS-12541: TNS:no listener

TNS-12560: TNS:protocol adapter error

TNS-00511: No listener

Linux Error: 111: Connection refused

LSNRCTL > start

Starting / u01/app/oracle/product/11.2.0/db_1/bin/tnslsnr: please wait...

TNSLSNR for Linux: Version 11.2.0.3.0-Production

System parameter file is / u01/app/oracle/product/11.2.0/db_1/network/admin/listener.ora

Log messages written to / u01/app/oracle/diag/tnslsnr/localhost/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.3.0-Production

Start Date 14-APR-2016 12:14:38

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/db_1/network/admin/listener.ora

Listener Log File / u01/app/oracle/diag/tnslsnr/localhost/listener/alert/log.xml

Listening Endpoints Summary...

(DESCRIPTION= (ADDRESS= (PROTOCOL=tcp) (HOST=localhost) (PORT=1521))

The listener supports no services

The command completed successfully

LSNRCTL > start

TNS-01106: Listener using listener name LISTENER has already been started

LSNRCTL > status

Connecting to (ADDRESS= (PROTOCOL=tcp) (HOST=) (PORT=1521))

STATUS of the LISTENER

-

Alias LISTENER

Version TNSLSNR for Linux: Version 11.2.0.3.0-Production

Start Date 14-APR-2016 12:14:38

Uptime 0 days 0 hr. 0 min. 43 sec

Trace Level off

Security ON: Local OS Authentication

SNMP OFF

Listener Parameter File / u01/app/oracle/product/11.2.0/db_1/network/admin/listener.ora

Listener Log File / u01/app/oracle/diag/tnslsnr/localhost/listener/alert/log.xml

Listening Endpoints Summary...

(DESCRIPTION= (ADDRESS= (PROTOCOL=tcp) (HOST=localhost) (PORT=1521))

Services Summary...

Service "orcl" has 1 instance (s).

Instance "orcl", status READY, has 1 handler (s) for this service...

Service "orclXDB" has 1 instance (s).

Instance "orcl", status READY, has 1 handler (s) for this service...

The command completed successfully

LSNRCTL >

[oracle@localhost admin] $sqlplus / nolog

SQL*Plus: Release 11.2.0.3.0 Production on Thu Apr 14 12:12:37 2016

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

SQL > conn / as sysdba

Connected to an idle instance.

SQL > startup pfile='/u01/app/oracle/product/11.2.0/db_1/dbs/initorcl.ora'

ORACLE instance started.

Total System Global Area 1436389376 bytes

Fixed Size 2228384 bytes

Variable Size 855641952 bytes

Database Buffers 570425344 bytes

Redo Buffers 8093696 bytes

Database mounted.

Database opened.

SQL > alter system register

System altered.

SQL > ho lsnrctl

LSNRCTL for Linux: Version 11.2.0.3.0-Production on 14-APR-2016 12:14:17

Copyright (c) 1991, 2011, Oracle. All rights reserved.

Welcome to LSNRCTL, type "help" for information.

LSNRCTL > status

Connecting to (ADDRESS= (PROTOCOL=tcp) (HOST=) (PORT=1521))

TNS-12541: TNS:no listener

TNS-12560: TNS:protocol adapter error

TNS-00511: No listener

Linux Error: 111: Connection refused

LSNRCTL > start

Starting / u01/app/oracle/product/11.2.0/db_1/bin/tnslsnr: please wait...

TNSLSNR for Linux: Version 11.2.0.3.0-Production

System parameter file is / u01/app/oracle/product/11.2.0/db_1/network/admin/listener.ora

Log messages written to / u01/app/oracle/diag/tnslsnr/localhost/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.3.0-Production

Start Date 14-APR-2016 12:14:38

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/db_1/network/admin/listener.ora

Listener Log File / u01/app/oracle/diag/tnslsnr/localhost/listener/alert/log.xml

Listening Endpoints Summary...

(DESCRIPTION= (ADDRESS= (PROTOCOL=tcp) (HOST=localhost) (PORT=1521))

The listener supports no services

The command completed successfully

LSNRCTL > start

TNS-01106: Listener using listener name LISTENER has already been started

LSNRCTL > status

Connecting to (ADDRESS= (PROTOCOL=tcp) (HOST=) (PORT=1521))

STATUS of the LISTENER

-

Alias LISTENER

Version TNSLSNR for Linux: Version 11.2.0.3.0-Production

Start Date 14-APR-2016 12:14:38

Uptime 0 days 0 hr. 0 min. 43 sec

Trace Level off

Security ON: Local OS Authentication

SNMP OFF

Listener Parameter File / u01/app/oracle/product/11.2.0/db_1/network/admin/listener.ora

Listener Log File / u01/app/oracle/diag/tnslsnr/localhost/listener/alert/log.xml

Listening Endpoints Summary...

(DESCRIPTION= (ADDRESS= (PROTOCOL=tcp) (HOST=localhost) (PORT=1521))

Services Summary...

Service "orcl" has 1 instance (s).

Instance "orcl", status READY, has 1 handler (s) for this service...

Service "orclXDB" has 1 instance (s).

Instance "orcl", status READY, has 1 handler (s) for this service...

The command completed successfully

LSNRCTL >

LSNRCTL >

LSNRCTL > exit

SQL > alter system set local_listener=' (address= (pro=tcp) (host=localhost.localdomain) (port=1522))'

System altered.

SQL > ho lsnrctl

LSNRCTL for Linux: Version 11.2.0.3.0-Production on 14-APR-2016 12:20:35

Copyright (c) 1991, 2011, Oracle. All rights reserved.

Welcome to LSNRCTL, type "help" for information.

LSNRCTL > stop

Connecting to (ADDRESS= (PROTOCOL=tcp) (HOST=) (PORT=1521))

The command completed successfully

LSNRCTL > start WYH

TNS-01106: Listener using listener name WYH has already been started

LSNRCTL > status

Connecting to (DESCRIPTION= (ADDRESS= (PROTOCOL=TCP) (HOST=localhost.localdomain) (PORT=1522)

STATUS of the LISTENER

-

Alias WYH

Version TNSLSNR for Linux: Version 11.2.0.3.0-Production

Start Date 14-APR-2016 11:23:13

Uptime 0 days 0 hr. 58 min. 5 sec

Trace Level off

Security ON: Local OS Authentication

SNMP OFF

Listener Parameter File / u01/app/oracle/product/11.2.0/db_1/network/admin/listener.ora

Listener Log File / u01/app/oracle/diag/tnslsnr/localhost/wyh/alert/log.xml

Listening Endpoints Summary...

(DESCRIPTION= (ADDRESS= (PROTOCOL=tcp) (HOST=localhost) (PORT=1522))

Services Summary...

Service "orcl" has 2 instance (s).

Instance "orcl", status UNKNOWN, has 1 handler (s) for this service...

Instance "orcl", status READY, has 1 handler (s) for this service...

Service "orclXDB" has 1 instance (s).

Instance "orcl", status READY, has 1 handler (s) for this service...

The command completed successfully

LSNRCTL >

LSNRCTL > exit

SQL >

SQL >

SQL > shutdown immediate

Database closed.

Database dismounted.

ORACLE instance shut down.

SQL > startup

ORA-00119: invalid specification for system parameter LOCAL_LISTENER

ORA-00132: syntax error or unresolved network name'((ADDRESS_LIST= (ADDRESS = (PROTOCOL = TCP) (HOST = localhost.localdomain) (PORT = 1522)'

SQL > startup pfile='/u01/app/oracle/product/11.2.0/db_1/dbs/initorcl.ora'

ORACLE instance started.

Total System Global Area 1436389376 bytes

Fixed Size 2228384 bytes

Variable Size 855641952 bytes

Database Buffers 570425344 bytes

Redo Buffers 8093696 bytes

Database mounted.

Database opened.

SQL > create spfile from pfile

File created.

SQL >

SQL > shutdown immediate

Database closed.

Database dismounted.

ORACLE instance shut down.

SQL > startup

ORACLE instance started.

Total System Global Area 1436389376 bytes

Fixed Size 2228384 bytes

Variable Size 855641952 bytes

Database Buffers 570425344 bytes

Redo Buffers 8093696 bytes

Database mounted.

Database opened.

SQL > create pfile from spfile

File created.

SQL >

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report