用裸设备扩数据库表空间专题
欢迎进入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
卷组创建好后,重复前面的步骤即可完成。

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

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

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics





MySQL is an open source relational database management system, mainly used to store and retrieve data quickly and reliably. Its working principle includes client requests, query resolution, execution of queries and return results. Examples of usage include creating tables, inserting and querying data, and advanced features such as JOIN operations. Common errors involve SQL syntax, data types, and permissions, and optimization suggestions include the use of indexes, optimized queries, and partitioning of tables.

Solutions to Oracle cannot be opened include: 1. Start the database service; 2. Start the listener; 3. Check port conflicts; 4. Set environment variables correctly; 5. Make sure the firewall or antivirus software does not block the connection; 6. Check whether the server is closed; 7. Use RMAN to recover corrupt files; 8. Check whether the TNS service name is correct; 9. Check network connection; 10. Reinstall Oracle software.

MySQL is chosen for its performance, reliability, ease of use, and community support. 1.MySQL provides efficient data storage and retrieval functions, supporting multiple data types and advanced query operations. 2. Adopt client-server architecture and multiple storage engines to support transaction and query optimization. 3. Easy to use, supports a variety of operating systems and programming languages. 4. Have strong community support and provide rich resources and solutions.

The method to solve the Oracle cursor closure problem includes: explicitly closing the cursor using the CLOSE statement. Declare the cursor in the FOR UPDATE clause so that it automatically closes after the scope is ended. Declare the cursor in the USING clause so that it automatically closes when the associated PL/SQL variable is closed. Use exception handling to ensure that the cursor is closed in any exception situation. Use the connection pool to automatically close the cursor. Disable automatic submission and delay cursor closing.

In Oracle, the FOR LOOP loop can create cursors dynamically. The steps are: 1. Define the cursor type; 2. Create the loop; 3. Create the cursor dynamically; 4. Execute the cursor; 5. Close the cursor. Example: A cursor can be created cycle-by-circuit to display the names and salaries of the top 10 employees.

To stop an Oracle database, perform the following steps: 1. Connect to the database; 2. Shutdown immediately; 3. Shutdown abort completely.

SQL statements can be created and executed based on runtime input by using Oracle's dynamic SQL. The steps include: preparing an empty string variable to store dynamically generated SQL statements. Use the EXECUTE IMMEDIATE or PREPARE statement to compile and execute dynamic SQL statements. Use bind variable to pass user input or other dynamic values to dynamic SQL. Use EXECUTE IMMEDIATE or EXECUTE to execute dynamic SQL statements.

Building a Hadoop Distributed File System (HDFS) on a CentOS system requires multiple steps. This article provides a brief configuration guide. 1. Prepare to install JDK in the early stage: Install JavaDevelopmentKit (JDK) on all nodes, and the version must be compatible with Hadoop. The installation package can be downloaded from the Oracle official website. Environment variable configuration: Edit /etc/profile file, set Java and Hadoop environment variables, so that the system can find the installation path of JDK and Hadoop. 2. Security configuration: SSH password-free login to generate SSH key: Use the ssh-keygen command on each node
