oracle如何配置多个数据库
Oracle中可以配多个数据库,并只需要开启一个侦听器就可以了,对多个数据库只要配置相应的服务命名就可以连接了。 我用的是Oracle 8.1.7 Enterprise Edition,OS是Windows 2000 Server,我把我的配置过程和情况图解说明一下,和大家共同探讨。 第一步:用Net
Oracle中可以配多个数据库,并只需要开启一个侦听器就可以了,对多个数据库只要配置相应的服务命名就可以连接了。
我用的是Oracle 8.1.7 Enterprise Edition,OS是Windows 2000 Server,我把我的配置过程和情况图解说明一下,和大家共同探讨。
第一步:用Net8 Configuration Assistant工具配置监听器,一直点下一步,最后完成即可!监听地址一般配成默认的1521就可以了。
也可以用Net8 Assistant工具来验证或配置监听器,如下图,可以配置主机和端口。
第二步:用Net8 Assistant工具来配置命名服务,如下图:
注意服务名是数据库名,主机名和端口号一定要和监听器的一样!
测试一下,连接成功,OK!
好,再配第二个库的服务命名,如下图:
注意服务名要对应到第二个数据库名!
再测试一下第二个库的连接,连接成功,OK!
最后有几点注意:
1.对一般如果有多个应用程序用Oracle的数据库,一般只需要建立一个数据库就可以了,对不同的应用设立不同的用户(不同的表空间)就可以了。
2.如果多个应用程序的字符集不一样,如既有BIG5又有GB2312,那一般就需要考虑配置多个服务器,或者建立多个数据库,或者转换到UTF-8之类的字符集。
3.如果开发需要装多个版本的Oracle,如同时安装Oracle9i和Oracle8.1.7,则需要配置各自的监听端口,环境变量没有什么需要配置的,不会冲突;注册表都放在HKEY_LOCAL_MACHINESOFTWAREORACLE下,但是会分HOME0~HOME...不同的Key中存放,所以也不会有冲突。
4.配置命名服务和监听器还可以直接编辑如下2个文件:
监听器:$ORACLE_HOME$ etworkADMINlistener.ora,一般文件如下:
# LISTENER.ORA Network Configuration File: D:DATABASEOracle81 etworkadminlistener.ora
# Generated by Oracle configuration tools.
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = HARRY)(PORT = 1521))
)
)
)
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = D:DATABASEOracle81)
(PROGRAM = extproc)
)
(SID_DESC =
(GLOBAL_DBNAME = ORASUN)
(ORACLE_HOME = D:DATABASEOracle81)
(SID_NAME = ORASUN)
)
(SID_DESC =
(GLOBAL_DBNAME = ORAGCE)
(ORACLE_HOME = D:DATABASEOracle81)
(SID_NAME = ORAGCE)
)
)
服务命名:$ORACLE_HOME$ etworkADMIN nsnames.ora,一般文件如下:
# TNSNAMES.ORA Network Configuration File: D:DATABASEOracle81NETWORKADMIN nsnames.ora
# Generated by Oracle configuration tools.
SMEST =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 127.0.0.1)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = ORAGCE)
)
)
SMEDI =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 127.0.0.1)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = ORASUN)
)
)
INST1_HTTP =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 127.0.0.1)(PORT = 1521))
)
(CONNECT_DATA =
(SERVER = SHARED)
(SERVICE_NAME = ORAGCE)
(PRESENTATION = )
)
)
EXTPROC_CONNECTION_DATA =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC0))
)
(CONNECT_DATA =
(SID = PLSExtProc)
(PRESENTATION = RO)
)
)
这2个文件在$ORACLE_HOME$ etworkADMINSAMPLE下有相应的范例文件,可以参考。
监听器配置修改后,需要重新启动监听器的服务!!!
再补充一点,配置多个侦听器或者一个侦听器侦听多个数据库的时候,对侦听器注意需要配置数据库服务。
如图,一个侦听器侦听多个数据库,如下配置,数据库名和SID分别是ORASUN和ORAGCE,同样配多个侦听器侦听一个数据库(分别对内网和外网提供),,如果碰到连接问题,请大家检查一下数据库配置这一项,当然如果直接写文件来配置就很简单了,一下就可以搞定了,大家也可以对照我前面给出的配置文件看一下。

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

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

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











MySQL is an open source relational database management system, mainly used to store and retrieve data quickly and reliably. Its working principle includes client requests, query resolution, execution of queries and return results. Examples of usage include creating tables, inserting and querying data, and advanced features such as JOIN operations. Common errors involve SQL syntax, data types, and permissions, and optimization suggestions include the use of indexes, optimized queries, and partitioning of tables.

Solutions to Oracle cannot be opened include: 1. Start the database service; 2. Start the listener; 3. Check port conflicts; 4. Set environment variables correctly; 5. Make sure the firewall or antivirus software does not block the connection; 6. Check whether the server is closed; 7. Use RMAN to recover corrupt files; 8. Check whether the TNS service name is correct; 9. Check network connection; 10. Reinstall Oracle software.

The method to solve the Oracle cursor closure problem includes: explicitly closing the cursor using the CLOSE statement. Declare the cursor in the FOR UPDATE clause so that it automatically closes after the scope is ended. Declare the cursor in the USING clause so that it automatically closes when the associated PL/SQL variable is closed. Use exception handling to ensure that the cursor is closed in any exception situation. Use the connection pool to automatically close the cursor. Disable automatic submission and delay cursor closing.

MySQL is chosen for its performance, reliability, ease of use, and community support. 1.MySQL provides efficient data storage and retrieval functions, supporting multiple data types and advanced query operations. 2. Adopt client-server architecture and multiple storage engines to support transaction and query optimization. 3. Easy to use, supports a variety of operating systems and programming languages. 4. Have strong community support and provide rich resources and solutions.

In Oracle, the FOR LOOP loop can create cursors dynamically. The steps are: 1. Define the cursor type; 2. Create the loop; 3. Create the cursor dynamically; 4. Execute the cursor; 5. Close the cursor. Example: A cursor can be created cycle-by-circuit to display the names and salaries of the top 10 employees.

Building a Hadoop Distributed File System (HDFS) on a CentOS system requires multiple steps. This article provides a brief configuration guide. 1. Prepare to install JDK in the early stage: Install JavaDevelopmentKit (JDK) on all nodes, and the version must be compatible with Hadoop. The installation package can be downloaded from the Oracle official website. Environment variable configuration: Edit /etc/profile file, set Java and Hadoop environment variables, so that the system can find the installation path of JDK and Hadoop. 2. Security configuration: SSH password-free login to generate SSH key: Use the ssh-keygen command on each node

Oracle is not only a database company, but also a leader in cloud computing and ERP systems. 1. Oracle provides comprehensive solutions from database to cloud services and ERP systems. 2. OracleCloud challenges AWS and Azure, providing IaaS, PaaS and SaaS services. 3. Oracle's ERP systems such as E-BusinessSuite and FusionApplications help enterprises optimize operations.

When Oracle log files are full, the following solutions can be adopted: 1) Clean old log files; 2) Increase the log file size; 3) Increase the log file group; 4) Set up automatic log management; 5) Reinitialize the database. Before implementing any solution, it is recommended to back up the database to prevent data loss.
