In Oracle, multiple databases can be configured, and only one listener can be enabled. for multiple databases, you only need to configure the corresponding service name to connect.
I use Oracle 8.1.7 Enterprise Edition and the OS is a Windows 2000 Server. I will explain my configuration process and situation and discuss it with you.
Step 1: Use the Net8 Configuration Assistant tool to configure the listener. Click Next and finish! Generally, the listening address is set to the default 1521 value.
You can also use the Net8 Assistant tool to verify or configure the listener. For example, you can configure the host and port.
Step 2: Use the Net8 Assistant tool to configure the Naming Service, for example:
Note that the service name is the database name, and the host name and port number must be the same as that of the listener!
Test the connection. The connection is successful. OK!
Well, configure the service name of the second database, for example:
Note that the service name must correspond to the second database name!
Test the connection of the second database. The connection is successful. OK!
Note the following points:
1. generally, if multiple applications use Oracle databases, you only need to create one database. You can set up different users (different tablespaces) for different applications.
2. if the character sets of multiple applications are different, such as BIG5 and GB2312, you generally need to consider configuring multiple servers, creating multiple databases, or converting to character sets such as UTF-8.
3. if you need to install multiple versions of Oracle for development, for example, to install both Oracle9i and Oracle8.1.7, You need to configure the respective listening ports. The environment variables do not need to be configured and will not conflict with each other; the Registry is stored in HKEY_LOCAL_MACHINESOFTWAREORACLE, but it is divided into HOME0 ~ HOME... stores different keys, so there will be no conflict.
4. Configure the Naming Service and listener. You can also directly edit the following two files:
Listener: $ ORACLE_HOME $ etworkADMINlistener. ora. The general file is as follows:
# LISTENER. ORA Network Configuration File: D: DATABASEOracle81 etworkadminlistener. ora
# Generated by Oracle configuration tools.
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP) (HOST = HARRY) (PORT = 1521 ))
)
)
)
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = D: DATABASEOracle81)
(PROGRAM = extproc)
)
(SID_DESC =
(GLOBAL_DBNAME = ORASUN)
(ORACLE_HOME = D: DATABASEOracle81)
(SID_NAME = ORASUN)
)
(SID_DESC =
(GLOBAL_DBNAME = ORAGCE)
(ORACLE_HOME = D: DATABASEOracle81)
(SID_NAME = ORAGCE)
)
)
Service name: $ ORACLE_HOME $ etworkADMIN nsnames. ora. The general file is as follows:
# TNSNAMES. ORA Network Configuration File: D: DATABASEOracle81NETWORKADMIN nsnames. ora
# Generated by Oracle configuration tools.
SMEST =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP) (HOST = 127.0.0.1) (PORT = 1521 ))
)
(CONNECT_DATA =
(SERVICE_NAME = ORAGCE)
)
)
SMEDI =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP) (HOST = 127.0.0.1) (PORT = 1521 ))
)
(CONNECT_DATA =
(SERVICE_NAME = ORASUN)
)
)
Instanchttp =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP) (HOST = 127.0.0.1) (PORT = 1521 ))
)
(CONNECT_DATA =
(SERVER = SHARED)
(SERVICE_NAME = ORAGCE)
(PRESENTATION = http: // admin)
)
)
EXTPROC_CONNECTION_DATA =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC) (KEY = EXTPROC0 ))
)
(CONNECT_DATA =
(SID = PLSExtProc)
(PRESENTATION = RO)
)
)
The two files have corresponding sample files under $ ORACLE_HOME $ etworkADMINSAMPLE. For details, refer.
After the Listener Configuration is modified, restart the listener service !!!
Additionally, When configuring multiple listeners or one listener to listen on multiple databases, you must configure the Database Service for the listener.
A listener listens to multiple databases. The following configuration shows that the database name and SID are ORASUN and ORAGCE respectively. Multiple listeners are also configured to listen to one database (provided for Intranet and Internet ), if you encounter a connection problem, check the database configuration item. Of course, if you write a file directly to configure the item, it will be easy to do, you can also take a look at the configuration file that I previously provided.