DBA做了系统工程师的事?
背景说明
环境介绍
参数 | 值 |
---|---|
操作系统 | rhel 7.6 |
数据库版本 | 11.2.0.4 |
服务器配置 | 8C 16G 10G |
系统配置
扩容 / 空间
# 磁盘分区
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
配置内存交换分区
[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 盘
[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