Using bare devices as tablespace containers in DB2, db2 containers

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

Using bare devices as tablespace containers in DB2, db2 containers

Using bare devices as containers in DB2 requires three steps: 1. Creating LV. 2. Bind the LV and bare devices. 3. Create a tablespace.

 

1. Create an lv

Root @ ubuntu :~ # Vgdisplay <-view available Volume groups

Root @ ubuntu :~ # Vgdisplay

--- Volume group ---

VG Name mainVG

System ID

Format lvm2

Metadata Areas 1

Metadata Sequence No 4

VG Access read/write

VG Status resizable

Max lv 0

Cur LV 3

Open LV 1

Max PV 0

Cur PV 1

Act PV 1

VG Size 2.00 GiB

PE Size 4.00 MiB

Total PE 511

Alloc PE/Size 125/500 .00 MiB

Free PE/Size 386/1 .51 GiB

Vg uuid b15u8R-Kt91-Tgfe-2RX8-buKP-dfU9-Uw5a2J

 

Root @ ubuntu :~ # Lvcreate-L 200 M-n testlv mainVG <-- create lv

Logical volume "testlv" created

Root @ ubuntu :~ # Ls-l/dev/mainVG/testlv

Lrwxrwxrwx 1 root 7 Oct 31/dev/mainVG/testlv-> ../dm-3

Root @ ubuntu :~ # Ls-l/dev/dm-3

Brw-rw ---- 1 root disk 252, 3 Oct 31/dev/dm-3

You can see that the newly created lv is just a symbolic link pointing to the block device dm-3

 

2. Create a bare device raw3 and bind it to the lv

Root @ ubuntu :~ # Modprobe raw

Root @ ubuntu :~ # Mknod/dev/raw/raw3 c 162 3

Root @ ubuntu :~ # Raw/dev/raw/raw3/dev/mainVG/testlv

/Dev/raw/raw3: bound to major 252, minor 3

Root @ ubuntu :~ # Chown qingsong: qingsong/dev/raw/raw3

Root @ ubuntu :~ # Ls-l/dev/raw/raw3

Crw-rw ---- 1 qingsong 162, 3 Oct 31/dev/raw/raw3

 

3. Switch to the instance user, start the database, and create the tablespace. The container uses the created bare device.

Qingsong @ ubuntu :~ $ Db2start

SQL1063N DB2START processing was successful.

 

Qingsong @ ubuntu :~ $ Db2 connect to qsmiao

 

Database Connection Information

 

Database server = DB2/LINUXX8664 10.5.4

SQL authorization ID = QINGSONG

Local database alias = QSMIAO

 

Qingsong @ ubuntu :~ $ Db2 "create tablespace lvtbs managed by database using (device '/dev/raw/raw3' 300 )"

DB20000I The SQL command completed successfully.

 

 

However, after the machine is restarted, the created bare device/dev/raw/raw3 disappears and no solution is found. An alternative solution is to automatically create the device once it is started, add the following four rows to/etc/rc. local

 

Modprobe raw

Mknod/dev/raw/raw3 c 162 3

Raw/dev/raw/raw3/dev/mainVG/thirdlv

Chown qingsong: qingsong/dev/raw/raw3

 

 

Test environment:

Ubuntu 14.04

DB2 10.5.4

 

Refer:

Http://www.informix-zone.com/node/38#fromlog

Comments and corrections


How to view the background processes of DB2? How to check the bare device allocated by the system to the database

1. unix/linux ls-al | grep db2
2. if the name of the lv cannot be seen ...... Connect to the database, and then check the table space container ......

How can I expand a tablespace by using a bare device for my tablespace,

There is no big difference between creating a tablespace using a bare device and creating a tablespace using a common file system, but changing the data file name to the bare partition name. To create a tablespace on a bare device, Oracle must first format the tablespace. This process is slower than formatting on the file system. It takes a while. The size of the data file must be smaller than that of the bare device. Therefore, you must set aside some space for managing the bare device.

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.