Using Bare devices as table space containers in DB2

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

Using a bare device as a container in DB2 requires three steps: 1. Create the LV. 2. Binding LV and Bare devices 3. Create a table space

1. Create the LV

[Email protected]:~# vgdisplay <-View available volume Group

[Email protected]:~# 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

[Email protected]:~# lvcreate-l 200m-n TESTLV mainvg <--Create LV

Logical volume "TESTLV" created

[Email protected]:~# ls-l/DEV/MAINVG/TESTLV

lrwxrwxrwx 1 root root 7 Oct-02:28/DEV/MAINVG/TESTLV. /dm-3

[Email protected]:~# ls-l/dev/dm-3

BRW-RW----1 root disk 252, 3 Oct 02:28/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 the bare device raw3 and bind to the LV

[Email protected]:~# modprobe Raw

[Email protected]:~# mknod/dev/raw/raw3 C 162 3

[Email protected]:~# RAW/DEV/RAW/RAW3/DEV/MAINVG/TESTLV

/dev/raw/raw3:bound to Major 252, minor 3

[Email protected]:~# chown QINGSONG:QINGSONG/DEV/RAW/RAW3

[Email protected]:~# ls-l/DEV/RAW/RAW3

CRW-RW----1 Qingsong qingsong 162, 3 Oct 02:32/DEV/RAW/RAW3

3. Switch to the instance user, start the database, and create the table space, using the bare device that you just created.

[Email protected]:~$ Db2start

SQL1063N Db2start processing was successful.

[Email protected]:~$ DB2 Connect to Qsmiao

Database Connection Information

Database Server = db2/linuxx8664 10.5.4

SQL Authorization ID = Qingsong

Local Database alias = Qsmiao

[Email protected]:~$ DB2 "Create Tablespace Lvtbs managed by database using (device '/DEV/RAW/RAW3 ' 300)"

db20000i the SQL command completed successfully.

However, after restarting the machine, the created bare device/dev/raw/raw3 will disappear, there is no workaround, an alternative is to automatically create a boot once, add the following 4 lines into the/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

Reference:

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

Welcome to Criticize

Using Bare devices as table space containers in DB2

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.