Oracle Configuration Management

1. Communication mechanism between Oracle client and server

After the Oracle product is installed, both the server and the client need to perform network configuration to achieve network connection. The server is configured with a listener, and the client is configured with a network service name.

 

1, oracle net protocol

Oracle realizes the connection and data transfer between the client and the server through the oracle net protocol. Oracle net is a software layer that resides on both the server side and the client side. It encapsulates TCP/IP and is responsible for establishing and maintaining the connection between the client application and the database server. If there is a protocol, there must be a corresponding port, so oracle NET has a default listening port of 1521 .

blob.png.

The request sent by the client is first converted by the oracle net protocol, converted into information that can be transmitted through the network, and the request is transmitted to the database server through the tcp/ip network. After the server receives the client request, it is converted by the oracle net protocol, and the request Converted into local instructions that the database can interpret and execute, and execute on the server side, and transmit the results to the client through tcp/ip and oracle net protocols for display.

 

2. The connection process between the client and the server

The Oracle server receives connection requests from clients through a component called " oracle net listener", which listens to a background process located on the server side. The sent client connection request is first intercepted by the server's listener and handed over to the corresponding database instance, thereby establishing a connection between the client and the server. After the connection is established, the client and the server can communicate directly without the participation of the listener. To implement the listener's monitoring of client requests, the listener needs to be configured.

The Oracle Net Service Name is an identifier that represents the configuration information for the client to connect to the server.

blob.png

The connection process between the client and the server is as follows:

1) There is a resident listener on the server side to listen for connection requests sent by the client.

2) The user uses the client (enterprise manager or sql tool) to enter the user name, password and network service name, or enter a request similar to " CONNECT username/password@net_service_name " in the sql command line .

3) The client checks the network service configuration file tnsnames.ora file, and maps the network service name to a connection descriptor containing the oracle server address, listening port and global database name.

4) The client locates the listener according to the connection descriptor, and passes the network connection information to the listener.

5) The listener queries the listening configuration file listener.ora to find out the server to be connected to.

6) The client and server start to communicate.

 

3. Common tools for configuring and managing Oracle network configuration are as follows:

blob.png

1) netca method

blob.png

blob.png

blob.png

blob.png

blob.png

blob.png

blob.png

View listening files

blob.png

 

Start a new listener

blob.png

View listener status

blob.png

2) netmgr method

blob.png

Just add a listener

 

3) Command method

Modify vim /opt/oracle/product/11.2/db_1/network/admin/listener.ora

Add a new listener, the code is as follows:


blob.png

Start a new listener

blob.png


blob.png

The code the listener supports no services in the red box above shows that no service is registered to the listener, which is related to the order in which the listener and database instance are started.

 

Workaround: listen to the order of startup and database instance startup

According to the previous knowledge, after the database instance is started, start the monitor. When connecting to the database, only if both of them are present, oracle can provide services to the outside world.

The order of monitoring and instance startup will affect the work coordination between the two, as follows:

 

Start the monitor first, then start the instance: At this time, it is normal for the remote client to connect to the instance, and there will be no problem, because the monitor is started first, and the background process PMON will register the server with the monitor when the instance is started. When the user requests services, the two coordination is ready.

先启动实例,后启动监听:如果监听刚启动,用户马上连接实例,可能会报“监听程序当前无法识别连接描述符中请求的服务”的错误,原因在于PMON还没来得及向监听注册实例服务。但是这个问题只会存在很短的一段时间,再连接就不会有问题了,为什么等一会就好了呢?因为PMON每隔一段时间都会看有无服务需要向监听注册,此时若监听已启动,PMON就能注册成功,二者的协调工作就准备就绪了。

有没有办法解决很短的一段时间内的这个问题呢?答案是一定的。就是以静态注册的方式,即将实例的服务描述添加到listener.ora,这样只要启动监听,对应的服务在监听中就注册了。这是只要实例正常启动完成,就可以对外提供服务器了。在Listener.ora代码中添加如下代码即可。

blob.png

4、客户端的连接

客户端连接到数据库服务器必须知道一些信息,如数据库服务器的主机名或ip地址,使用的通信协议、端口号、以及对应的数据库服务名,这些需要在客户端设置

1)win7上安装oracle客户端软件

blob.png

双击上图中第二个文件安装

 

安装完成时候会在c:盘下生成oracle文件夹:

blob.png

2) Find the c:\oracle\product\11.2.0\client_lite\network\admin\tnsnames.ora file and modify it. The modification results are as follows:

blob.png

 

3 ) Note: You need to add parsing in the hosts file

blob.png

 

4 ) Open the named line on the win7 client and execute the command to connect

blob.png

Already connected to oracle server remotely


Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324587348&siteId=291194637