Install the DB2 database in CentOS

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

Install the DB2 database in CentOS

System: CentOS 6.4x64

Database: DB2-V10.1

Prepare the environment

Vi/etc/hosts # It is best to change the hosts host name to be the same as the computer name.

Reboot

Yum install libaio-devel

Create accounts and user group permissions for installing the DB2 database

Groupadd-g 2010 db2iadm2

Groupadd-g 2011 db2fadm2

Groupadd-g 2012 db2asgrp2

Useradd-m-g db2iadm2-d/home/db2inst2 db2inst2

Useradd-m-g db2fadm2-d/home/db2fenc2 db2fenc2

Useradd-m-g db2asgrp2-d/home/db2as2 db2as2

Set the account password for the DB2 database

Passwd db2inst2

Passwd db2fenc2

Passwd db2as2

Installation Steps

Tar zxvf DB2_ESE_10_Linux_x86-64.tar.gz

Cd ese

./Db2_install

Go to the installation database directory

Cd/opt/ibm/db2/V10.1/instance

Chmod-R 775 *

Create instance db2inst2

./Db2icrt-p 50111-u db2fenc2 db2inst2

Switch to the created user

Sudb2inst2

Start the sample database

Db2start

Create sample Database

Db2sampl

Db2 connect to sample

Succeeded in connecting to DB2 data

Test SQL statements of the Sample Database

Db2 "select * from staff"

###### View all database table commands ####

Db2 "select name fromsysibm. Tables Ables"

Switch to the created user

Su-db2as2

Configure port

Db2 update dbm cfg using SVCENAME 50111

View configuration information

Db2 get dbm cfg | grep SVCENAME

Create a database --------------------------------------------

Su db2inst2

Cd/opt/ibm/db2/V10.1/instance

-- 1. Create a database (encoding must be specified. The GBK territory CN cannot be modified after the encoding is created)

Db2 "create db QYDB_DEV using codesetgbk territory CN"

Dbdb" update db cfg for QYDB_DEV USINGapplheapsz 4096"

Db2 "update db cfg for QYDB_DEV usingapp_ctl_heap_sz1024"

Db2 "update db cfg for QYDB_DEV using+theap 8192"

Db2 "update db cfg for QYDB_DEV USINGdbheap 2400"

Db2 "update db cfg for QYDB_DEV USINGlocklist 1000"

Db2 "update db cfg for QYDB_DEV USINGlogfilsiz 1000"

Db2 "update db cfg for QYDB_DEV USINGlogprimary 12"

Db2 "update db cfg for QYDB_DEV USINGlogsecond 20"

Db2 "update db cfg for QYDB_DEV USINGlogbufsz 32"

Db2 "update db cfg for QYDB_DEV USINGavg_appls 5"

Db2 "update db cfg for QYDB_DEV USINGlocktimeout 30"

Db2start # Start A DB2 database

Online backup command: db2 backup database DBname to/home/db2inst1/backup/compress

View historical backups: db2 list historybackup all for DBname compress

Db2 force application all // forcibly terminate all connections

Db2 terminate // clear all db2 background processes

Db2 stop force // stop the database

Db2 start // restart the database

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.