欧美一级特黄大片做受成人-亚洲成人一区二区电影-激情熟女一区二区三区-日韩专区欧美专区国产专区

OracleGatewayforSQLServer時2PC分布式事務異常處理的方法是什么

這篇文章主要講解了“Oracle Gateway for SQL Server時2PC分布式事務異常處理的方法是什么”,文中的講解內(nèi)容簡單清晰,易于學習與理解,下面請大家跟著小編的思路慢慢深入,一起來研究和學習“Oracle Gateway for SQL Server時2PC分布式事務異常處理的方法是什么”吧!

創(chuàng)新互聯(lián)建站是一家專注于成都網(wǎng)站設計、做網(wǎng)站與策劃設計,額敏網(wǎng)站建設哪家好?創(chuàng)新互聯(lián)建站做網(wǎng)站,專注于網(wǎng)站建設十多年,網(wǎng)設計領域的專業(yè)建站公司;建站業(yè)務涵蓋:額敏等地區(qū)。額敏做網(wǎng)站價格咨詢:18980820575

異常:

用戶一套Oracle數(shù)據(jù)庫alert.log報錯,一時半會找不到原因聯(lián)系到我這邊協(xié)助分析:

Tue Jun 23 07:43:53 2020
Errors in file /u01/app/oracle/diag/rdbms/whrma/whrma/trace/whrma_reco_7075.trc:
ORA-01017: invalid username/password; logon denied
[Oracle][ODBC SQL Server Wire Protocol driver][SQL Server]Login failed for user 'RECOVER'. {28000,NativeErr = 18456}
ORA-02063: preceding 2 lines from WHSFC

分析:

Oracle中有報ORA-02063錯誤是dblink相關問題,而SQL server訪問失敗應該是使用到了Oracle gateway訪問異構數(shù)據(jù)庫的錯誤。登錄Oracle數(shù)據(jù)庫建立確實是這樣:

$ lsnrctl stat

LSNRCTL for Linux: Version 11.2.0.3.0 

Copyright (c) 1991, 2011, Oracle.  All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.0.135)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias                     listener
Version                   TNSLSNR for Linux: Version 11.2.0.3.0 - Production
Listener Parameter File   /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora
Listener Log File         /u01/app/oracle/product/11.2.0/dbhome_1/network/log/listener.log
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.0.135)(PORT=1521)))
Services Summary...
Service "dg4msql" has 1 instance(s).
  Instance "dg4msql", status UNKNOWN, has 1 handler(s) for this service...
Service "hmdrma" has 2 instance(s).
  Instance "hmdrma", status UNKNOWN, has 1 handler(s) for this service...
  Instance "hmdrma", status READY, has 1 handler(s) for this service...
The command completed successfully

$ cd $ORACLE_HOME/dg4msql/admin/
$ ll
total 28
-rw-r--r-- 1 oracle oinstall 10722 May 14  2009 dg4msql_cvw.sql
-rw-r--r-- 1 oracle oinstall   746 Jun  8  2007 dg4msql_tx.sql
-rw-r--r-- 1 oracle oinstall   369 Feb  4  2015 initdg4msql.ora
-rw-r--r-- 1 oracle oinstall   411 Feb  4  2015 listener.ora.sample
-rw-r--r-- 1 oracle oinstall   244 Feb  4  2015 tnsnames.ora.sample

$ more initdg4msql.ora
# This is a customized agent init file that contains the HS parameters
# that are needed for the Database Gateway for Microsoft SQL Server

#
# HS init parameters
#
HS_FDS_CONNECT_INFO=[192.168.0.100]:3000//WHSFC
# alternate connect format is hostname/serverinstance/databasename
HS_FDS_TRACE_LEVEL=OFF
HS_FDS_RECOVERY_ACCOUNT=RECOVER
HS_FDS_RECOVERY_PWD=RECOVER

理清一下:

RMA系統(tǒng)DB(192.168.0.135):Oracle 11.2.0.3 通過gateway DBlink訪問會訪問SFC系統(tǒng)SQL Server的DB

SFC系統(tǒng)DB(192.168.0.100):SQL Server 2008

這里報錯[SQL Server]Login failed for user 'RECOVER'. {28000,NativeErr = 18456}因為是分布式系統(tǒng)中出現(xiàn)2PC問題時,進行自我恢復的一個過程。

查詢2PC事務異常是否存在,果然:

SQL> select * from dba_2pc_pending;

Oracle Gateway for SQL Server時2PC分布式事務異常處理的方法是什么

注意,2PC分布式事務鎖異??梢灾苯油ㄟ^手動方式強制COMMIT/ROLLBACK FORCE 'transaction_id';方式解鎖 (例如:commit force '6.23.17365'; 或者rollback force '6.23.17365'; )

但為了進一步搞清楚alert.log報錯原理,查看官方文檔得到更詳細說明:

https://docs.oracle.com/cd/E11882_01/gateways.112/e12013/configsql.htm#OTGIS1027

9.5 Configure Two-Phase Commit

The gateway supports the following transaction capabilities:

  • COMMIT_CONFIRM

  • READ_ONLY

  • SINGLE_SITE

The transaction model is set using the HS_TRANSACTION_MODEL initialization parameter. By default, the gateway runs in COMMIT_CONFIRM transaction mode. When the SQL Server database is updated by a transaction, the gateway becomes the commit point site. The Oracle database commits the unit of work in the SQL Server database after verifying that all Oracle databases in the transaction have successfully prepared the transaction. Only one gateway instance can participate in an Oracle two-phase commit transaction as the commit point site.

See Also:

Oracle Database Heterogeneous Connectivity User's Guide for information about the two-phase commit process.

To enable the COMMIT_CONFIRM transaction mode, perform the following tasks:

  1. Create a Recovery Account and Password

  2. Create the Transaction Log Table

The log table, called HS_TRANSACTION_LOG, is where two-phase commit transactions are recorded. Alternatively users can specify a different table name by setting a gateway initialization parameter HS_FDS_TRANSACTION_LOG parameter. This table needs to be in the same schema as the recovery account.

9.5.1 Create a Recovery Account and Password

For the gateway to recover distributed transactions, a recovery account and password must be set up in the SQL Server database. By default, both the user name of the account and the password are RECOVER. The name of the account can be changed with the gateway initialization parameter HS_FDS_RECOVERY_ACCOUNT. The account password can be changed with the gateway initialization parameter HS_FDS_RECOVERY_PWD.

Note:

Oracle recommends that you do not use the default value RECOVER for the user name and password. Moreover, storing plain-text as user name and password in the initialization file is not a good security policy. There is now a utility called dg4pwd that should be used for encryption. Refer to Section 4.2.3, 'Encrypting Initialization parameters' in the Oracle Database Heterogeneous Connectivity User's Guide for further details.

  1. Set up a user account in the SQL Server database. Both the user name and password must be a valid SQL Server user name and password.

  2. In the initialization parameter file, set the following gateway initialization parameters:

    • HS_FDS_RECOVERY_ACCOUNT to the user name of the SQL Server user account you set up for recovery.

    • HS_FDS_RECOVERY_PWD to the password of the SQL Server user account you set up for recovery.

      See Also:

      "Customize the Initialization Parameter File" for information about editing the initialization parameter file. For information about HS_FDS_RECOVERY_ACCOUNT and HS_FDS_RECOVERY_PWD, see Appendix C, "Initialization Parameters".

9.5.2 Create the Transaction Log Table

When configuring the gateway for two-phase commit, a table must be created in the SQL Server database for logging transactions. The gateway uses the transaction log table to check the status of failed transactions that were started at the SQL Server database by the gateway and registered in the table.

Note:

Updates to the transaction log table cannot be part of an Oracle distributed transaction.

Note:

The information in the transaction log table is required by the recovery process and must not be altered. The table must be used, accessed, or updated only by the gateway.

The table, called HS_TRANSACTION_LOG, consists of two columns, GLOBAL_TRAN_ID, data type CHAR(64) NOT NULL and TRAN_COMMENT, data type CHAR(255).

You can use another name for the log table, other than HS_TRANSACTION_LOG, by specifying the other name using the HS_FDS_TRANSACTION_LOG initialization parameter.

See Also:

Appendix C, "Initialization Parameters" for information about the HS_FDS_TRANSACTION_LOG initialization parameter.

Create the transaction log table in the user account you created in "Create a Recovery Account and Password". Because the transaction log table is used to record the status of a gateway transaction, the table must reside at the database where the SQL Server update takes place. Also, the transaction log table must be created under the owner of the recovery account.

Note:

To utilize the transaction log table, users of the gateway must be granted privileges on the table.

To create a transaction log table use the dg4msql_tx.sql script, located in the directory $ORACLE_HOME/dg4msql/admin where $ORACLE_HOME is the directory under which the gateway is installed. Use isql to execute the script, as follows:

$ isql -Urecovery_account -Precovery_account_password [-Sserver] -idg4msql_tx.sql

通過以上官方文檔得知,

因為2PC問題恢復時需要用過在SQL SERVER端建立RECOVER賬號,訪問trascation log table(gateway配置文件中的HS_FDS_TRANSACTION_LOG=HS_TRANSACTION_LOG)  ,解決2PC問題。

檢查SQL Server DB沒有建立RECOVER賬號所以報錯:[SQL Server]Login failed for user 'RECOVER'. {28000,NativeErr = 18456}

并按照文檔中說明在SQL Server DB中建立trascation log table,執(zhí)行dg4msql_tx.sql中內(nèi)容(因為gateway配置的SQLSERVER是WHSFC DB,這里也把HS_TRANSACTION_LOG表建立到WHSFC DB下):

use WHSFC
CREATE TABLE HS_TRANSACTION_LOG
(  GLOBAL_TRAN_ID char (64) NOT NULL,  
TRAN_COMMENT char (255) NULL)
go
grant all on HS_TRANSACTION_LOG to public
go

按照官方的配置全部完成。但是沒過多久alert.log又有報錯了:

Tue Jun 23 23:31:55 2020
Errors in file /u01/app/oracle/diag/rdbms/whrma/whrma/trace/whrma_reco_7075.trc:
ORA-28500: connection from ORACLE to a non-Oracle system returned this message:
[Oracle][ODBC SQL Server Wire Protocol driver][Microsoft SQL Server]Invalid object name 'RECOVER.HS_TRANSACTION_LOG'. {42S02,NativeErr = 208}
ORA-02063: preceding 2 lines from WHSFC
Errors in file /u01/app/oracle/diag/rdbms/whrma/whrma/trace/whrma_reco_7075.trc:
ORA-28500: connection from ORACLE to a non-Oracle system returned this message:
[Oracle][ODBC SQL Server Wire Protocol driver][Microsoft SQL Server]Invalid object name 'RECOVER.HS_TRANSACTION_LOG'. {42S02,NativeErr = 208}
ORA-02063: preceding 2 lines from WHSFC

注意到這次,和之前的報錯不一樣了,是報Invalid object name 'RECOVER.HS_TRANSACTION_LOG'. {42S02,NativeErr = 208}

但我們已經(jīng)建立了按照文檔在SQLSERVER中要求建立了HS_TRANSACTION_LOG為什么還是保存呢?

注意到這里是說RECOVER.HS_TRANSACTION_LOG, 表名前的RECOVER.是SQL Server中的dbname還是 schemaname?看樣子是gateway默認自帶的一個名字,但是SQL Server無論是DBname還是schema都不存在的。所以會報錯Invalid object name了,進一步分析因為gateway中配置了SQLServer DBname:WHSFC,所以這里RECOVER.應該是schemaname,但是像SQLServer2008中默認的schema是dbo,所以就找不到這個table了;

使用RECOVER賬號建立一個DBlink,查詢table驗證一下:

CREATE PUBLIC DATABASE LINK WHSFCRECO
 CONNECT TO RECOVER
 IDENTIFIED BY <PWD>
 USING '(DESCRIPTION = 
           (ADDRESS_LIST = 
            (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.135)(PORT = 1521))
           )
           (CONNECT_DATA = 
             (SID = dg4msql)
           )
           (HS = OK)
         )';
SELECT * FROM RECOVER.HS_TRANSACTION_LOG@WHSFCRECO
--果然報錯一樣:
[Oracle][ODBC SQL Server Wire Protocol driver][Microsoft SQL Server]Invalid object name 'RECOVER.HS_TRANSACTION_LOG'. {42S02,NativeErr = 208}

解決:

在SQLServer要訪問的WHSFC DB下建立schema:RECOVER,并把HS_TRANSACTION_LOG表建立到RECOVER schema下:

USE [WHSFC]
GO
CREATE SCHEMA [RECOVER] AUTHORIZATION [RECOVER]
GO
CREATE TABLE RECOVER.HS_TRANSACTION_LOG(
GLOBAL_TRAN_ID char (64) NOT NULL,  
TRAN_COMMENT char (255) NULL)
go
grant all on RECOVER.HS_TRANSACTION_LOG to public
go

一段時間后Oracle通過RECO進程自動清理了分布式事務并在alert.log中記錄:

Thu Jun 25 10:54:55 2020
DISTRIB TRAN WHRMA.6f4758bb.6.23.173265
  is local tran 6.23.173265 (hex=06.17.2a4d1))
  delete pending forced rollback tran, scn=12519027806551 (hex=b62.d0349157)
DISTRIB TRAN WHRMA.6f4758bb.2.24.250810
  is local tran 2.24.250810 (hex=02.18.3d3ba))
  delete pending forced rollback tran, scn=12519027892235 (hex=b62.d035e00b)
DISTRIB TRAN WHRMA.6f4758bb.4.2.253750
  is local tran 4.2.253750 (hex=04.02.3df36))
  delete pending forced rollback tran, scn=12519534153370 (hex=b62.ee62ce9a)
DISTRIB TRAN WHRMA.6f4758bb.8.22.258215
  is local tran 8.22.258215 (hex=08.16.3f0a7))
  delete pending forced rollback tran, scn=12519534165133 (hex=b62.ee62fc8d)
Thu Jun 25 10:58:39 2020
DISTRIB TRAN WHRMA.6f4758bb.5.15.251070
  is local tran 5.15.251070 (hex=05.0f.3d4be))
  delete pending forced rollback tran, scn=12519570537961 (hex=b62.f08dfde9)
Thu Jun 25 11:02:51 2020
DISTRIB TRAN WHRMA.6f4758bb.11.11.171034
  is local tran 11.11.171034 (hex=0b.0b.29c1a))
  delete pending forced rollback tran, scn=12519570552088 (hex=b62.f08e3518)
DISTRIB TRAN WHRMA.6f4758bb.10.21.251539
  is local tran 10.21.251539 (hex=0a.15.3d693))
  delete pending forced rollback tran, scn=12519570598077 (hex=b62.f08ee8bd)

查詢dba_2pc_pending也沒有記錄了:

SQL> select * from dba_2pc_pending;

感謝各位的閱讀,以上就是“Oracle Gateway for SQL Server時2PC分布式事務異常處理的方法是什么”的內(nèi)容了,經(jīng)過本文的學習后,相信大家對Oracle Gateway for SQL Server時2PC分布式事務異常處理的方法是什么這一問題有了更深刻的體會,具體使用情況還需要大家實踐驗證。這里是創(chuàng)新互聯(lián),小編將為大家推送更多相關知識點的文章,歡迎關注!

文章名稱:OracleGatewayforSQLServer時2PC分布式事務異常處理的方法是什么
網(wǎng)站地址:http://aaarwkj.com/article30/ijpgpo.html

成都網(wǎng)站建設公司_創(chuàng)新互聯(lián),為您提供建站公司、服務器托管、手機網(wǎng)站建設、Google、做網(wǎng)站、網(wǎng)站收錄

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)

成都seo排名網(wǎng)站優(yōu)化
国产午夜福利av在线麻豆| 中文字幕日韩精品在线看| 久久亚洲欧洲日本韩国欧美| 日韩av人妻一区二区三区| 婷婷国产成人久久精品激情| 日韩精品国产一区二区在线观看| 变态另类日韩欧美高清| 国产极品嫩模91精品| 亚洲中文字幕av每天更新| 欧美视频亚洲视频自拍视频| 亚洲国产免费一区二区| 日日躁夜夜躁狠狠躁欧美| 国产美女极度色诱视频| 国产亚洲香蕉精彩视频| 丁香婷婷麻豆激情综合网| 日本免费一区中文字幕| 精品午夜人妻一区二区| 亚洲av十八禁在线播放| 欧美日韩精品一区二区在线播放 | 国产精品国产三级农村av| 亚洲不卡在线视频免费| 久久伊人亚洲精品中文字幕| 麻豆精品午夜福利在线| 国产美女冒白浆免费网站| 日韩欧美第一页在线观看| 日韩亚洲欧美精品另类| 青青草原在线视频一区| 成人黄色三级免费网站| 中文字幕在线一级色视频| 91九色在线精品人妻| 久久亚洲一区二区麻豆偷| 久久精品国产亚洲av高清大结局| 国产女同互慰一区二区| 东京一区二区三区四区黄片| 久久亚洲精品国产精品黑人| 无套内射精品一区二区| 欧美日韩亚洲精品一区二区三区| 蜜臀av午夜福利在线| 亚洲av日韩专区在线观看| 国产毛片久久久久久国产| 亚洲欧美日韩有码一区|