1、停止Oracle数据库服务,卸载/u01
[root@hlht-test ~]# su - oracle
[oracle@hlht-test ~]$ sqlplus / as sysdba;
SQL*Plus: Release 11.2.0.1.0 Production on Mon Aug 3 18:37:11 2020
Copyright (c) 1982, 2009, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> shutdown immediate;
ORA-01507: database not mounted
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
[oracle@hlht-test ~]$ lsnrctl stop
LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 03-AUG-2020 18:37:47
Copyright (c) 1991, 2009, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
The command completed successfully
[oracle@hlht-test ~]$ exit
logout
[root@hlht-test ~]# umount /u01
2、在线将 MBR分区 转换为 GPT:
[root@hlht-test ~]# gdisk /dev/sdb
GPT fdisk (gdisk) version 0.8.10
Partition table scan:
MBR: MBR only
BSD: not present
APM: not present
GPT: not present
***************************************************************
Found invalid GPT and valid MBR; converting MBR to GPT format
in memory. THIS OPERATION IS POTENTIALLY DESTRUCTIVE! Exit by
typing 'q' if you don't want to convert your MBR partitions
to GPT format!
***************************************************************
Command (? for help): w
Final checks complete. About to write GPT data. THIS WILL OVERWRITE EXISTING
PARTITIONS!!
Do you want to proceed? (Y/N): y
OK; writing new GUID partition table (GPT) to /dev/sdb.
The operation has completed successfully.
3、查看当前分区
[root@hlht-test ~]# parted /dev/sdb u s p
Model: VMware Virtual disk (scsi)
Disk /dev/sdb: 8388608000s
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Number Start End Size File system Name Flags
1 63s 4294961684s 4294961622s ext4 Linux filesystem
4、移除指定分区:
[root@hlht-test ~]# parted /dev/sdb rm 1
Information: You may need to update /etc/fstab.
5、验证分区被移除:
[root@hlht-test ~]# parted /dev/sdb p
Model: VMware Virtual disk (scsi)
Disk /dev/sdb: 4295GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Number Start End Size File system Name Flags
6、将分区扩展到100%
[root@hlht-test ~]# parted -s /dev/sdb mkpart primary 63s 100%
Warning: The resulting partition is not properly aligned for best performance.
[root@hlht-test ~]# parted /dev/sdb p
Model: VMware Virtual disk (scsi)
Disk /dev/sdb: 4295GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Number Start End Size File system Name Flags
1 32.3kB 4295GB 4295GB ext4 primary
[root@hlht-test ~]# parted /dev/sdb u s p
Model: VMware Virtual disk (scsi)
Disk /dev/sdb: 8388608000s
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Number Start End Size File system Name Flags
1 63s 8388607966s 8388607904s ext4 primary
7、检查文件系统
[root@hlht-test ~]# e2fsck /dev/sdb1
e2fsck 1.43-WIP (20-Jun-2013)
/dev/sdb1: clean, 60710/134217728 files, 136226666/536870202 blocks
8、使用resize2fs调整文件系统的大小
[root@hlht-test ~]# resize2fs -f /dev/sdb1
resize2fs 1.43-WIP (20-Jun-2013)
Resizing the filesystem on /dev/sdb1 to 1048575988 (4k) blocks.
The filesystem on /dev/sdb1 is now 1048575988 blocks long.
9. 装载文件系统并验证新大小
[root@hlht-test ~]# mount /dev/sdb1 /u01
[root@hlht-test ~]# df -h /u01
Filesystem Size Used Avail Use% Mounted on
/dev/sdb1 3.9T 488G 3.2T 14% /u01
10、启动Oracle服务
[root@hlht-test ~]# su - oracle
[oracle@hlht-test ~]$ lsnrctl start
LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 03-AUG-2020 18:48:45
Copyright (c) 1991, 2009, Oracle. All rights reserved.
Starting /u01/app/oracle/product/11.2.0/bin/tnslsnr: please wait...
TNSLSNR for Linux: Version 11.2.0.1.0 - Production
System parameter file is /u01/app/oracle/product/11.2.0/network/admin/listener.ora
Log messages written to /u01/app/oracle/diag/tnslsnr/hlht-test/listener/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=hlht-test)(PORT=1521)))
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 11.2.0.1.0 - Production
Start Date 03-AUG-2020 18:48:45
Uptime 0 days 0 hr. 0 min. 10 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/app/oracle/product/11.2.0/network/admin/listener.ora
Listener Log File /u01/app/oracle/diag/tnslsnr/hlht-test/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=hlht-test)(PORT=1521)))
The listener supports no services
The command completed successfully
[oracle@hlht-test ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.1.0 Production on Mon Aug 3 18:49:51 2020
Copyright (c) 1982, 2009, Oracle. All rights reserved.
Connected to an idle instance.
SQL> startup
ORACLE instance started.
Total System Global Area 4275781632 bytes
Fixed Size 2220200 bytes
Variable Size 2717912920 bytes
Database Buffers 1543503872 bytes
Redo Buffers 12144640 bytes
Database mounted.
Database opened.
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
[oracle@hlht-test ~]$ exit
logout
[root@hlht-test ~]# df -h /u01
Filesystem Size Used Avail Use% Mounted on
/dev/sdb1 3.9T 488G 3.2T 14% /u01
11、修改 /etc/fstab
echo "/dev/sdb1 /u01 ext4 defaults 0 0" >> /etc/fstab
文章评论