Sometimes we need to create multiple database services (not just database instances) on the same machine again, and each database can have a separate service running, just in one machine environment. You can listen on different ports or on the same port
Steps to create multiple databases
After installing the Oracle database, many tools will be automatically installed, here we use the Database Configuration Assistant tool to create the database
Follow the prompts step by step to determine and fill in the information can be, pay attention to the third fill in the name of the database you want to create:
The whole process is exactly the same as creating a database for the first time, just take care to select the character set, number of connections, etc. as desired.
After the successful creation, we will automatically run the database service we just created in the service list, for example, the name I just created here is looorcl:
Connect to the specified database
- In general, after the creation of a successful, direct use of sqlplus to connect on the line, only to connect to the string changed to the above just added on the line, for example:
sqlplus sys/nhis@looOrcl as sysdba
I'm local here so I don't have a set ip - Error if connecting: ERROR:ORA-12514: TNS: The listener currently does not recognize the requested service in the connection descriptor.
-
Check at this point, first of all, for writing errors. Make sure that the service name you use when connecting matches the service name defined in the documentation.
-
Check the configuration of this file, the specific path in the creation of the database has been prompted, do not change the default is the database directory of the
product\11.2.0\dbhome_1\NETWORK\ADMIN
directory, for example, mine is in D:\app\Administrator\product\11.2.0\dbhome_1\NETWORK\ADMIN\, and there will be an extra node in the contents of the file, for example: -
Then look at the files in the same directory and check if the listener has been added, that is, the name of the database service we just created, has been added to the file, if not, you can fill it in manually, for example, like I did:
-
restart a listener
lsnrctl stop
lsnrctl start
After successful startup, you can just reconnect, so it is the same port, listening to two different databases. If we open Net Manager, we can see that we are listening on two repository services
Create database services with different listening ports
Simply delete the database configuration you just created in Net Manager above, then add new listener, reformulate the database name and SID, and reassign a port.