Apply
Process Configuration
-
Apply process architecture has three main
components. They are the reader server, coordinator server and
apply server.
-
Apply processes can be created by several
different procedures. Apply processes can also be extended by
setting up Apply handlers. Examples were included for how to use
the add_table_rules procedure and the add_subset_rules
procedure to create the Apply process.
-
Oracle provides many useful procedures that
can be used to alter the attributes of the Apply process and its
behavior.
-
To manage the Apply process, to stop and to
start, and to handle the error transaction, there are many
procedures. Information on these procedures has been included.
start_apply
Procedure
The start_apply procedure
instructs the Apply process to start applying events. When the
Apply process is stopped for any maintenance or disabled for
some error situation, the Apply process will have to be
started manually. The start_apply procedure is used to
achieve this result. The syntax for the procedure is shown
below:
Syntax
:
DBMS_APPLY_ADM.START_APPLY(
apply_name IN VARCHAR2);
For example, to start the Apply process
named LN4_APPLY, the following SQL block can be used:
PROMPT
Starting the Apply Process
begin
dbms_apply_adm.start_apply (apply_name => 'LN4_APPLY' ) ;
end ;
/
stop_apply
Procedure
The stop_apply procedure stops the
Apply process from applying events and rolls back any
unfinished transactions being applied.
Syntax
:
DBMS_APPLY_ADM.STOP_APPLY(
apply_name IN VARCHAR2,
force IN BOOLEAN DEFAULT false);
If the force parameter is set to
TRUE, it stops the Apply process as soon as possible. If it is
set to FALSE, it stops the Apply process after ensuring that
there are no gaps in the set of applied transactions. The
behavior of the Apply process depends on the setting specified
for the force parameter and the setting specified for
the commit_serialization Apply process parameter.
For example, to start the Apply process
named LN4_APPLY, use the following SQL block:
PROMPT
Starting the Apply Process
begin
dbms_apply_adm.stop_apply (apply_name => 'LN4_APPLY' ) ;
end ;
/
Setting the Apply
Parameters
-
startup_seconds: The maximum
number of seconds to wait for another instantiation of the
same Apply process to finish.
-
time_limit: The Apply process
stops as soon as possible after the specified number of
seconds since it started.
-
trace_level: Set this parameter
only under the guidance of Oracle Support Services.
-
transaction_limit: The Apply
process stops after applying the specified number of
transactions.
-
write_alert_log: If Y, the Apply
process writes a message to the alert log on exit.
The following is the syntax of the procedure
that can be used to set parameters:
DBMS_APPLY_ADM.SET_PARAMETER(
apply_name IN VARCHAR2,
parameter IN VARCHAR2,
value IN VARCHAR2);
For example, the following procedure sets the
parallelism parameter for a capture process named
NY1_CAPTURE to 3.
BEGIN
DBMS_APPLY_ADM.SET_PARAMETER(
apply_name => 'ln4_apply',
parameter => 'parallelism',
value => 3 );
END;
The next chapter will focus on information
about setting up Apply handlers. Examples, as well as details on
how apply handlers help control the replication process, are
included.
Apply Process Configuration
set_key_columns
Procedure
Syntax
DBMS_APPLY_ADM.SET_KEY_COLUMNS(
object_name IN VARCHAR2,
{ column_list IN VARCHAR2, |
column_table IN
DBMS_UTILITY.NAME_ARRAY, }
apply_database_link IN VARCHAR2
DEFAULT NULL);
Apply Process Configuration
set_dml_handler
Procedure
user_procedure
specifies the user-defined procedure that is invoked
during the apply for the specified operation on the
specified object.
set_enqueue_destination
Procedure
The set_enqueue_destination
procedure sets the queue such that an event that satisfies
the specified rule is enqueued automatically by an Apply
process.
Syntax
DBMS_APPLY_ADM.SET_ENQUEUE_DESTINATION(
rule_name IN VARCHAR2,
destination_queue_name IN
VARCHAR2);
set_execute Procedure
The set_execute procedure
specifies whether an event that satisfies the specified
rule is executed by an Apply process.
Syntax :
DBMS_APPLY_ADM.SET_EXECUTE(
rule_name IN
VARCHAR2,
execute IN BOOLEAN);
set_update_conflict_handler
Procedure
The set_update_conflict_handler
procedure adds, modifies, or removes an update
conflict handler for the specified object.
Apply
Process Configuration
set_dml_handler
Procedure
The
set_dml_handler
procedure sets a user procedure as a DML handler for a
specified operation on a specified object. The
user procedure, acting as the handler, actually alters
the apply behavior for the specified operation on the
specified object. Whenever the intention is to perform
extra action on the transaction, the handlers are
used.
Syntax
DBMS_APPLY_ADM.SET_DML_HANDLER(
object_name IN
VARCHAR2,
object_type IN VARCHAR2,
operation_name IN VARCHAR2,
error_handler IN
BOOLEAN DEFAULT false,
user_procedure IN VARCHAR2,
apply_database_link IN VARCHAR2 DEFAULT NULL,
apply_name IN VARCHAR2 DEFAULT NULL);
Object Name is the table where
the DML is intended. operation_name values can
be INSERT, UPDATE, DELETE and LOB_UPDATE.
When error_handler is set to TRUE, the
specified user procedure is run when a row LCR
involving the specified operation on the specified
object raises an Apply process error.