• No results found

Creating an Alternative Listener

In document D78846GC20_ag (Page 45-51)

Practices for Lesson 5: Overview

Practice 5-2: Creating an Alternative Listener

In this practice, you create a second listener named LISTENER2 by using Oracle Net Manager. 1. Create a new listener called LISTENER2. Use port 1561 for this listener. Use Oracle Net

Manager (netmgr) to create the new listener.

Step Window/Page Description Choices or Values

a. Terminal as oracle user $ netmgr b. Oracle Net Manager navigation pane Expand Local.

Select Listeners. Expand Listeners.

Click the green plus sign to begin defining a new listener.

c. Choose Listener Name Enter LISTENER2. Click OK.

d. Oracle Net Manager: (right pane) Click Add Address. e. Oracle Net Manager:

Address1

Enter Port Number: 1561

f. Oracle Net Manager Click File > Save Network Configuration 2. Create a Service Name for both listeners by using Oracle Net Manager

Step Window/Page Description Choices or Values

a. Oracle Net Manager Enter netmgr if necessary. b. Oracle Net Manager navigation pane Select Service Naming.

Expand Service Naming.

Click the green plus sign to launch the Net Service Name Wizard.

c. Net Service Name Wizard: Welcome Enter Service Name: Listener1 Click Next.

d. Net Service Name Wizard:…Protocol

Select TCP/IP (Internet Protocol) Click Next.

e. Net Service Name

Wizard:…Protocol Settings

Enter Host Name: localhost Enter Port Number: 1521 Click Next.

f. Net Service Name Wizard:…Service Enter Service: orcl Click Next.

g. Net Service Name Wizard:…Test Click Finish.

h. Oracle Net Manager navigation pane Select Service Naming. Expand Service Naming.

Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Practices for Lesson 5: Configuring the Oracle Network Environment

Step Window/Page Description Choices or Values

Click the green plus sign to launch the Net Service Name Wizard.

i. Net Service Name Wizard: Welcome Enter Service Name: Listener2 Click Next.

j. Net Service Name Wizard:…Protocol

Select TCP/IP (Internet Protocol). Click Next.

k. Net Service Name

Wizard:…Protocol Settings

Enter Host Name: localhost Enter Port Number: 1561 Click Next.

l. Net Service Name Wizard:…Service Enter Service: orcl Click Next.

m. Net Service Name Wizard:…Test Click Finish.

n. Oracle Net Manager Click File > Save Network Configuration Click File > Exit.

3. Start the LISTENER2 listener by using the listener control utility. $ lsnrctl start listener2

LSNRCTL for Linux: Version 12.1.0.2.0 - Production on 08-OCT- 2014 10:56:22

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

Starting /u01/app/oracle/product/12.1.0/dbhome_1/bin/tnslsnr: please wait...

TNSLSNR for Linux: Version 12.1.0.2.0 - Production System parameter file is

/u01/app/oracle/product/12.1.0/dbhome_1/network/admin/listener.o ra

Log messages written to

/u01/app/oracle/diag/tnslsnr/EDRSR9P1/listener2/alert/log.xml Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=edRSr9p1.us.oracle.com )(PORT=1561))) Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=EDRSR9P1)(PORT=1561))) STATUS of the LISTENER

---

Alias listener2

Version TNSLSNR for Linux: Version 12.1.0.2.0 - Production

Start Date 08-OCT-2014 10:56:24 Uptime 0 days 0 hr. 0 min. 2 sec Trace Level off

Security ON: Local OS Authentication SNMP OFF

Listener Parameter File

/u01/app/oracle/product/12.1.0/dbhome_1/network/admin/listener.o ra

Listener Log File

/u01/app/oracle/diag/tnslsnr/EDRSR9P1/listener2/alert/log.xml Listening Endpoints Summary...

(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=edRSr9p1.us.oracle.com )(PORT=1561)))

The listener supports no services The command completed successfully

4. Configure the database to register with both listeners. Alter the LOCAL_LISTENER initialization parameter.

a. Start SQL*Plus in a terminal window. Be sure to set the Oracle environment to orcl by using oraenv if you have started a new terminal window. Connect as the SYS user AS SYSDBA.

b. In SQL*Plus, view and set the LOCAL_LISTENER initialization parameter to include both listeners. Then exit SQL*Plus.

SQL> show parameter local_listener

NAME TYPE VALUE

--- --- --- local_listener string

SQL> ALTER SYSTEM SET LOCAL_LISTENER=LISTENER1,LISTENER2 SCOPE=BOTH;

System altered.

SQL> show parameter local_listener

NAME TYPE VALUE

--- --- ---

local_listener string LISTENER1, LISTENER2 SQL>

SQL> exit

Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Practices for Lesson 5: Configuring the Oracle Network Environment

5. Check the status of the new listener and test the new listener.

a. In a terminal window with the Oracle environment properly set, issue the following commands at the command prompt:

$ lsnrctl status LISTENER2

Connecting to

(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=EDRSR9P1)(PORT=1561))) STATUS of the LISTENER

---

Alias listener2

Version TNSLSNR for Linux: Version 12.1.0.2.0 - Production

Start Date 08-OCT-2014 10:56:24

Uptime 0 days 0 hr. 5 min. 34 sec Trace Level off

Security ON: Local OS Authentication SNMP OFF

Listener Parameter File

/u01/app/oracle/product/12.1.0/dbhome_1/network/admin/listener.o ra

Listener Log File

/u01/app/oracle/diag/tnslsnr/EDRSR9P1/listener2/alert/log.xml Listening Endpoints Summary...

(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=edRSr9p1.us.oracle.com )(PORT=1561))) (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=edRSr9p1.us.oracle.com )(PORT=5500))(Presentation=HTTP)(Session=RAW)) 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

b. Connect to your database using the new listener by using an easy connect string. Note: This method of connecting is not a recommended approach for a production environment. It is being used in the classroom environment just to prove that the newly created listener works.

$ sqlplus hr/oracle_4U@localhost:1561/orcl

Connected to:

Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production

With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options

SQL> exit

The connection is through your newly created listener. Exit SQL*Plus after you complete this step.

6. You can now stop the new LISTENER2 listener because you do not need it for the remainder of the course.

$ lsnrctl stop LISTENER2

LSNRCTL for Linux: Version 12.1.0.2.0 - Production on 08-OCT- 2014 11:19:57

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

Connecting to

(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=EDRSR9P1)(PORT=1561))) The command completed successfully

7. Reset the LOCAL_LISTENER initialization parameter to the default value. a. Log in to SQL*Plus as the DBA1 user with the AS SYSDBA option.

b. Execute the ALTER SYSTEM RESET LOCAL_LISTENER command to reset the initialization parameter to the default value.

SQL> alter system reset local_listener scope=spfile;

System altered.

c. Shut down the database instance with the IMMEDIATE option. SQL> shutdown immediate

Database closed. Database dismounted.

ORACLE instance shut down.

Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Practices for Lesson 5: Configuring the Oracle Network Environment

d. Restart the database instance and exit from SQL*Plus. SQL> startup

ORACLE instance started. …

Database mounted. Database opened. SQL> exit

In document D78846GC20_ag (Page 45-51)