DB2 UDB V8.1 management learning notes (2)

Source: Internet
Author: User
Tags db2 client db2 connect db2 connect to

The db2 tutorial is: DB2 UDB V8.1 management learning notes (2 ). Table space types include SMS and DMS, which are system management space and database management space. SMS, which are easy to use and simple without manual creation and maintenance of data storage files. DMS needs to manually specify the container and data storage file names, and ensure that there is sufficient disk space available.
For a database, at least one temporary table space with a page size of 4 K exists. You can create a temporary table space with a larger page size. The system will automatically use it.
You cannot use the alter statement to change the data type of a field. You can change the data length of some fields. This is more restrictive than Oracle.
You can use the select expression from sysibm. sysdummy;. The following statements are equivalent: values expression;
You can write logs for creating, updating, and deleting tables and views. Therefore, you can use commit or rollback.
In the update statement, if no value is explicitly assigned to a field that defines the default value, the expression defined in the default value is not re-executed when the field is updated. To re-execute the default expression, you can use the following method:
Create table t1 (c1 varchar (32), lastupdatetime with default current timpstamp); update t1 set c1 = 'new string', lastupdatetime = default;
You can specify the codepage parameter when creating a DB2 database, which cannot be modified after creation. When the application accesses the database, DB2 will compare the codepages of the two, and perform automatic conversion of the code page if they are inconsistent. To reduce the overhead of the conversion, we should try to ensure that the code page used by the application is consistent with that used by the database.
You can set the codepage of the DB2 CLP tool, using:
$ Db2set DB2CODEPAGE = 1386
In this example, set the value of the Chinese GBK character set on Windows. Note that this numeric value is defined by DB2 itself. You can find the code page values of various character sets on the corresponding platform on the IBM website.
In DB2 CLP, for remote database Cataloguing Operations, the remote host is mapped to a local node, and the node name is specified by yourself. In this example, TCPIP is used for connection. Service_name is generally defined in the/etc/services file of the remote host.
$ Db2 catalog tcpip node local_node_name REMOTE hostname | ip SERVER service_name
Map the database of the known remote host to the local alias. Note that the local alias cannot be repeated at the host level. The node name specifies the node that has just been catalogued.
$ Db2 catalog database db_name AS local_alias AT local_node_name USER username USING password
Now you can connect to the remote host database using the alias defined in the catalog.
$ Db2 connect to local_alias USER username USING password
Obtain detailed database configuration information
$ Db2 GET CONFIGURATION SHOW DETAIL
For errors returned by DB2, refer to the instructions in the following method (using SQL 10008 as an example ):
$ Db2? Sql10008
Database backup and recovery:
The backup and recovery tools can be used to complete database transfer on different servers. The command line is as follows:
Backup
$ Db2 backup database db_name USER user_name USING password 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 your taken at least TO driver_letter INTO new_db_name $ db2 restore database dlhdb USER dlh USING admindlh FROM d: \ backups taken at 20031209141056 TO d: INTO newdb
Instance operations:
Set Default instance Environment Variables
$ Db2 SET DB2INSTANCE = inst_name
Start the current instance
$ Db2start
Stop current instance
$ Db2stop [force]
Connect to an instance
$ Db2 attach to anstance inst_name
Obtain instance configuration parameters
$ Db2 GET DBM CFG SHOW DETAIL
Export the complete database definition to a script file, including tables, views, functions, and database parameters.
$ Db2look-d sample (database)-a-e-l-x-m-f-o (parameter) samplesql. out (output file)
When loading data from a table, the tablespace may be in the backup pending (0x0020) state. For example, load the integer data to a double field.
Tablespaces in the backup pending status cannot be accessed.
You can run a backup operation on the tablespace to restore it to normal (0x0 ).
For auto-increment fields, you can specify them in two ways:
Generated by default as identitygenerated always as identity
The difference is that the first method allows you to manually specify the value of the auto-increment 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. It can only be automatically allocated and inserted by the database.
DB2 SQL statement escape:
Select * from t1 where a like '% abc \ % def 'escape '\';
The sql1_3c error occurs when you create a database. Possible problems:
The disk space of the specified container is insufficient,
If the container is of the file type, the long-num parameter is incorrect. For example, 25600 indicates 256 Mb. If 256 is specified, the preceding error is returned.
Platform RH Linux 8
DB2 UDB v8.1
The following error is returned if the data source to db2 is created in WAS 5 but the connection fails:
[Servlet Error]-[SQLConnect]: java. lang. UnsatisfiedLinkError: SQLConnect
The reason is no

[1] [2] Next page

The db2 tutorial is: DB2 UDB V8.1 management learning notes (2 ). Set the following environment variables for the user running the was service:
D_LIBRARY_PATHLIBPATHDB2INSTANCE...
The preceding environment variables are defined in the $ INSTHOME/sqllib/db2profile file. The following solutions are available:
$ Sh stopServer. sh servername $. $ INSTHOME/sqllib/db2profile $ sh startServer. sh servername
You can also put db2profile in the was STARTUP script and execute it first.
If only two environment variables LD_LIBRARY_PATH and LIBPATH are set, DB2 returns the following error:
CLI0600E Invalid connection handle or connection is closed. SQLSTATE S1000
Corresponding to the Oracle Job Package function, DB2 uses a GUI tool-task center. Before using the task center, you need to set necessary tools. You need to create some database objects. You can create them in an existing database or a separate database. Run the following command:
Create catalog tools schema_name create new database db_name
This command creates a database named db_name for the cataloguing tool and specifies a schema name.
Note: A codeset cannot be specified with the using clause, and the ISO8859-1 character set is used by default.
The Quest Center for DB2 provides database performance diagnostics, dynamic monitoring of db memory, disk io, tablespace, and load.
DB2 client type:
DB2 Runtime Client DB2 Runtime Client
DB2 management Client DB2 Administrator Client (including all the content of the runtime Client)
DB2 Application Development Client (including all contents of the management Client)
DB2 Thin Client DB2 Thin Client
DB2 Relational Connect federated database, used to Connect to heterogeneous databases.

Previous Page [1] [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.