Today, we will mainly talk about the use of AWK to synchronize DB2 database Schema. If you are interested in using AWK to synchronize DB2 database Schema, the following articles will provide you with relevant knowledge. The following is a detailed description of the main content of the article. I hope you will have a better understanding of it after browsing.
When multiple members use one system for integration testing, the same database must be installed on each member PC as the unit test environment. This article describes several ways to maintain Database Consistency-we call this process database schema synchronization.
When multiple members use one system for integration testing, the same database must be installed on each member PC as the unit test environment. This article describes several ways to maintain Database Consistency-we call this process database schema synchronization.
Scenario Description
We often encounter this situation in Projects: all members of the project team share a database in the system integration test environment (SIT), and the same database is installed on each member's PC as a unit test environment. When the database structure changes due to changes in the business model, the database administrator usually modifies the SIT database structure based on the requirements of the data model group and maintains the continuity of the original data.
At this point, the structure of the unit test database on the PC may be different from that of the SIT database. There are usually the following ways to maintain their consistency (we call this process the synchronization of the database SCHEMA ):
1. The model group or database administrator releases the database modification command list. Each member operates step by step according to the list to synchronize the database SCHEMA. This method requires that every modification to the SIT database SCHEMA must be recorded and notified to every member of the project team. If a member misses one of the modifications, subsequent modifications may be faulty. Of course, he can also back up and restore the latest database from the unit test environment of other members.
2. The database administrator backs up the entire SIT database, and each member deletes the original database on the PC to restore the backup database. This method seems to always get the latest SCHEMA and data, but it is usually difficult to implement. Because the SIT environment is usually in a Unix environment, while the unit test environment is usually in a Windows environment, the management methods for disk devices vary greatly, and the backup files obtained through the database backup tool, changing disk devices is troublesome when recovery is performed under different operating systems.
At the same time, the data volume in the SIT environment of the DB2 database is usually large. Some projects may even obtain the latest data from the production line on a regular basis, while the unit test environment is usually on a PC, the available disk space is relatively small. In most cases, it is not enough to restore the full SIT database.
3. The model group or database administrator issues a database Modification Notice. Each member uses the method described in this article to synchronize the database with the data on the PC according to the latest SCHEMA of the SIT database. This method uses the SHELL program provided in this article, which can be completed quickly, with only a small amount of manual intervention required. In addition, this method can maintain data continuity in the unit test environment.
The above content describes how to use AWK to synchronize the Schema of A DB2 database. I hope it will help you in this regard.