Developers and DBAs have two different roles. In actual work, the two roles can help each other, communicate with each other, and jointly complete the project. But in fact, developers need some basic Oracle knowledge to make better and more professional applications. Program .
The knowledge of Oracle system architecture and development is not within the scope of this article. This article only discusses some aspects that developers need to understand, in addition, it is more inclined to dotnetprogrammers to some extent.
I. Network Configuration
When oracle is used as the background database, the front-end application must be connected to the server through network configuration. Even if the database and application are on the same machine, certain configurations are required, if the client and server are not on the same machine, the client must install the Oracle client software. The client version is not necessarily the same as the server version. For example, the server is Oracle10g, you only need to install an Oracle9i or later version on the client. The following are the descriptions:
1. The application and database are on the same machine.
This mode is relatively simple, because the full version of Oracle has already included the Oracle client component. By default, you only need to provide the database user name and password to connect to the database, network-related things can be ignored. This situation is suitable for the Local Machine with only one Oracle instance. If there are multiple instances, the configuration will be more complicated, which is the same as the second point below. Refer to the introduction below.
2. database servers and applications are separated
The so-called disconnection refers to the physical isolation of two machines. This connection must be achieved through OCI. OCI refers to a method used to connect a client to a server. There are multiple ways to achieve it. The simplest way is to install an oracle disk, install an Oracle client on the client. However, it is difficult to deploy this method because the Oracle client is also relatively large, with a minimum of MB or more. You need to specify a directory and perform other operations during installation, which is complicated. If you deploy a large-scale CS structure, it will be very troublesome.
The alternative is that a "Lite version of Oracle client" can be found. This version is not officially released by Oracle, and is only about 9 MB. After installation, you can connect the client to the server, but does not include any client tools.
Can I directly package the Oracle client in my own application for publishing? I think so, but I won't.
How does OCI implement this bridge? There is a listener on the server which is always responsible for listening for external requests. This request is sent by the client's OCI. After the listener receives the request, it actually applies to the database server, implements the entire connection process.
Generally, port 1521 is required for the server by default. Therefore, port 1521 must be enabled on the server and firewall. For Unix Series servers, this is done, but for Windows Series servers, you will find that, although firewall has opened port 1521, the client is still unable to connect, but it is too dangerous to open all firewall. This is a special phenomenon caused by the socket mechanism in Windows. The principle is not explained. It only describes the processing method:
The following path is required in the database server registry:
Add the use_shared_socket key to my computer \ HKEY_LOCAL_MACHINE \ SOFTWARE \ oracle \ home0 and assign the value to true. Remember, if not, restart the database server.
For the client, there is a major file named tnsnames. ora, after installing the Oracle client, you can find this file in the installation directory, which records how to connect to the server. Generally, after installing the client, the system will automatically establish several connections, if you need to create a new file, you can copy it directly. It is a text file and can be edited directly. It takes effect immediately after the disk is saved, and you do not need to restart the machine or Oracle service.