DDL operation on the table for Altibase replication#
Overview#
In general, DDL operations on the DB require an exclusive lock on the table.
Altibase uses a network-based replication technique in which the transaction log generated on the local server is transmitted to the other server to keep data in sync, and DDL is not sent through the log, so it is not replicated to the remote server.
Therefore, unlike the disk sharing method, a separate operating procedure is required to perform DDL operations on each node (Server).
Version#
The types of DDL statements supported vary depending on the ALTIBASE version, and the method of performing DDL also varies.
For detailed information, please refer to the manual for the version you are using in the Reference section.
Procedure#
Operation under service outages#
In an environment where all services accessing the database can be stopped for a certain period of time, DDL can be performed through a relatively simple procedure.
| Step | Performed on both A and B nodes |
|---|---|
| STEP 1 | - Stop the service (take action to prevent transactions from occurring) - To reliably block the service, the DB is sometimes stopped, the service port changed, and then the service restarted. - Check sessions connected to the database or statements currently being executed - iSQL> select count(*) from v$session; - iSQL> select count(*) from v$statement where execute_flag =1 ; |
| STEP 2 | - Check that the replication gap of the target node is all "0" (this means the DB on which the replication Sender is running) - Check the replication object to which the target table for the DDL belongs - iSQL> select REPLICATION_NAME,LOCAL_USER_NAME, LOCAL_TABLE_NAME from SYSTEM_.SYS_REPL_ITEMS_; - Check the replication gap - iSQL> SELECT rep_name, rep_gap FROM v$repgap; # Check that rep_gap is all 0. |
| STEP 3 | - Stop replication on the target node - iSQL> ALTER REPLICATION rep_name STOP; # The replication object (REP_NAME) is checked in STEP 2. |
| STEP 4 | - Remove the target table on which to perform DDL from the replication object - iSQL> ALTER REPLICATION rep_name DROP TABLE FROM user_name.table_name TO user_name.table_name; |
| STEP 5 | - Perform the DDL operation - iSQL> ALTER TABLE t1 ADD COLUMN ( c1 INTEGER); |
| STEP 6 | - Add the replication target table removed in STEP 4 back to the replication object list - iSQL> ALTER REPLICATION rep_name ADD TABLE FROM user_name.table_name TO user_name.table_name; |
| STEP 7 | - Start replication on the target node - iSQL> ALTER REPLICATION rep_name START |
| STEP 8 | - Start the service - If the DB's service port number was changed in STEP 1, restore the service port and restart the database. - Start the application to resume the DB service, then check the status of the DB. |
Operation under uninterrupted service#
If uninterrupted service is required, there is a constraint that work must be done one node at a time, alternating, while the other node continues operating the database.
Under these conditions, compared to the environment described above where service outages are possible, additional steps are required and caution is needed.
For detailed information, please refer to the manual for the version you are using in the Reference section.
You can get technical support from ALTIBASE if needed. (Service Portal: http://support.altibase.com/en)