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

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

The retention period of Oracle database logs depends on the log type and configuration, including: Redo logs: determined by the maximum size configured with the "LOG_ARCHIVE_DEST" parameter. Archived redo logs: Determined by the maximum size configured by the "DB_RECOVERY_FILE_DEST_SIZE" parameter. Online redo logs: not archived, lost when the database is restarted, and the retention period is consistent with the instance running time. Audit log: Configured by the "AUDIT_TRAIL" parameter, retained for 30 days by default.

The amount of memory required by Oracle depends on database size, activity level, and required performance level: for storing data buffers, index buffers, executing SQL statements, and managing the data dictionary cache. The exact amount is affected by database size, activity level, and required performance level. Best practices include setting the appropriate SGA size, sizing SGA components, using AMM, and monitoring memory usage.

Oracle database server hardware configuration requirements: Processor: multi-core, with a main frequency of at least 2.5 GHz. For large databases, 32 cores or more are recommended. Memory: At least 8GB for small databases, 16-64GB for medium sizes, up to 512GB or more for large databases or heavy workloads. Storage: SSD or NVMe disks, RAID arrays for redundancy and performance. Network: High-speed network (10GbE or higher), dedicated network card, low-latency network. Others: Stable power supply, redundant components, compatible operating system and software, heat dissipation and cooling system.

To create a scheduled task in Oracle that executes once a day, you need to perform the following three steps: Create a job. Add a subjob to the job and set its schedule expression to "INTERVAL 1 DAY". Enable the job.

The amount of memory required for an Oracle database depends on the database size, workload type, and number of concurrent users. General recommendations: Small databases: 16-32 GB, Medium databases: 32-64 GB, Large databases: 64 GB or more. Other factors to consider include database version, memory optimization options, virtualization, and best practices (monitor memory usage, adjust allocations).

Apple's latest releases of iOS18, iPadOS18 and macOS Sequoia systems have added an important feature to the Photos application, designed to help users easily recover photos and videos lost or damaged due to various reasons. The new feature introduces an album called "Recovered" in the Tools section of the Photos app that will automatically appear when a user has pictures or videos on their device that are not part of their photo library. The emergence of the "Recovered" album provides a solution for photos and videos lost due to database corruption, the camera application not saving to the photo library correctly, or a third-party application managing the photo library. Users only need a few simple steps

Oracle listeners are used to manage client connection requests. Startup steps include: Log in to the Oracle instance. Find the listener configuration. Use the lsnrctl start command to start the listener. Use the lsnrctl status command to verify startup.

How to use MySQLi to establish a database connection in PHP: Include MySQLi extension (require_once) Create connection function (functionconnect_to_db) Call connection function ($conn=connect_to_db()) Execute query ($result=$conn->query()) Close connection ( $conn->close())
