The following articles describe how to restore and Delete tables in DB2. In actual operations, the DB2 database stores backups and restores data in historical files, and operations such as loading data and deleting tables. if the database name is sample, you can use the following command to list the records of the table to be deleted:
- db2 "list history dropped table all for sample"
The next step is to restore the tablespace where the table is located from the previous backup. the backup directory is c: \ db2backup. without rolling forward, indicating that the rollback is not required.
- db2 "restore db sample tablespace(userspace1) from c:\db2backup taken at 20041102100931 without rolling forward without prompting"
Step 3: unmount the data in the deleted table to a directory.
- db2 "rollforward db sample to end of logs and complete recover dropped table 00000000000002010002000d to c:\db2backup"
Step 4: Use the DDL statement of the table retained in the history file to recreate the table.
Step 5: Reload the data to the table. p () indicates the content of the first and second fields of the table to be loaded. recoverme is the table name.
- db2 "load from c:\db2backup\node0000\data OF DEL METHOD p(1,2) insert into recoverme"
The above content is an introduction to the DB2 table restoration and deletion technique. I hope you will get some benefits.
The above content is a description of the DB2 table restoration and deletion technique, hoping to help you in this regard.