Exercise 4-1 Configuring Oracle Net
In this exercise, you will use the graphical tools and command-line tools to build a complete Oracle Net environment. As a result, readers can see the difference between windows and Linux systems.
1. Create the directory used by the Oracle NET configuration file and set the Tns_admin variable to this location. The location of the directory does not matter, as long as the Oracle user has permission to create, read, and write.
In a Linux system:
Mkdir/u01/oracle/net
Export Tns_admin=/u01/oracle/net
Make sure to do all the work from now on in the painting where the variable is set.
In the Windows system:
mkdir d:\oracle\net
Create a registry key Tns_admin, and set it as a string variable in the registry of the Oracle Home branch. This is usually: hkey_local_machine\software\oracle\key_oradb11g_home1
2. Check if the variable is read by running the tnsping command from the operating system prompt:
Tnsping ORCL
The error "tns-03505:failed to resolve name" will be returned because no files exist in the Tns_admin directory. In a Windows system, you need to start a new command prompt and find the tns_admin new value from the registry.
3. Start Net Manager. In a Linux system, run Netmgr from the operating system prompt. On a Windows system, start it from the Start menu. The top row of the Net Manager window displays the location of the Oracle net file. If this is not a new directory, the tns_admin variable is not set correctly.
4. Create a new listener: local branch of the battle Card navigation tree, highlight the listeners item, and click the "+" icon.
5. Enter the listener name "NewList" and click the OK button.
6. Click the Add Address button.
7. For address 1, select "TCP/IP" as the protocol and enter "127.0.0.1" as the host, "2521" as the port. Figure 4-11 shows the results.
8. Create a letter service name: Highlight the service naming item in the Navigation tree and click the "+" icon.
9. Enter "New" as the service name and click the Next button.
10. Select TCP/IP as the protocol and click the Next button.
11. Enter "127.0.0.1" as the hostname, "2521" as the port, and click the Next button.
12. Enter "SERV1" as the service name and click the Next button.
13. Click the Finish button and if you try to test it will fail at this point, figure 4-12 shows the result.
14. Save your configuration by clicking the file and save Network configuration menu items. This will create the Listener.ora file and the Tnsnames.ora file in the Tns_admin directory.
15. Use the editor to check these two files.
LISTENER. The Ora file is as follows:
newlist=
(description=
(Address= (PROTOCOL=TCP) (host=127.0.0.1) (port=2521))
)
The Tnsnames.ora file is as follows:
NEW =
(DESCRIPTION =
(Address_list =
(Address= (PROTOCOL=TCP) (host=127.0.0.1) (port=2521))
)
(Connect_data=
(SERVICE_NAME=SERV1)
)
)
16. Use Lsnrctl start NewList from the operating system prompt
17. Test the connection string with tnsping new in the operating system prompt.
18. Use Sqlplus/as sysdba to connect to the database via the operating system authentication, ignoring any listeners.
19. Set the Service_names parameter and the Local_listener parameter (memory only, not set in the parameter file) for the running instance, and the new listener registers the new service name:
Alter system set SERVICE_NAMES=SERV1 scope-memory;
Alter system set LOCAL_LISTENER=NEW scope=memory;
alter system register;
20. At the operating system prompt, use the LSNRCTL service newlist to confirm that a new service has been registered with the new listener.
21. Confirm that the new network environment is in effect by logging in using the following code:
Sqlplus system/oracle@new
Exercise 4-2 setting up a shared server environment
This exercise is a continuation of step 21 in exercise [4-1], where the user needs to configure a shared server and verify that it can run.
1. Set the dispatchers parameter and the Shared_servers parameter and register to the listener with the following command.
Alter system set dispatchers= ' (PROTOCOL=TCP) (dispatchers=2) ' scope=memory;
Alter system set SHARED_SERVERS=4 scope=memory;
alter system register;
2. Verify that the scheduler and the shared server are started by querying the view v$process. Look for a process named s000,s001,s002,s003,d000 and D001.
Select program from V$process order by program;
3. In the operating System prompt window, confirm that the scheduler is registered with the listener.
LSNRCTL Services NewList
4. Connect through the listener and confirm that the connection was performed through the shared server mechanism.
Connect system/oracle@new;
Select D.name,s.name from V$dispatcher D,
OCP 11g Fourth Practice