The DB2 tutorial being looked at is: DB2 UDB V8.1 Management Learning Notes (iii). Force disconnect an existing connection, stop the instance, and delete.
$ db2idrop-f instance_name
Used to migrate instances under UNIX.
$ DB2IMIGR instance_name
Update the instance to get access to some new product options or revision packages.
$ DB2IUPDT instance_name
Gets the instance that is currently in place.
$ DB2 Get Instance
When you update an instance-level or database-level parameter, some can take effect immediately, and some need to restart the instance to take effect. Immediate explicitly indicates that the change takes effect immediately, deferred explicitly indicates that the change takes effect after the instance has been reset.
When you need to configure many clients to connect to the DB2 server, you can use the Configuration Assistant to export the server's profile and then import the profile using the Configuration assistant on each client. If the client only has a Run-time client installed, you can import the profile using the following command.
$ db2cfimp Access_profile_name
Question: Should the profile be exported by a configured client?
List all database connections
$ DB2 List Applications
Terminates the specified connection handle and the transaction is interrupted and rolled back. Manipulating multiple handles at the same time can be separated by commas or by specifying the keyword all. This command terminates only the specified connection and does not prevent new applications from connecting to the database.
$ DB2 Force application (2)
You can specify the sort method when you create a database:
Collate using identity
System pattern sets are created with each database, and they are placed in the Syscatspace table space.
SYSIBM: Basic system directory, no direct access recommended
Syscat:public is granted the SELECT permission for this mode, cataloging the read-only view, which is the recommended way to get directory information
Sysstat: Updatable catalog views-impact Optimizer
Sysfun: User-defined functions
The constraint cannot be defined if the existing row in the table does not meet the constraint. You can turn off constraint checking to speed up the addition of large amounts of data, but the table is in the check pending (check PENDING) state.
When you create a table, you can use options to specify one or more table spaces where the tables and indexes will be placed:
CREATE TABLE TEST (column 1 definition, column 2 definition, ...) In INDEX in
This command gives you an option to specify where tables and indexes are created. If you do not specify a separate index tablespace, the index is created in the same table space as the table. After you create a table, there is no opportunity to create an index in a different table space. Create an index to plan ahead!
CREATE INDEX on (column 1, column 2 ...)
The unique attribute tells DB2 that the index must enforce the uniqueness of all inserted values.
If the result set is sorted in ascending and descending order, ALLOW REVERSE SCANS tells DB2 to include additional pointers in the index to allow for effective forward and reverse linking in the record.
DB2 can add additional columns to the index being created. The CREATE Index command allows users to specify columns that are not part of the actual index but are kept in the index record for performance reasons.
CREATE UNIQUE INDEX on EMPLOYEE (EMPNO) INCLUDE (lastname,firstname)
For columns contained in an index, the index must be UNIQUE. When you create an index, additional columns are added to the index value. Indexes do not use these values for sorting or determining uniqueness, but they can be used when SQL queries are satisfied. For example, the following SELECT statement will not need to read the actual data rows:
SELECT LASTNAME, FIRSTNAME from EMPLOYEE WHERE EMPNO < ' 000300 '
To create a clustered index on a table, attach 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 a table. The number of indexes depends on the primary purpose of the database:
For an online transaction processing (OLTP) environment, create one to two indexes.
For mixed queries and OLTP environments, create two to five indexes.
For a read-only query environment, create more than five indexes.
In the DB2 command-line mode on the Windows platform, or under the Unix-like platform, use command db2cc to start the control center.
Db2move provides the ability to bulk move data between databases, you can specify a table, or you can specify a table for the entire database.
$ Db2move dbname Action
Action can be specified as: Export, import, or load
Use the-l parameter to specify the folder that the LOB object stores
Performing an incremental backup requires setting the database configuration parameter "Trackmod" with the value "Yes"
Performing an online backup requires setting the database configuration parameter "Logretain" with the value "YES", online backup syntax:
$ DB2 Backup DB dbname online to Path
When the DAS user's home directory is deleted and the DAS service is not dropped first, then the execution of Dasdrop is unsuccessful, prompting:
The Db2admin command could not be found because the Db2admin command was saved in the DAS home directory.
You can remove the clean Das user's home directory and then reboot the server to resolve the issue.
$ DASUPDT dasname upgrade das$ DB2IUPDT Instname Upgrade instance $ DB2LICD End Stop License daemon
After the Linux system installs DB2 V8.1, the DB2FMCD process starts automatically, even if the instance and Das are not started,
Install the DB2 database service in the Chinese Linux environment, and use the GBK code page (codepage) to create a database, after completion of the normal connection operation, if you change the operating system code page for English, use "DB2 Connect" will error, when the connection can not convert code page.
<