配置Oracle网络环境
当客户端通过网络以connect用户名/密码@连接字符串的形式连接oracle数据库时,需要监听程序的协助,当连接建立后,即使监听程序挂掉也不会影响已经建立好的连接
当客户端通过网络以"connect 用户名/密码@连接字符串"的形式连接oracle数据库时,需要监听程序的协助,当连接建立后,即使监听程序挂掉也不会影响已经建立好的连接。
用户连接oracle数据库服务器主要有两种方式:专有服务器连接和共享服务器连接
在专用服务器模式中,对于每个运行数据库应用程序的用户进程都由执行Oracle 数据库服务器代码的专用服务器进程提供服务。
每个服务器进程都有自己专用的PGA,这个PGA 在服务器进程启动时创建,对PGA 的访问权限仅限于该服务器进程,并且只能由代表该服务器进程的Oracle 代码对PGA 进行读写。
在共享服务器模式中,不必为每个连接都提供一个专用服务器进程。分派程序将多个传入网络会话请求引到共享服务器进程池。共享服务器进程为所有客户机请求提供服务。
多个客户端用户共享服务器进程,且UGA被转移到SGA(如果配置了共享池或者大型池),PGA将只剩下栈空间。
配置和管理Oracle Net 的工具主要有dbconsole、netca、netmgr、和命令行工具(vi)
Oracle Net支持多种连接解析方式:
Easy Connect(EZCONNECT)
使用简便连接时,可提供Oracle Net 连接所需的所有信息作为连接字符串的一部分。简便连接的连接字符串采用以下形式:
username/password@hostname[:port][/service_name]
监听程序端口和服务名为可选项。如果未提供监听程序端口,Oracle Net 假定使用的是默认端口1521。如果未提供服务名,Oracle Net 假定连接字符串中提供的数据库服务名与主机名是相同的。
SQL> conn hr/hr@192.168.0.90:1521/orcl.example.com
本地命名(TNSNAMES)
使用本地命名时,用户可提供Oracle Net 服务的别名。Oracle Net 会根据本地已知服务的列表来检查别名,如果发现匹配名称,会将别名转换为主机、协议、端口和服务名。
本地命名的一个优势是,数据库用户仅需要记住简便连接所需的短别名,而不必记住很长的连接字符串。
如果组织的Oracle Net 服务配置不经常更改,则适合使用本地命名。
SQL> conn hr/hr@orcl
目录命名和外部命名
Oracle 网络相关的文件位于$TNS_ADMIN目录下,其中主要有sqlnet.ora、listener.ora、tnsnames.ora三个文件
sqlnet.ora :位于数据库服务器上,用于定义连接解析方式(默认连接方式为TNSNAMES, EZCONNECT)
listener.ora :位于数据库服务器上,用于监听器的配置文件
tnsname.ora :位于客户机上,包含网络服务器名,并映射到连接字符串
默认可能不存在sqlnet.ora、listener.ora两个文件,但监听程序仍然可以以默认方式启动。此时,Oracle将自动在解析地址为计算机主机名,端口为1521的地址上启动一个名为"LISTENER"的监听器。
向数据库注册实例的方法分为静态注册和动态注册。
注册就是将数据库作为一个服务注册到监听程序。客户端不需要知道数据库名和实例名,只需要知道该数据库对外提供的服务名就可以申请连接到数据库。
在数据库服务器启动过程中,数据库服务器会向监听程序注册相应的服务(无论何时启动一个数据库,默认地都有两条信息注册到监听器中:数据库服务器对应的实例名和服务名)
静态注册就是实例启动时读取listener.ora文件的配置,将实例和服务注册到监听程序。无论何时启动一个数据库,默认地都有两条信息注册到监听器中:数据库服务器对应的实例和服务。
静态注册时,listener.ora中的GLOBAL_DBNAME向外提供服务名,listener.ora中的SID_NAME提供注册的实例名。
动态注册是在instance启动的时候PMON进程根据init.ora中的instance_name,service_names两个参数将实例和服务动态注册到listener中。
注册到监听器中的实例名从参数文件中的instance_name参数取得。如果该参数没有设定值,那么它将取参数文件中的db_name的值。
注册到监听器中的服务名从参数文件中的参数service_names取得。如果该参数没有设定值,数据库将拼接参数文件中的 db_name和db_domain的值来注册自己。
由于动态注册需要pmon进程,所以监听必须在数据库启动之前启动,否则动态注册将失败;在数据库运行的过程中,如果重启监听也会造成动态注册失败。

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



InnoDB's full-text search capabilities are very powerful, which can significantly improve database query efficiency and ability to process large amounts of text data. 1) InnoDB implements full-text search through inverted indexing, supporting basic and advanced search queries. 2) Use MATCH and AGAINST keywords to search, support Boolean mode and phrase search. 3) Optimization methods include using word segmentation technology, periodic rebuilding of indexes and adjusting cache size to improve performance and accuracy.

The article discusses using MySQL's ALTER TABLE statement to modify tables, including adding/dropping columns, renaming tables/columns, and changing column data types.

Article discusses configuring SSL/TLS encryption for MySQL, including certificate generation and verification. Main issue is using self-signed certificates' security implications.[Character count: 159]

Article discusses popular MySQL GUI tools like MySQL Workbench and phpMyAdmin, comparing their features and suitability for beginners and advanced users.[159 characters]

Article discusses strategies for handling large datasets in MySQL, including partitioning, sharding, indexing, and query optimization.

The difference between clustered index and non-clustered index is: 1. Clustered index stores data rows in the index structure, which is suitable for querying by primary key and range. 2. The non-clustered index stores index key values and pointers to data rows, and is suitable for non-primary key column queries.

Full table scanning may be faster in MySQL than using indexes. Specific cases include: 1) the data volume is small; 2) when the query returns a large amount of data; 3) when the index column is not highly selective; 4) when the complex query. By analyzing query plans, optimizing indexes, avoiding over-index and regularly maintaining tables, you can make the best choices in practical applications.

The article discusses dropping tables in MySQL using the DROP TABLE statement, emphasizing precautions and risks. It highlights that the action is irreversible without backups, detailing recovery methods and potential production environment hazards.
