search
HomeDatabaseMysql Tutorial用裸设备扩数据库表空间专题

欢迎进入Oracle社区论坛,与200万技术人员互动交流 >>进入 硬件环境:小型机 IBMP670,存储:IBM SHARKF-20 软件环境:操作系统 AIX5.1 数据库oracle9i 主题思想:物理卷PV-;卷组VG-;逻辑卷LV(类型:raw)-;添加表空间 操作过程: 一、 首先 #lsvg ? o

欢迎进入Oracle社区论坛,与200万技术人员互动交流 >>进入

硬件环境:小型机 IBM  P670,存储:IBM SHARK  F-20
软件环境:操作系统 AIX5.1   数据库oracle9i
主题思想:物理卷PV->;卷组VG->;逻辑卷LV(类型:raw)->;添加表空间
操作过程:
一、        首先 #lsvg ? o   //查看所有可用卷组
datavg03
datavg02
datavg01
datavg00
rootvg
二、        然后对用来专为数据库准备的卷组进行如下操作:
#lsvg ?l datavg03
datavg09:
LV NAME             TYPE       LPs   PPs   PVs  LV STATE      MOUNT POINT
lvdata0316          raw        64    64    1    open/syncd    N/A
lvdata0317          raw        64    64    1    open/syncd    N/A
lvdata0318          raw        64    64    1    closed/syncd  N/A
lvdata0319          raw        64    64    1    closed/syncd  N/A
lvdata0320          raw        64    64    1    closed/syncd  N/A
lvdata0321          raw        64    64    1    closed/syncd  N/A
lvdata0322          raw        64    64    1    closed/syncd  N/A
lvdata0323          raw        64    64    1    closed/syncd  N/A
lvdata0324          raw        64    64    1    closed/syncd N/A
lvdata0325          raw        64    64    1    closed/syncd  N/A
lvdata0326          raw        64    64    1    closed/syncd  N/A
lvdata0327          raw        64    64    1    closed/syncd  N/A
lvdata0328          raw        64    64    1    closed/syncd N/A
lvdata0329          raw        64    64    1    closed/syncd N/A
lvdata0330          raw        64    64    1    closed/syncd  N/A
由显示可知:该卷组还有13个逻辑卷(裸设备)未被使用(如果在显示结果中没有closed/syncd状态的逻辑卷,可进入第3步)但如何知道这13个逻辑卷有多大容量呢,可以机使用如下命令:
#lslv lvdata0315
LOGICAL VOLUME:     lvdata0309             VOLUME GROUP:   datavg09
LV IDENTIFIER:      0037de1d00004c0000000105cd3b6816.11 PERMISSION:     read/write
VG STATE:           active/complete        LV STATE:       opened/syncd
TYPE:               raw                    WRITE VERIFY:   off
MAX LPs:            512                    PP SIZE:        64 megabyte(s)
COPIES:             1                      SCHED POLICY:   parallel
LPs:                64                     PPs:            64
STALE PPs:          0                      BB POLICY:      relocatable
INTER-POLICY:       minimum                RELOCATABLE:    yes
INTRA-POLICY:       middle                 UPPER BOUND:    32
MOUNT POINT:        N/A                    LABEL:          None
MIRROR WRITE CONSISTENCY: on/ACTIVE
EACH LP COPY ON A SEPARATE PV ?: yes
可看到物理分区大小为64M,由于在同一卷组当中,所以可以知道所有物理分区大小都是64M,从lsvg - l datavg09 的显示结果可看到,PPs:LPs=1:1所以,每个逻辑卷的大小是:LPs×PP SIZE=64*64M=4096M=4G,进而可知还有13个4G的逻辑卷,未被使用。
但到此还不能完全保证就可以使用这13个逻辑卷对数据库的表空间进行扩充,因为我们还不知到这些裸设备的属主,所以还需要如下步骤:
#cd /dev
# ls ?l  rlvdata03*  //显示以rlvdata03开头的文件属性
crw-rw----   1 oracle   dba          58, 20 Aug 22 11:33 rlvdata0318
crw-rw----   1 oracle   dba          58, 21 Aug 22 11:35 rlvdata0319
crw-rw----   1 oracle   dba          58, 22 Aug 22 11:37 rlvdata0320
crw-rw----   1 oracle   dba          58, 23 Aug 22 12:35 rlvdata0321
crw-rw----   1 oracle   dba          58, 24 Aug 22 12:37 rlvdata0322
crw-rw----   1 oracle   dba          58, 25 Aug 22 12:39 rlvdata0323
crw-rw----   1 oracle   dba          58, 26 Aug 22 12:39 rlvdata0324
crw-rw----   1 oracle   dba          58, 27 Aug 19 16:14 rlvdata0325
从查询结果可知,裸设备的属主已经是oracle了,oracle可以添加这些裸设备了,但如果裸设备的属主不是oracle而是其他用户,那么需要
#chown oracle:dab rlvdata03*   //要根据实际情况修改,千万小心
三、添加表空间

   我们可以登录数据库了,使用有创建或修改表空间权限的用户登录数据库(有多种方法),我们以sqlplus为例:
    #su - oracle
    $ sqlplus /nolog

SQL*Plus: Release 9.2.0.5.0 - Production on Mon Aug 22 12:49:55 2005

Copyright (c) 1982, 2002, Oracle Corporation.  All rights reserved.

SQL>;conn /as sysdba
Connected.
SQL>;alter tablespace ts_index add datafile
2        ‘/dev/rlvdata0318’ size 4090;  //size 是4090而不是4096,如果4096全部使用的话,容易出错
SQL>; Tablespace altered
可以反复以上操作,完成其它裸设备的添加,从而达到表空间扩充的目的。
   但是如果以上13个逻辑卷还不能满足扩充需求,那么可以继续以下步骤
四、

#lsvg  datavg09   //查看卷组信息和使用情况,看是否还有足够的空间
     VOLUME GROUP:   datavg09                 VG IDENTIFIER:  0037de1d00004c000000010
5cd3b6816
VG STATE:       active                   PP SIZE:        64 megabyte(s)
VG PERMISSION:  read/write               TOTAL PPs:      2605 (166720 megabytes)
MAX LVs:        256                      FREE PPs:       557 (35648 megabytes)
LVs:            32                       USED PPs:       2048 (131072 megabytes)
OPEN LVs:       16                       QUORUM:         3
TOTAL PVs:      5                        VG DESCRIPTORS: 5
STALE PVs:      0                        STALE PPs:      0
ACTIVE PVs:     5                        AUTO ON:        no
MAX PPs per PV: 1016                     MAX PVs:        32
LTG size:       128 kilobyte(s)          AUTO SYNC:      no
HOT SPARE:      no
显示信息可以看到,该卷组目前还有35648M空间供使用,则可以进行如下操作:
     #mklv -y  ‘lvdata0331’  - t  ‘raw’ datavg09 64  
说明:在卷组datavg09上创建逻辑卷lvdata0331,逻辑卷的类型是raw,逻辑卷的lps是64
逻辑卷大小太大对会影响数据库性能,所以不宜创建过大的裸设备。
然后进行前面的‘三’节
    但是如果当前所有的卷组都已使用完,没有可以用来添加裸设备的卷组,那么还要,创建卷组。
五、创建卷组

在创建之前,我们首先看一下有没有可用的物理卷
    #lspv
vpath53         000b273dbe31ff50                    datavg03
vpath54         000b273dbe320138                    datavg03
vpath55         000b273dbe320303                    datavg03
vpath56         000b273dbe320795                    None
vpath57         000b273dbe320a46                    None
vpath58         000b273dbe320c29                    None
可以看到vpath56、vpath57、vpath58、还没有备卷组使用。由于当前环境的存储提供是磁盘阵列,所以vpath 是在阵列上指定了大小的,在小型机系统认到的所谓的“物理卷”(其实真正的物理卷,应该是
hdisk)。
# mkvg -f -y'datavg04' -s'64' '-n' vpath56 vpath57 vpath58
说明:用 vpath56 vpath57 vpath58 创建卷组datavg04,并且物理分区大小是64M
卷组创建好后,重复前面的步骤即可完成。

用裸设备扩数据库表空间专题

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
How does MySQL's licensing compare to other database systems?How does MySQL's licensing compare to other database systems?Apr 25, 2025 am 12:26 AM

MySQL uses a GPL license. 1) The GPL license allows the free use, modification and distribution of MySQL, but the modified distribution must comply with GPL. 2) Commercial licenses can avoid public modifications and are suitable for commercial applications that require confidentiality.

When would you choose InnoDB over MyISAM, and vice versa?When would you choose InnoDB over MyISAM, and vice versa?Apr 25, 2025 am 12:22 AM

The situations when choosing InnoDB instead of MyISAM include: 1) transaction support, 2) high concurrency environment, 3) high data consistency; conversely, the situation when choosing MyISAM includes: 1) mainly read operations, 2) no transaction support is required. InnoDB is suitable for applications that require high data consistency and transaction processing, such as e-commerce platforms, while MyISAM is suitable for read-intensive and transaction-free applications such as blog systems.

Explain the purpose of foreign keys in MySQL.Explain the purpose of foreign keys in MySQL.Apr 25, 2025 am 12:17 AM

In MySQL, the function of foreign keys is to establish the relationship between tables and ensure the consistency and integrity of the data. Foreign keys maintain the effectiveness of data through reference integrity checks and cascading operations. Pay attention to performance optimization and avoid common errors when using them.

What are the different types of indexes in MySQL?What are the different types of indexes in MySQL?Apr 25, 2025 am 12:12 AM

There are four main index types in MySQL: B-Tree index, hash index, full-text index and spatial index. 1.B-Tree index is suitable for range query, sorting and grouping, and is suitable for creation on the name column of the employees table. 2. Hash index is suitable for equivalent queries and is suitable for creation on the id column of the hash_table table of the MEMORY storage engine. 3. Full text index is used for text search, suitable for creation on the content column of the articles table. 4. Spatial index is used for geospatial query, suitable for creation on geom columns of locations table.

How do you create an index in MySQL?How do you create an index in MySQL?Apr 25, 2025 am 12:06 AM

TocreateanindexinMySQL,usetheCREATEINDEXstatement.1)Forasinglecolumn,use"CREATEINDEXidx_lastnameONemployees(lastname);"2)Foracompositeindex,use"CREATEINDEXidx_nameONemployees(lastname,firstname);"3)Forauniqueindex,use"CREATEU

How does MySQL differ from SQLite?How does MySQL differ from SQLite?Apr 24, 2025 am 12:12 AM

The main difference between MySQL and SQLite is the design concept and usage scenarios: 1. MySQL is suitable for large applications and enterprise-level solutions, supporting high performance and high concurrency; 2. SQLite is suitable for mobile applications and desktop software, lightweight and easy to embed.

What are indexes in MySQL, and how do they improve performance?What are indexes in MySQL, and how do they improve performance?Apr 24, 2025 am 12:09 AM

Indexes in MySQL are an ordered structure of one or more columns in a database table, used to speed up data retrieval. 1) Indexes improve query speed by reducing the amount of scanned data. 2) B-Tree index uses a balanced tree structure, which is suitable for range query and sorting. 3) Use CREATEINDEX statements to create indexes, such as CREATEINDEXidx_customer_idONorders(customer_id). 4) Composite indexes can optimize multi-column queries, such as CREATEINDEXidx_customer_orderONorders(customer_id,order_date). 5) Use EXPLAIN to analyze query plans and avoid

Explain how to use transactions in MySQL to ensure data consistency.Explain how to use transactions in MySQL to ensure data consistency.Apr 24, 2025 am 12:09 AM

Using transactions in MySQL ensures data consistency. 1) Start the transaction through STARTTRANSACTION, and then execute SQL operations and submit it with COMMIT or ROLLBACK. 2) Use SAVEPOINT to set a save point to allow partial rollback. 3) Performance optimization suggestions include shortening transaction time, avoiding large-scale queries and using isolation levels reasonably.

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

PhpStorm Mac version

PhpStorm Mac version

The latest (2018.2.1) professional PHP integrated development tool

Atom editor mac version download

Atom editor mac version download

The most popular open source editor

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools

SecLists

SecLists

SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

EditPlus Chinese cracked version

EditPlus Chinese cracked version

Small size, syntax highlighting, does not support code prompt function