DB2It is a series of relational database management systems exported from IBM and serve on different operating system platforms.DB2 databaseAlthough not the best in the database market, it is also very useful. Next we will bring you the DB2 databasePractical operationsHighlights.
1. Load data:
Export to tempfile of del select * from TABLENAME where not clearing condition;
Load from tempfile of del modified by delprioritychar replace into TABLENAME nonrecoverable;
Note:
When the export data of unrelated data tables is export, it can be in the form of concurrency to improve efficiency;
TABLENAME indicates the name of the table to be cleared;
Modified by delprioritychar prevents the database records from being loaded due to line breaks;
Replace into replaces the content in the current database with the content of the current data file;
Nonrecoverable load without logs;
2. Search for the current application: db2 list application | grep BTPDBS;
3. Delete the application currently in use:
Db2 "force application (Id1, Id2, Id3 )"
Id1, Id2, and Id3 are the application numbers displayed in the List;
4. view the execution status of the current application number:
Dbget snapshot for application agentid 299 | grep Row
5. view database parameters:
Db2 get db cfg for // The current database can be omitted
6. Modify the Database Log Data:
Db2 update db cfg using <Parameter Name> <parameter value>
7. Usage of Db2Stop Force:
The following error occurs during Bind:
SQL0082CAn error has occurred which has terminated processing.
SQL0092NNo package was created because of previous errors.
SQL0091NBinding was ended with "3" errors and "0" warnings.
The table file is locked and cannot be used any more;
When the stop operation is performed, the following error occurs: db2stop.
8/03/2005 0 SQL1025NThe database manager was not stopped because databases are still active.
SQL1025NThe database manager was not stopped because databases are still active.
Run the following command to solve the problem: db2stop force
08/03/2005 21:47:49 0 0 SQL1064NDB2STOP processing was successful.
SQL1064NDB2STOP processing was successful.
Start the database db2start, connect to the database db2s, and re-run the bind.
8. Modify the buffer pool parameters:
Db2 alter bufferpool ibmdefaultbp size 10240
View the data in this table as follows: db2 "select * from syscat. bufferpools ";
9. DB2 log processing:
DB2 logs are stored in the file system in the form of files. There are two modes: cyclic logs and archive logs. When creating a new database, the default log mode is circular log. In this mode, you can only back up and restore the database offline. To implement online backup and recovery, you must set the log archiving mode.
Currently, the archive log mode is set in the integrated business system. Other systems, such as post-event monitoring, business decision-making, and intermediate business, are generally set to the circular log mode. As for the mode used, you can modify the Database Configuration Parameter LOGRETAIN) to achieve: archive log mode: db2 update db cfg for using logretain on note: After changing to on, when you view the value of the Database Configuration Parameter logretain, the recovery is displayed. After this parameter is changed, connecting to the database again will display the database in the backup pending status. In this case, you need to back up db2 backup db offline for the database) to make the database status normal.
Cyclic log mode: db2 update db cfg for using logretain off
10. Db2 log processing
Follow these steps:
The DB2 command PRUNE must be used for cleanup. We do not recommend that you use the rm command to delete it.
Before deleting an application, make sure that the application has been stopped (online ).
View the currently used log file directory and the first active Log File
Run the "db2 get db cfg for" command to view the Path to log files in the log file directory. For example, Path to log files =/db2log/indicates that the DB2 log storage directory is/db2log.
Run the "db2 get db cfg for" command to view the First active log file) parameter. All log files before the log file corresponding to this parameter are archived log files, can be deleted. For example, First active log file = S0015913.LOG indicates that the current First active log file is S0015913.LOG.