Oracle7 Server Distributed Systems Volume II: Replicated Data
Altering a Replicated Object
DDL changes to a replicated object must be made by calling DBMS_REPCAT.ALTER_MASTER_REPOBJECT from the master definition site. The ALTER_MASTER_REPOBJECT procedure lets you supply the DDL that you want to have applied to the replicated object.
To ensure that the change is properly applied at all master sites, you should apply these changes in the following order:
1. If the object being altered is a master table for any updatable snapshots, you should replicate any snapshot changes to the master table as described .
2. Before altering a replicated object, you must quiesce the system by calling SUSPEND_MASTER_ACTIVITY at the master definition site. This pushes any queued transactions to the master sites in the replicated environment.
3. Alter the object by calling ALTER_MASTER_REPOBJECT at the master definition site. If the object requires replication support, you must regenerate any necessary triggers and packages by calling GENERATE_REPLICATION_SUPPORT.
4. Check the RepCatLog view at the master definition site to ensure that the object was successfully modified at each master site. The DDL changes to the object and any supporting objects are asynchronously applied at each master site as described .
5. If you altered a table used as the master for any snapshots,
you must now drop and re-create those snapshots. Any
other replicated objects at a snapshot site would be
automatically re-created the next time you called REFRESH_SNAPSHOT_REPGROUP at the snapshot site.
6. You may now resume normal replication activity by calling RESUME_MASTER_ACTIVITY at the master definition site.
Supplying the DDL
To alter an object in your replicated environment, call the ALTER_MASTER_REPOBJECT procedure in the DBMS_REPCAT package, as shown in the following example:
DBMS_REPCAT.ALTER_MASTER_REPOBJECT(
sname => 'acct_rec',
oname => 'emp',
type => 'table',
ddl_text => 'ALTER TABLE acct_rec.emp ADD
(healthplan NUMBER(7,2) DEFAULT 100 NOT NULL)',
comment => `updated by '||user ||' on `||SYSDATE);
This example adds another column to the EMP table. The DDL text supplied is asynchronously applied at each master site as described . If you had made this change using the ALTER TABLE command, instead of by passing this command as an argument to the ALTER_MASTER_REPOBJECT procedure, this change would not have been propagated to the other master sites in the replicated environment.
Local customization of individual replicas at snapshot or master sites is outside the scope of Oracle's symmetric replication facility. As a replication administrator, you must ensure that local customizations do not interfere with any global customizations done with ALTER_MASTER_REPOBJECT.
Additional Information: The parameters for the ALTER_MASTER_REPOBJECT procedure are described in Table 12 - 74, and the exceptions are listed in Table 12 - 75.