如何:設定 Oracle 發行者的交易集作業 (複寫 Transact-SQL 程式設計)

Xactset 作業是由在「Oracle 發行者」端執行的複寫所建立的 Oracle 資料庫作業,可在「記錄讀取器代理程式」未與「發行者」連接時建立交易集。您可以使用複寫預存程序,以程式設計的方式從「散發者」啟用和設定此作業。如需詳細資訊,請參閱<Oracle 發行者的效能微調>。

若要啟用交易集作業

  1. 在「Oracle 發行者」端,將 job_queue_processes 初始化參數設定為足夠的值,以允許 Xactset 作業執行。如需有關此參數的詳細資訊,請參閱「Oracle 發行者」的資料庫文件。

  2. 在「散發者」端執行 sp_publisherproperty (Transact-SQL)。針對 @publisher 指定「Oracle 發行者」的名稱、針對 @propertyname 指定 xactsetbatching 的值,並針對 @propertyvalue 指定 enabled 的值。

  3. 在「散發者」端執行 sp_publisherproperty (Transact-SQL)。針對 @publisher 指定「Oracle 發行者」的名稱、針對 @propertyname 指定 xactsetjobinterval 的值,並針對 @propertyvalue 指定作業間隔 (以分鐘計)。

  4. 在「散發者」端執行 sp_publisherproperty (Transact-SQL)。針對 @publisher 指定「Oracle 發行者」的名稱、針對 @propertyname 指定 xactsetjob 的值,並針對 @propertyvalue 指定 enabled 的值。

若要設定交易集作業

  1. (選擇性) 在「散發者」端執行 sp_publisherproperty (Transact-SQL)。針對 @publisher 指定「Oracle 發行者」的名稱。這麼做會傳回「發行者」端 Xactset 作業的屬性。

  2. 在「散發者」端執行 sp_publisherproperty (Transact-SQL)。指定 @publisher 的「Oracle 發行者」名稱、指定針對 @propertyname 所設定之 Xactset 作業屬性的名稱,並指定 @propertyvalue 的新設定。

  3. (選擇性) 針對每個要設定的 Xactset 作業屬性重複步驟 2。在變更 xactsetjobinterval 屬性時,您必須在「Oracle 發行者」上重新啟動作業,新的間隔才會生效。

若要檢視交易集作業的屬性

  • 在「散發者」端執行 sp_helpxactsetjob。針對 @publisher 指定 Oracle 發行者的名稱。

若要停用交易集作業

  • 在「散發者」端執行 sp_publisherproperty (Transact-SQL)。針對 @publisher 指定「Oracle 發行者」的名稱、針對 @propertyname 指定 xactsetjob 的值,並針對 @propertyvalue 指定 disabled 的值。

範例

下列範例會啟用 Xactset 作業,並在執行之間設定三分鐘的間隔。

-- This script uses sqlcmd scripting variables. They are in the form
-- $(MyVariable). For information about how to use scripting variables  
-- on the command line and in SQL Server Management Studio, see the 
-- "Executing Replication Scripts" section in the topic
-- "Programming Replication Using System Stored Procedures".

DECLARE @publisher AS sysname;
SET @publisher = $(Publisher);

-- Enable the creation of transaction sets
-- at the Oracle Publisher.
EXEC sp_publisherproperty 
  @publisher = @publisher, 
  @propertyname = N'xactsetbatching', 
  @propertyvalue = N'enabled';

-- Set the job interval before enabling
-- the job, otherwise the job must be restarted.
EXEC sp_publisherproperty 
  @publisher = @publisher, 
  @propertyname = N'xactsetjobinterval', 
  @propertyvalue = N'3';

-- Enable the transaction set job.
EXEC sp_publisherproperty 
  @publisher = @publisher, 
  @propertyname = N'xactsetjob', 
  @propertyvalue = N'enabled';
GO