Lỗi ora 12504 connection was refused with error ora-12504 năm 2024
To properly resolve this error and connect to the appropriate Oracle database, we’ll need to expound a bit on how Oracle behaves and, therefore, what is causing this issue in the first place. Show SIDs vs SERVICE_NAMESIt is important to understand the (slight) difference between what Oracle defines as a In Oracle, the system identifier (or ) is a local identifier of up to eight characters in length that is used to identify a particular database and differentiate it from other databases on the system. Often the
0. For example, the
2 database, as seen in in the full
3 of
4.
5, on the other hand, represent the names by which database instances can be connected to. A
8 The TNS ListenerWhen a client is attempting to connect to an Oracle database, rather than connecting to the database directly, there is a broker service that intervenes and handles the connection request for the client. This broker application is known as the and it performs the task of listening for incoming client requests. When a request is received, the
9 processes and forwards that request onto the appropriate Oracle database server using a , which just acts as the connection between the
9 and the database server. TNS Names and ConfigurationWhen connecting to an Oracle database, typically your database server will have
3, which is a configuration file that informs the server about
4 which are valid database connections. By default, this file is located at
5. For example, a
6 descriptor in
3 may be formatted like this:
This would define a
6 using the
1 through port
2. Connection StringWith a bit more knowledge about how Oracle actually connects to databases, we can now look at how
3 are formatted. Connect via TNS Name/NET_SERVICE_NAMEWhen connecting through a
6 as specified in your
3 config file, you must use the
6,
7, and then append the
6 with the
9 symbol, like so:
Thus, for our previous
6 descriptor above, the actual
6 we defined was
2, so our connection string might look something like this:
Connect via SERVICE_NAMEWhen connecting through a
4 and
5, along with the
6 symbol preceding the
Connect via SIDFinally, if connecting without a configured
6 or even
6 symbol as with the |