The db2 tutorial I am watching is: Experience in DB2 data synchronization. Planning plan:
Suppose you will use an application that generates reports. This application requires data that exists in the DEPARTMENT table of the SAMPLE database. Instead of using data directly from the source table, you want to copy changes to a target table that can only be read by the application that generates the report. For ease of management, you want to save the target table and the source table on the same machine. It can also be another database on the network that has been cataloged from the local machine.
Implementation steps of data replication plan:
Before starting
1. First, make sure that db2 has been installed on the machine that will implement the replication plan and an instance has been established.
2. Determine the source and target databases you will copy by the user, which can be on the same machine or on the network, and needs to be cataloged locally.
3. Confirm that you have access rights to the source database and the target database. Assume that the source database is the sample library and the target database is the copydb library.
4. Create a copydb library on your machine.
Planning this plan
1. Copy the source
You already know that the replication source is the schema.DEPARTMENT table in the sample database. Before setting up your environment, you must decide what you want to copy from the table; you decide to register all columns and book all columns.
2. Copy the target
The target you decide you want to copy is the copydb database, which was created before starting. Currently, there are no target tables in this database; you want the replication center to create target tables based on your specifications. This method of automatically generating target tables is preferred because it ensures correct mapping to the replication source. An existing target table can also be used, however, this scheme assumes that the target table does not exist.
3. Copy options
For the purposes of this scenario, you decide to store the CD table, the target table, and the copy control table in their default tablespaces respectively. Although SAMPLE and COPYDB databases exist on the same machine, their tablespaces are located in different containers.
Planning and setting up an environment for this plan
Step 1: Create a control table for the Capture program
The Capture program reads the current registration information from the copy control table and stores its status in these tables. Any database that will act as a Capture control server must contain a Capture control table.
1. Open the Copy Center and expand the SQL Copy folder.
2. Expand Define Folder.
3. Right-click the Capture Control Server folder and select Create Capture Control Table -> Quick. Alternatively, you can customize the Capture control table by selecting Create Capture control table -> Customization.
4. In the "Select Server" window, select SAMPLE database. This database will serve as a Capture control server. Click OK.
5. In the "Create Control Table - Quick - Server Information" window, select the source that the supervisor uses to copy and capture changes to those sources. Then, click Next.
6. In the "Create Control Table - Quick - Copy Details" window, click Next. No information in this window needs to be changed.
7. In the "Create Control Table - Quick - Tablespace" window, enter the tablespace specifications for the TSASNCA tablespace. For example, set the buffer pool to IBMDEFAULTBP. For this solution, the default Capture mode - ASN is accepted.
8. In the "Create Control Table - Quick - Tablespace" window, enter the tablespace specifications for the TSASNUOW tablespace.
9. After entering the information for these two tablespaces in the "Create Control Table - Quick Table Space" window, click OK.
10. Click Close on the "Message Dialog" window. This window displays the results of generating SQL scripts that will create the Capture control table. If any errors occur, these errors will be displayed in this window.
11. Enter a valid user ID and password in the "Run or Save SQL" window and click OK to run the SQL script immediately.
12. In the "DB2 Message" window, you should see a message indicating that the script has been successfully run. Click Close.
13. Expand the Capture Control Server Folder. The SAMPLE database should be displayed in this folder.
Step 2: Enable database for replication
The Capture program reads the DB2 log to obtain log records including changes to the registered table. The log must be an archived log so that DB2 will no longer use the log file until the Capture program can read the log. For UNIX(R) and Windows environments, the DB2 default is circular logging, so this setting must be changed to archive logging.
Step 3: Register the copy source
After the Capture control table is created and the database is enabled for replication, the DEPARTMENT table is registered as the replication source.
Suppose you will use an application that generates reports. This application requires data that exists in the DEPARTMENT table of the SAMPLE database. Instead of using data directly from the source table, you want to copy changes to a target table that can only be read by the application that generates the report. For ease of management, you want to save the target table and the source table on the same machine. It can also be another database on the network that has been cataloged from the local machine.
Implementation steps of data replication plan:
Before starting
1. First, make sure that db2 has been installed on the machine that will implement the replication plan and an instance has been established.
2. Determine the source and target databases you will copy by the user, which can be on the same machine or on the network, and needs to be cataloged locally.
3. Confirm that you have access rights to the source database and the target database. Assume that the source database is the sample library and the target database is the copydb library.
4. Create a copydb library on your machine.
Planning this plan
1. Copy the source
You already know that the replication source is the schema.DEPARTMENT table in the sample database. Before setting up your environment, you must decide what you want to copy from the table; you decide to register all columns and book all columns.
2. Copy the target
The target you decide you want to copy is the copydb database, which was created before starting. Currently, there are no target tables in this database; you want the replication center to create target tables based on your specifications. This method of automatically generating target tables is preferred because it ensures correct mapping to the replication source. An existing target table can also be used, however, this scheme assumes that the target table does not exist.
3. Copy options
For the purposes of this scenario, you decide to store the CD table, the target table, and the copy control table in their default tablespaces respectively. Although SAMPLE and COPYDB databases exist on the same machine, their tablespaces are located in different containers.
Planning and setting up an environment for this plan
Step 1: Create a control table for the Capture program
The Capture program reads the current registration information from the copy control table and stores its status in these tables. Any database that will act as a Capture control server must contain a Capture control table.
1. Open the Copy Center and expand the SQL Copy folder.
2. Expand Define Folder.
3. Right-click the Capture Control Server folder and select Create Capture Control Table -> Quick. Alternatively, you can customize the Capture control table by selecting Create Capture control table -> Customization.
4. In the "Select Server" window, select SAMPLE database. This database will serve as a Capture control server. Click OK.
5. In the "Create Control Table - Quick - Server Information" window, select the source that the supervisor uses to copy and capture changes to those sources. Then, click Next.
6. In the "Create Control Table - Quick - Copy Details" window, click Next. No information in this window needs to be changed.
7. In the "Create Control Table - Quick - Tablespace" window, enter the tablespace specifications for the TSASNCA tablespace. For example, set the buffer pool to IBMDEFAULTBP. For this solution, the default Capture mode - ASN is accepted.
8. In the "Create Control Table - Quick - Tablespace" window, enter the tablespace specifications for the TSASNUOW tablespace.
9. After entering the information for these two tablespaces in the "Create Control Table - Quick Table Space" window, click OK.
10. Click Close on the "Message Dialog" window. This window displays the results of generating SQL scripts that will create the Capture control table. If any errors occur, these errors will be displayed in this window.
11. Enter a valid user ID and password in the "Run or Save SQL" window and click OK to run the SQL script immediately.
12. In the "DB2 Message" window, you should see a message indicating that the script has been successfully run. Click Close.
13. Expand the Capture Control Server Folder. The SAMPLE database should be displayed in this folder.
Step 2: Enable database for replication
The Capture program reads the DB2 log to obtain log records including changes to the registered table. The log must be an archived log so that DB2 will no longer use the log file until the Capture program can read the log. For UNIX(R) and Windows environments, the DB2 default is circular logging, so this setting must be changed to archive logging.
Step 3: Register the copy source
After the Capture control table is created and the database is enabled for replication, the DEPARTMENT table is registered as the replication source.
This news has 3 pages in total, currently on page 1 1 2 3