The db2 tutorial is: DB2 UDB V8.1 management learning notes (3 ). Force disconnect an existing connection, stop the instance, and delete it.
$ Db2idrop-f instance_name
Migrate instances in UNIX.
$ Db2imigr instance_name
Update an instance to obtain access to some new product options or revision packages.
$ Db2iupdt instance_name
Obtain the current instance.
$ Db2 get instance
When you update instance-level or database-level parameters, some can take effect immediately, and some can take effect only after you restart the instance. Immediate explicitly indicates that the change takes effect immediately, and deferred explicitly indicates that the change takes effect after the instance is restarted.
When you need to configure connections between many clients and the DB2 server, you can use the configuration assistant to export the server's profile and then use the configuration assistant on each client to import the profile. If the client only installs the runtime client, you can use the following command to import the profile.
$ Db2cfimp access_profile_name
Q: Should I export the profile from a configured client?
List all database connections
$ Db2 list applications
Terminate the specified connection handle. The transaction is interrupted and rolled back. You can separate multiple handles with commas (,) or specify the keyword "all. This command only terminates the specified connection and does not prevent new applications from connecting to the database.
$ Db2 force application (2)
You can specify the sorting method when creating a database:
Collate using identity
The system mode set is created with each database and placed in the SYSCATSPACE tablespace.
SYSIBM: Basic System directory. Direct access is not recommended.
SYSCAT: PUBLIC is granted the SELECT permission for this mode. This is a recommended method for obtaining directory information for read-only view cataloguing.
SYSSTAT: updatable directory view-impact Optimizer
SYSFUN: User-Defined Function
If the existing row in the table does not meet the constraint, the constraint cannot be defined. You can disable the constraints CHECK to accelerate the addition of a large amount of data, but the table is in the check pending status.
When creating a table, you can use the options to specify one or more tablespaces. The tables and indexes will be placed in the table:
Create table test (column 1 definition, column 2 definition,...) IN INDEX IN
This command provides an option for you to specify the location for creating tables and indexes. If no independent index tablespace is specified, an index is created in the same tablespace where the table is located. After a table is created, there is no chance to create indexes in different tablespaces. Creating indexes should be planned in advance!
Create index on (column 1, column 2 ...)
The UNIQUE attribute tells DB2 that the index must force the uniqueness of all inserted values.
If the result set is sorted in ascending or descending order, allow reverse scans will tell DB2 to include additional pointers in the index, to allow valid forward and reverse links in the record.
DB2 can add additional columns to the index being created. The create index command allows you to specify columns that are not actually indexed but saved in the INDEX record for performance reasons.
Create unique index on employee (EMPNO) INCLUDE (LASTNAME, FIRSTNAME)
For the columns contained in the index, the index must be UNIQUE. When an index is created, other columns are added to the index value. Indexes do not use these values for sorting or uniqueness determination, but they can be used when SQL queries are met. For example, the following SELECT statement does not need to read the actual data rows:
Select lastname, firstname from employee where empno <'201312'
To CREATE a cluster index on a table, append the CLUSTER keyword to the end of the create index Command. For example:
Create index DEPTS-IX on employee (WORKDEPT) CLUSTER
Use the following general rules to determine the classic number of indexes defined for the table. The number of indexes depends on the main purpose of the database:
Create one or two indexes for the online transaction processing (OLTP) environment.
Create two to five indexes for hybrid queries and OLTP environments.
In the read-only query environment, more than five indexes are created.
In the command line mode of DB2 on Windows or Unix-like platforms, run the command db2cc to start the control center.
Db2move provides the ability to move data in batches between databases. You can specify a table or the entire database table.
$ Db2move dbname action
Action can be specified as: export, import or load
Use the-l parameter to specify the lob Object Storage folder
To perform Incremental backup, set the Database Configuration Parameter "trackmod" to "YES"
To perform online backup, you must set the value of the Database Configuration Parameter "logretain" to "YES". The online backup syntax is as follows:
$ Db2 backup db dbname online to path
If the home Directory of the das user is deleted and the das service is not dropped first, then the dasdrop operation fails. The prompt is:
The db2admin command cannot be found because the db2admin command is saved in the home directory of the das.
You can delete the home Directory of the das user and restart the server to solve this problem.
$ Dasupdt dasName upgrade das $ db2iupdt instName upgrade instance $ db2licd end stop the license daemon process
After DB2 V8.1 is installed in Linux, The db2fmcd process is automatically started, even if the instance and DAS are not started,
The DB2 database service is installed in a Chinese Linux environment, and a database is created using the GBK code page (codepage). After the database is installed, the database can be connected normally. If the operating system code page is changed to English, when "db2 connect" is used, an error is reported, and the code page cannot be converted during connection.
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.