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,同样配多个侦听器侦听一个数据库(分别对内网和外网提供),,如果碰到连接问题,请大家检查一下数据库配置这一项,当然如果直接写文件来配置就很简单了,一下就可以搞定了,大家也可以对照我前面给出的配置文件看一下。

Stored procedures are precompiled SQL statements in MySQL for improving performance and simplifying complex operations. 1. Improve performance: After the first compilation, subsequent calls do not need to be recompiled. 2. Improve security: Restrict data table access through permission control. 3. Simplify complex operations: combine multiple SQL statements to simplify application layer logic.

The working principle of MySQL query cache is to store the results of SELECT query, and when the same query is executed again, the cached results are directly returned. 1) Query cache improves database reading performance and finds cached results through hash values. 2) Simple configuration, set query_cache_type and query_cache_size in MySQL configuration file. 3) Use the SQL_NO_CACHE keyword to disable the cache of specific queries. 4) In high-frequency update environments, query cache may cause performance bottlenecks and needs to be optimized for use through monitoring and adjustment of parameters.

The reasons why MySQL is widely used in various projects include: 1. High performance and scalability, supporting multiple storage engines; 2. Easy to use and maintain, simple configuration and rich tools; 3. Rich ecosystem, attracting a large number of community and third-party tool support; 4. Cross-platform support, suitable for multiple operating systems.

The steps for upgrading MySQL database include: 1. Backup the database, 2. Stop the current MySQL service, 3. Install the new version of MySQL, 4. Start the new version of MySQL service, 5. Recover the database. Compatibility issues are required during the upgrade process, and advanced tools such as PerconaToolkit can be used for testing and optimization.

MySQL backup policies include logical backup, physical backup, incremental backup, replication-based backup, and cloud backup. 1. Logical backup uses mysqldump to export database structure and data, which is suitable for small databases and version migrations. 2. Physical backups are fast and comprehensive by copying data files, but require database consistency. 3. Incremental backup uses binary logging to record changes, which is suitable for large databases. 4. Replication-based backup reduces the impact on the production system by backing up from the server. 5. Cloud backups such as AmazonRDS provide automation solutions, but costs and control need to be considered. When selecting a policy, database size, downtime tolerance, recovery time, and recovery point goals should be considered.

MySQLclusteringenhancesdatabaserobustnessandscalabilitybydistributingdataacrossmultiplenodes.ItusestheNDBenginefordatareplicationandfaulttolerance,ensuringhighavailability.Setupinvolvesconfiguringmanagement,data,andSQLnodes,withcarefulmonitoringandpe

Optimizing database schema design in MySQL can improve performance through the following steps: 1. Index optimization: Create indexes on common query columns, balancing the overhead of query and inserting updates. 2. Table structure optimization: Reduce data redundancy through normalization or anti-normalization and improve access efficiency. 3. Data type selection: Use appropriate data types, such as INT instead of VARCHAR, to reduce storage space. 4. Partitioning and sub-table: For large data volumes, use partitioning and sub-table to disperse data to improve query and maintenance efficiency.

TooptimizeMySQLperformance,followthesesteps:1)Implementproperindexingtospeedupqueries,2)UseEXPLAINtoanalyzeandoptimizequeryperformance,3)Adjustserverconfigurationsettingslikeinnodb_buffer_pool_sizeandmax_connections,4)Usepartitioningforlargetablestoi


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

SecLists
SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

SublimeText3 English version
Recommended: Win version, supports code prompts!

Zend Studio 13.0.1
Powerful PHP integrated development environment

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

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