Routine practical operations in DB2 database (1)

Source: Internet
Author: User
Tags id3

The following articles mainly describe the daily practical operations in the DB2 database. I saw the daily practical operations in the DB2 database on the relevant website two days ago. I thought it was good and I would like to share it with you, if you are interested, you can click the following article to view it.

Complete routine practical operations in DB2 database 1)

For DB2 databases, many operations will be used in daily application management. The following describes some operations that you can use and hope to help you with DB2 database operations.

1. Load data:

Export to tempfile of del select * from TABLENAME where not clearing condition;

 
 
  1. 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:

 
 
  1. 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:

 
 
  1. DB2 get 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:

 
 
  1. SQL0082CAn error has occurred which has terminated processing.  
  2. SQL0092NNo package was created because of previous errors.  
  3. 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.

 
 
  1. 8/03/2005 21:46:530 0 SQL1025NThe database manager was not stopped because databases are still active.  
  2. SQL1025NThe database manager was not stopped because databases are still active.  

Run the following command to solve the problem: DB2stop force

 
 
  1. 08/03/2005 21:47:49 0 0 SQL1064NDB2STOP processing was successful.  
  2. SQL1064NDB2STOP processing was successful.  

Start the database DB2start, connect to the database DB2s, and re-run the bind.

8. Modify the buffer pool parameters:

 
 
  1. 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 parameters (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 actually displayed. After this parameter is changed, the database is in the backup pending status when you connect to the database again. In this case, an offline database backup (DB2 backup db) is required 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 is 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 parameters and determine the directory of the log files currently used by the database. 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 parameters of the First active log file. All the log files before the corresponding log files are archived log files, you can delete it if it is confirmed that it is useless. For example, First active log file = S0015913.LOG indicates that the current First active log file is S0015913.LOG.

Back up the archived logs to be deleted

Log on to the Application User (such as BTP) and run:

 
 
  1. $ DB2 connect to  
  2. $ DB2 prune logfile prior to S???????.LOG  

Note: S ???????. LOG is the first activity LOG file. This command can delete all archived log files before the first active log file.

Complete routine practical operations in DB2 database 2)


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.