Copyright Notice: This article can be reproduced, please be sure to indicate the original source and author information in hyperlink when reprint.
Original source:
http://www.aiview.com/notes/db2_note_2.htm
Author: Zhang Yang Alex_doesAThotmail.com
Last updated: 2004-8-5
table of Contents
Reference resource
The tablespace type is divided into SMS and DMS, which are System Management Space, Database Management Space. SMS is easy, simple, no need to manually create and maintain data storage files. DMS needs to manually specify the filename of Container and store data, and ensure that there is enough disk space available. For a database, there is at least one system temporary table space with 4K, which can additionally create a user-temporary table space with larger Page Size, and the system will be used automatically. Unable to change the data type of a field with an Alter statement, you can change the data length for some fields, which is more than the limit on Oracle and DB2. You can use: SELECT Expression from sysibm.sysdummy; alternative, the following statement is equivalent: VALUES expression; table and view creation, update, delete operation, write log, so you can commit or rollback. In the UPDATE statement, this field does not re-execute the expression defined in the default value if there is no value to default to a field defined by default. In order to re-execute the expression of the default value, the following method can be employed: Create Table T1 (C1 VARCHAR (32), LastUpdateTime with default current TIMPSTAMP); Update T1 set c1 = 'new string', lastupdatetime = default; for DB2 The database can specify the CODEPAGE parameter when creating, and cannot be modified after being created. When the application accesses the database, DB2 will compare whether the CodePage of both is consistent, and inconsistencies, the code page is automatically converted. In order to reduce the overhead brought about by the conversion, the code page used by the application is consistent with the database. You can set up the CodePage of the DB2 CLP tool, use: DB2SET DB2CODEPAGE = 1386, in this example is the value corresponding to the Chinese GBK character set in the Windows platform. Note that this numeric value is defined by DB2. The code page values corresponding to the various character sets in the corresponding platform can be found in the IBM website. In DB2 CLP, actions for remote databases: DB2 catalog tcpip node local_node_name remote hostname | IP server service_name first maps the remote host to a local node, the node name is specified, and this example uses TCPIP connections. Service_name is typically defined in the / etc / service file of the remote host. DB2 Catalog Database DB_NAME AS LOCAL_ALIAS AT LOCAL_NODE_NAME User User_Node_name User User Using Password Then map the database of known remote hosts to the local alias, pay attention to the local alias cannot be repeated at the host level. The node name specifies the node of the above-mentioned college entrance.
DB2 Connect To Local_Alias UserName Unsword Connect to the Alias Connection Remote Host Database DB2 Get Configuration Show Detail by the Alias Get Configured Database Database Database Details Configure the error number returned to DB2, you can use the following method to view the instructions (take SQL 10008 as an example): DB2? SQL10008 database backup and recovery: Using Backup and Recovery Tools to complete the work of different servers see the full transfer database, the command line is as follows: Backup DB2 Backup Database DB_NAME USER USER_NAME DB2WORD To Backup_Dir_name DB2 Backup Database DLHDB User DLH USING admindlh tO d: / backups restore DB2 rESTORE DATABASE source_db_name USER user_name USING password FROM backup_dir_name TAKEN AT backup_file_create_time tO driver_letter INTO new_db_name DB2 rESTORE DATABASE dlhdb USER dlh USING admindlh FROM d: / backups TAKEN AT 20031209141056 tO d: operation INTO newdb For example : Setting the default instance environment variable DB2 set db2instance = inst_name Start Current Instance DB2Start Stop Current Instance DB2Stop [Force] Connection to a DB2 Attach TO Anstance Inst_name DB2 Get DBM CFG Show Detail Export Database Complete Definition to Script Documents, including table, view, function, database parameters, etc. DB2LOOK -D SAMPLE (Database) -A -E -L -X -M -F -F-O (parameter) SampleSql.out (output file) Load a table data, It is possible to cause the table space to be in the backup pending (0x0020) state. For example, in the field of shaping data load to Double type. Table space in the Backup Pending state cannot be accessed. You can return to the normal state (0x0) by running a Backup operation on this table space. For self-increasing fields, it can be specified in two ways: generated by default as identity generated always as identity difference is that the first mode allows manually specifying the value of the self-adding field when inserting data, as long as it is not repeated, and the database will Automatically set the next value; the second method is not allowed to be specified, and can only be automatically assigned and inserted by the database. DB2 SQL statement use: Select * from T1 WHERE A LIKE '% ABC /% DEF' Escape '/' When the File type, the back long-Num parameter is not correct, such as 25600 represents 256MB, but if specified 256 will cause the above error.
Platform RH Linux 8 DB2 UDB V8.1 creates data source to DB2 in WAS 5, but the connection fails, returns the following error: [servlet error] - [SQLConnect]: java.lang.unsatisfiedlinkerror: SqlConnect reasons are not running WAS Serving users set the following environment variables: LD_Library_Path LibPath DB2Instance ... The above environment variables are defined in the $ INSTHOME / SQLLIB / DB2PROFILE file, the solutions you can use: SH Stopserver.sh ServerName. $ INSTHOME / SQLLIB / DB2PROFILE STARTSERVER.SH ServerName can also put DB2Profile first executed in the WAS boot script. If only ld_library_path, libpath is set, DB2 returns the following error: CLI0600E INVALID Connection Handle or Connection Is Closed. SQLState S1000 corresponds to Oracle's JOB package function, DB2 is implemented through a GUI tool-task center (Task Center) . You need to make the necessary tool settings before using the task center, you need to create some database objects, you can create a database in an existing database or you can create a database separately. Implement: CREATE CATALOG Tools Schema_name CREATE New Database DB_NAME This command creates a database named DB_NAME and specifies a model name. Note: You cannot specify a CODESET with the USING clause, and the system will use the ISO8859-1 character set by default. Quest Center for DB2 With database performance diagnostics, dynamic monitoring DB memory, disk IO, tablespace, load, etc. Type of DB2 Client: DB2 Runtime Client DB2 Runtime Client DB2 Manage Client DB2 Administrator Client (All Contents with Runtime Client) DB2 Application Development Client DB2 Application Development Client (including all content of the management client) DB2 thin customers DB2 Thin Client DB2 Relational Connect Federal Database for connecting the heterogeneous database. Reference resource
Learning Note - DB2 UDB V8.1 Management Learning Notes (1) Learning Notes - DB2 UDB V8.1 Management Learning Notes (3) IBM DB2 Developer Garden http://www-900.ibm.com/developerWorks/cn/dmdd /certify/index.shtml IBM DB2 Information Center http://publib.boulder.ibm.com/infocenter/db2help/index.jsp DBFORUMS Forum http://dbforums.com/ "DB2 UDB V8.1 for Linux, UNIX, Windows Database Management "George Baklarz, Bill Wong, Machinery Industry Press" DB2 Database Management and Application Tutorial "Zhuang Jicheng, Tsinghua University Press Publishing