Home Database Mysql Tutorial oracle直接读写ms sqlserver数据库(二)配置透明网关

oracle直接读写ms sqlserver数据库(二)配置透明网关

Jun 07, 2016 pm 03:18 PM
oracle sqlserver database Read and write Configuration

环境说明: 数据库 版本:11gR2 透明 网关版本:11g 操作系统Windows Server2008_64位 ORACLE_HOME目录:D:\app\Administrator\product\11.2.0\dbhome_1 MS 数据库 IP:192.168.199.245 数据库 :BWONLINE 默认端口:1433 ORACLE 数据库 IP:172.18.123.113 服

环境说明:

数据库版本:11gR2

透明网关版本:11g

操作系统Windows Server2008_64位

ORACLE_HOME目录:D:\app\Administrator\product\11.2.0\dbhome_1

MS数据库IP:192.168.199.245 数据库:BWONLINE 默认端口:1433

ORACLE数据库IP:172.18.123.113 服务名:db1 默认端口1521

 

备注:现在安装数据库后安装透明网关,透明网关安装时候的Home目录和数据库的Home目录一样。(好处:方便服务器监听的管理)

 

马上进入正题:

一、透明网关参数的配置

1.安装完Gateway软件后,在ORACLE_HOME目录下有一下dg4msql的目录,这就是Gateway软件的目录了。

在dg4msql/admin目录下有一个initdg4msql.ora的文件,这里的文件命名规则为initsid.ora,系统安装完毕后会自动产生一个initdg4msql.ora的文件;

oracle直接读写ms sqlserver数据库(二)配置透明网关

 

2.在实际的工作中,创建一个连接ms数据库为bwonline的链接,直接拷贝默认的initdg4msql文件,修改后缀,如上图所示 。

 

3.编辑initbwonline.ora文件:

HS_FDS_CONNECT_INFO=192.168.199.245//DBONLINE

HS_FDS_TRACE_LEVEL=OFF

HS_FDS_RECOVERY_ACCOUNT=RECOVER

HS_FDS_RECOVERY_PWD=RECOVER

 

HS_FDS_CONNECT_INFO的参数说明:

1)参数格式:hostname:port/serverinstance /databasename,其中hostname为机器名或IP地址,有网友说这里需要填写机器名才可以,但是经过实验测试机器名和IP地址都没有问题;

2)端口号:SQL Server2005默认的端口好为1433,也有网友介绍需要填写端口号才可以,经过测试填写和不填写都是可以的(可能测试环境不同导致测试的结果不同)

3)serverinstance是SQL Server的实例名,不知道什么时候SQL Server也搞起实例来了,一般空着就行。

4)Databasename是SQL Server的数据库名,需要填写;

5)整个参数文件的写法本人总共尝试过4种,经测试都是可以的。

oracle直接读写ms sqlserver数据库(二)配置透明网关

HS_FDS_CONNECT_INFO="192.168.199.245;database=BWONLINE"

HS_FDS_CONNECT_INFO=[192.168.199.245]//BWONLINE

HS_FDS_CONNECT_INFO=192.168.199.245:1433//BWONLINE

HS_FDS_CONNECT_INFO=192.168.199.245//BWONLINE

 

二、监听文件listener的配置

1.监听文件的目录:ORACLE_HOME/NETWORK/ADMINISTRATOR下的listener.ora文件

2.文件的格式说明:文件分成两部分:SID_LIST_LISTENER和LISTENER

SID_LIST_LISTENER为监听SID的清单,LISTENER为监听主机的信息(IP地址和端口号的设定),详细如下:

# listener.ora Network Configuration File: D:\app\Administrator\product\11.2.0\dbhome_1\network\admin\listener.ora

# Generated by Oracle configuration tools.

 

SID_LIST_LISTENER =

(SID_LIST =

(SID_DESC =

(SID_NAME = dg4msql) -----前面定义SID的名称

(ORACLE_HOME = D:\app\Administrator\product\11.2.0\dbhome_1) -----ORACLE的HOME目录

(PROGRAM = dg4msql) -----程序的配置目录(以前部分的版本透明网关的目录为tg4msql,请大家注意)

)

(SID_DESC =

(SID_NAME = bwonline)

(ORACLE_HOME = D:\app\Administrator\product\11.2.0\dbhome_1)

(PROGRAM = dg4msql)

)

)

--------加亮部分说明当在透明网关配置完相应的SID,复制加亮的这一段,修改相应的SID_NAME即可。

 

LISTENER =

(DESCRIPTION_LIST =

(DESCRIPTION =

(ADDRESS = (PROTOCOL = TCP)(HOST = 172.18.123.113)(PORT = 1521)) ----监听服务器的IP地址或hostname和端口号

(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))

)

)

 

ADR_BASE_LISTENER = D:\app\Administrator

 

3.配置完以上参数,启动监听便可以看到相应的服务名:在cmd里面输入:lsnrctl status

oracle直接读写ms sqlserver数据库(二)配置透明网关

 

三、配置tnsnames文件,这步比较简单,相信都很熟悉了。

1.监听文件的目录:ORACLE_HOME/NETWORK/ADMINISTRATOR下的tnsnames.ora文件

db1 =

(DESCRIPTION =

(ADDRESS_LIST =

(ADDRESS = (PROTOCOL = TCP)(HOST = 172.18.123.113)(PORT = 1521)) ----监听服务器的信息

)

(CONNECT_DATA =

(SERVICE_NAME = DB1) -----监听服务名称

)

(HS = OK)

)

 

四、透明网关的测试

1、创建dblink

脚本:

CREATE DATABASE LINK BWONLINE

CONNECT TO SA

IDENTIFIED BY "*****"

USING 'BWONLINE';

 

2、查找相应MS下面的一张表,然后再ORACLE下面通过DBLINK来访问;

oracle直接读写ms sqlserver数据库(二)配置透明网关

成功返回数据,表明相应的透明网关和dblink都是没有问题的。

 

3.当往Sql里面插入数据时,有时会出现错误:ORA-01591错误与分布式事务

则可以用以下办法解锁:

select * from DBA_2PC_PENDING;

找到global_tran_id=ECOLOGY.bf951efe.7.2.44893

commit force 'ECOLOGY.bf951efe.10.24.485992';

或者

rollback force 'ECOLOGY.bf951efe.10.24.485992';

后面这串字符每次都不一样。

 

4.还有可能出现错误:对象名  'RECOVER.HS_TRANSACTION_LOG' 无效

解决办法是在SQLserver中创建这里配置的用户RECover和表HS_TRANSACTION_LOG

HS_FDS_RECOVERY_ACCOUNT=RECOVER

HS_FDS_RECOVERY_PWD=RECOVER

 

表脚本:

DROP TABLE HS_TRANSACTION_LOG

CREATE TABLE HS_TRANSACTION_LOG(
  GLOBAL_TRAN_ID char (64) NOT NULL,
  TRAN_COMMENT char (255) NULL
)

不过SQLserver里面创建用户比较麻烦,这里可直接改成dbo,和sa的密码。

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
1 months ago By 尊渡假赌尊渡假赌尊渡假赌
Two Point Museum: All Exhibits And Where To Find Them
1 months ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How long will Oracle database logs be kept? How long will Oracle database logs be kept? May 10, 2024 am 03:27 AM

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.

How much memory does oracle require? How much memory does oracle require? May 10, 2024 am 04:12 AM

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 Oracle database server hardware configuration requirements May 10, 2024 am 04:00 AM

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.

How much memory is needed to use oracle database How much memory is needed to use oracle database May 10, 2024 am 03:42 AM

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).

Oracle scheduled tasks execute the creation step once a day Oracle scheduled tasks execute the creation step once a day May 10, 2024 am 03:03 AM

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.

iOS 18 adds a new 'Recovered' album function to retrieve lost or damaged photos iOS 18 adds a new 'Recovered' album function to retrieve lost or damaged photos Jul 18, 2024 am 05:48 AM

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

How to start the listening program in oracle How to start the listening program in oracle May 10, 2024 am 03:12 AM

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.

Detailed tutorial on establishing a database connection using MySQLi in PHP Detailed tutorial on establishing a database connection using MySQLi in PHP Jun 04, 2024 pm 01:42 PM

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())

See all articles