背景说明环境介绍系统配置
扩容 / 空间配置内存交换分区挂载 /oradata 盘
背景说明环境介绍临近下班时刻,客户笑嘻嘻的对我说:小陈,帮我装个数据库软件哈,下班前搞定哦…
我心想,这有啥难的,一下就搞定了!结果,是我大意了…
| 参数 | 值 |
|---|---|
| 操作系统 | rhel 7.6 |
| 数据库版本 | 11.2.0.4 |
| 服务器配置 | 8C 16G 10G |
系统配置 扩容 / 空间小伙伴们看出问题了没有?
服务器的总空间大小只有10G?并且内存交换分区也没有配置…
没办法,只能找客户说明情况,结果…
行吧,逃不过,还是要苦逼的工程师去做配置…
客户在运维平台上将 / 空间扩大到了100G,后续的处理工作如下:
# 磁盘分区
fdisk /dev/sda
Command (m for help): p
Command (m for help): n
Partition type:
p primary (0 primary, 0 extended, 4 free)
e extended
Select (default p):
Using default response p
Partition number (1-4, default 1):
First sector (20971519-209715153, default 20971519):
Using default value 20971519
Last sector, +sectors or +size{K,M,G} (20971519-209715153, default 67108863):
Using default value 67108863
Partition 1 of type Linux and of size 89 GiB is set
Command (m for help): t
Selected partition 1
Hex code (type L to list all codes): 8e
Changed type of partition 'Empty' to 'Linux LVM'
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
# 重启机器生效分区
reboot
# 扩容 / 空间
[root@dxgx_db ~]# pvcreate /dev/sda3
Physical volume "/dev/sda3" successfully created.
[root@dxgx_db ~]#
[root@dxgx_db ~]# vgs
VG #PV #LV #SN Attr VSize VFree
rhel 1 2 0 wz--n- <15.00g 0
[root@dxgx_db ~]#
[root@dxgx_db ~]# vgextend rhel /dev/sda3
Volume group "rhel" successfully extended
[root@dxgx_db ~]#
[root@dxgx_db ~]# vgs
VG #PV #LV #SN Attr VSize VFree
rhel 2 2 0 wz--n- 98.99g <84.00g
[root@dxgx_db ~]#
[root@dxgx_db ~]# lvs
LV VG Attr LSize Pool Origin Data% meta% Move Log Cpy%Sync Convert
root rhel -wi-ao---- 10.00g
var rhel -wi-ao---- <5.00g
[root@dxgx_db ~]#
[root@dxgx_db ~]# lvresize -L +83G /dev/mapper/rhel-root
Size of logical volume rhel/root changed from 10.00 GiB (2560 extents) to 93.00 GiB (23808 extents).
Logical volume rhel/root successfully resized.
[root@dxgx_db ~]#
[root@dxgx_db ~]# xfs_growfs /dev/mapper/rhel-root
meta-data=/dev/mapper/rhel-root isize=512 agcount=4, agsize=655360 blks
= sectsz=512 attr=2, projid32bit=1
= crc=1 finobt=0 spinodes=0
data = bsize=4096 blocks=2621440, imaxpct=25
= sunit=0 swidth=0 blks
naming =version 2 bsize=4096 ascii-ci=0 ftype=1
log =internal bsize=4096 blocks=2560, version=2
= sectsz=512 sunit=0 blks, lazy-count=1
realtime =none extsz=4096 blocks=0, rtextents=0
data blocks changed from 2621440 to 24379392
[root@dxgx_db ~]#
# 查看扩容情况,成功扩容
[root@dxgx_db ~]# df -Th
Filesystem Type Size Used Avail Use% Mounted on
/dev/mapper/rhel-root xfs 93G 4.2G 89G 5% /
devtmpfs devtmpfs 2.0G 0 2.0G 0% /dev
tmpfs tmpfs 2.0G 0 2.0G 0% /dev/shm
tmpfs tmpfs 2.0G 20M 2.0G 1% /run
tmpfs tmpfs 2.0G 0 2.0G 0% /sys/fs/cgroup
/dev/sda1 xfs 1014M 133M 882M 14% /boot
/dev/mapper/rhel-var xfs 5.0G 716M 4.3G 15% /var
tmpfs tmpfs 394M 0 394M 0% /run/user/0
tmpfs tmpfs 60M 0 60M 0% /var/log/rtlog
配置内存交换分区
由于操作系统模板没有配置内存交换分区,经与客户沟通,添加一块 32G 磁盘用作配置内存交换分区空间使用。
操作步骤如下:
[root@dxgx_db ~]# fdisk /dev/sdc
Command (m for help): p
Command (m for help): n
Partition type:
p primary (0 primary, 0 extended, 4 free)
e extended
Select (default p):
Using default response p
Partition number (1-4, default 1):
First sector (2048-67108863, default 2048):
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-67108863, default 67108863):
Using default value 67108863
Partition 1 of type Linux and of size 32 GiB is set
Command (m for help): t
Selected partition 1
Hex code (type L to list all codes): 82
Changed type of partition 'Empty' to 'Linux swap / Solaris'
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
[root@dxgx_db ~]# partprobe /dev/sdc
[root@dxgx_db ~]#
[root@dxgx_db ~]# mkswap /dev/sdc1
Setting up swapspace version 1, size = 33553404 KiB
no label, UUID=8afade50-5a74-470a-8b20-f91259835add
[root@dxgx_db ~]# cat /etc/fstab
/dev/mapper/rhel-root / xfs defaults 0 0
UUID=1cd47eed-46e1-4b12-bc7c-8e9a9153c8f4 /boot xfs defaults 0 0
/dev/mapper/rhel-var /var xfs defaults 0 0
/dev/sdc1 swap swap defaults 0 0
[root@dxgx_db ~]# swapon /dev/sdc1
[root@dxgx_db ~]#
[root@dxgx_db ~]# free -h
total used free shared buff/cache available
Mem: 15G 465M 15G 19M 233M 15G
Swap: 31G 0B 31G
挂载 /oradata 盘
客户再划了一块 200G 的硬盘作为数据盘,让我挂载…
[root@dxgx_db ~]# fdisk /dev/sdb
Command (m for help): p
Command (m for help): n
Partition type:
p primary (0 primary, 0 extended, 4 free)
e extended
Select (default p):
Using default response p
Partition number (1-4, default 1):
First sector (2048-419430326, default 2048):
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-419430326, default 419430326):
Using default value 419430326
Partition 1 of type Linux and of size 199 GiB is set
Command (m for help): t
Selected partition 1
Hex code (type L to list all codes): 8e
Changed type of partition 'Empty' to 'Linux LVM'
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
# 磁盘文件系统格式化
[root@dxgx_db ~]# mkfs.xfs /dev/sdb1
# 创建挂载点
[root@dxgx_db ~]# mkdir -p /oradata
[root@dxgx_db ~]# chown oracle.oinstall /oradata
[root@dxgx_db ~]# cat /etc/fstab
/dev/mapper/rhel-root / xfs defaults 0 0
UUID=1cd47eed-46e1-4b12-bc7c-8e9a9153c8f4 /boot xfs defaults 0 0
/dev/mapper/rhel-var /var xfs defaults 0 0
/dev/sdb1 /oradata xfs defaults 0 0
/dev/sdc1 swap swap defaults 0 0
[root@dxgx_db ~]# mount -a
[root@dxgx_db ~]# df -Th
Filesystem Type Size Used Avail Use% Mounted on
/dev/mapper/rhel-root xfs 93G 4.2G 89G 5% /
devtmpfs devtmpfs 2.0G 0 2.0G 0% /dev
tmpfs tmpfs 2.0G 0 2.0G 0% /dev/shm
tmpfs tmpfs 2.0G 20M 2.0G 1% /run
tmpfs tmpfs 2.0G 0 2.0G 0% /sys/fs/cgroup
/dev/sda1 xfs 1014M 133M 882M 14% /boot
/dev/mapper/rhel-var xfs 5.0G 716M 4.3G 15% /var
tmpfs tmpfs 394M 0 394M 0% /run/user/0
tmpfs tmpfs 60M 0 60M 0% /var/log/rtlog
/dev/sdb1 xfs 199G 0 199G 0% /oradata
[root@dxgx_db ~]# chown oracle.oinstall /oradata



