- Oracle Database XE 11gR2 Jump Start Guide
- Asif Momen
- 813字
- 2021-08-13 18:28:12
Local database connections
Establishing a connection locally means running the SQL command-line utility on the same computer where Oracle Database 11g XE is installed, and initiating a database connection command using the valid database credentials.
The following screenshot is taken from Oracle Database 11g XE on Windows, and demonstrates establishing a local database connection to the database:

Navigate to the Oracle Database 11g XE database home and start the sqlplus
session with the /nolog
option. Using the connect
statement establish a connection to the database by supplying the valid database username and password. As shown in the preceding screenshot, connect as SYSTEM user with the password entered while installing Oracle Database 11g XE.
ORA_DBA is a local Windows group that gets automatically created when you install Oracle Database XE and your Windows username automatically gets added to this group. Members of ORA_DBA can connect to the Oracle Database XE without a password, as shown in the following screenshot:

Oracle Net Listener
To connect to the database remotely, we should have Oracle Net Listener running on the host where Oracle Database 11g XE is installed. When a remote client initiates a database connection request, this connection request is received by Oracle Net Listener. The job of the listener is to listen to these incoming database connection requests and hand over the connection requests to the appropriate databases.
Thereafter the remote-client connection directly communicates with the database without the need of the listener. Without the listener service running we cannot connect to the database remotely. There may be more than one database running on the host server; however, you will only have one database listener for all incoming requests. Based on the incoming request, Oracle Net Listener will hand over the connection request to the appropriate database.
Oracle Net Listener and the tnsnames.ora
files are configured by default when we install Oracle Database 11g XE. The listener's configuration file is located under $ORACLE_HOME\network\admin\listener.ora
. Oracle Database XE automatically creates a Windows service for Oracle Net Listener (OracleXETNSListener
).
listener.ora
is the name of the Oracle Net Listener configuration file and it resides under $ORACLE_HOME\network\admin
.
The content of a sample listener.ora
file in its simplest form is as follows:
SID_LIST_LISTENER = (SID_LIST = (SID_DESC = (SID_NAME = XE) (ORACLE_HOME = C:\oraclexe\app\oracle\product\11.2.0\server) ) ) LISTENER = (DESCRIPTION_LIST = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = amomen-PC)(PORT = 1521)) ) )
The description of the parameters is as follows:
LISTENER:
The name of the listenerSID_NAME:
The Oracle Database nameORACLE_HOME:
The Oracle software installation home directoryHOST:
The name of the host where Oracle Net Listener is runningPORT:
The port on which Oracle Net Listener is listening to the incoming requests
Make the necessary changes to the preceding parameters, save the file, and restart the Windows Oracle Listener service OracleXETNSListener.
Navigate to Oracle home ($ORACLE_HOME\bin
), start the listener utility (lsnrctl
), enter status
as shown in the following screenshot, and hit Enter.
If the listener is not started, the command displays an error message, as shown in the following screenshot:

If the listener is running, the command displays detailed listener information as shown in the following screenshot:

The listener is automatically configured when we install Oracle Database 11g XE.
- To stop the listener on Windows, launch the Services window by navigating to Start | Control Panel | Administrative Tools | Services and stop the OracleXETNSListener service, or launch the listener utility (
lsnrctl
) and enter theLSNRCTL> stop
command. To stop the listener on Linux, within the listener utility (lsnrctl
) enter thestop
command as we did in the Windows environment. - To start the listener on Windows, launch the Services window by navigating to Start | Control Panel | Administrative Tools | Services and start the OracleXETNSListener service, or launch the listener utility (
lsnrctl
) and enter theLSNRCTL> start
command. To start the listener on Linux, within the listener utility (lsnrctl
) enter thestart
command as we did in Windows environment.
Transparent Network Susbstrate (TNS) handles all remote database connections. Oracle software reads the TNS connection string to understand how to connect to the remote databases. Every Oracle database and the Oracle Client software will have this file. By default the tnsnames.ora
file is located under $ORACLE_HOME\network\admin
. A sample alias entry from the tnsnames.ora
file is as follows:
MY_XE = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = amomen-PC)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SID = XE) ) )
In the preceding code:
MY_XE
is an alias name. You can name it anything you like.HOST
is the hostname or IP-Address where database is running.PORT
is the port number on which Oracle Net Listener is listening.SID
is the Oracle database name.
When connecting to the remote database, we will use my_xe
as a connect
string.
- Java 開發(fā)從入門到精通(第2版)
- Java面向?qū)ο笏枷肱c程序設(shè)計(jì)
- 面向STEM的Scratch創(chuàng)新課程
- Microsoft Dynamics GP 2013 Reporting, Second Edition
- Java性能權(quán)威指南(第2版)
- Securing WebLogic Server 12c
- CouchDB and PHP Web Development Beginner’s Guide
- Python機(jī)器學(xué)習(xí)經(jīng)典實(shí)例
- C語言課程設(shè)計(jì)
- 微信小程序項(xiàng)目開發(fā)實(shí)戰(zhàn)
- C語言程序設(shè)計(jì)同步訓(xùn)練與上機(jī)指導(dǎo)(第三版)
- 零基礎(chǔ)入門學(xué)習(xí)Python(第2版)
- Webpack實(shí)戰(zhàn):入門、進(jìn)階與調(diào)優(yōu)
- Node學(xué)習(xí)指南(第2版)
- Illustrator CS6設(shè)計(jì)與應(yīng)用任務(wù)教程