背景
oracle空間不足,發(fā)現(xiàn)dbf文件未按設(shè)計(jì)的路徑存放,linux磁盤(pán)掛載空間未利用,需要移動(dòng)一下位置錯(cuò)誤的dbf文件。
檢查文件系統(tǒng)
1
2
3
4
5
6
7
8
9
10
11
12
13
|
/home/oracle \>df -h 文件系統(tǒng) 容量 已用 可用 已用% 掛載點(diǎn) /dev/mapper/lv01-root 22G 4.5G 16G 23% / devtmpfs 3.8G 0 3.8G 0% /dev tmpfs 3.9G 96K 3.9G 1% /dev/shm tmpfs 3.9G 153M 3.7G 4% /run tmpfs 3.9G 0 3.9G 0% /sys/fs/cgroup /dev/sda1 190M 132M 44M 75% /boot /dev/mapper/lv02-home 20G 19G 0 100% /home /dev/mapper/oradatalv-oradata 30G 18G 9.8G 65% /oradata tmpfs 781M 16K 781M 1% /run/ user /42 tmpfs 781M 0 781M 0% /run/ user /1001 tmpfs 781M 0 781M 0% /run/ user /0 |
home掛載點(diǎn)下空間已達(dá)到100%。
檢查大文件
1
2
3
4
|
/home/oracle/oradata/ora12c \>ls -lh 總用量 8.7G \-rw-r -----. 1 oracle oinstall 6.7G 5月 20 13:54 upbs_data.dbf \-rw-r -----. 1 oracle oinstall 2.0G 5月 20 05:06 upbs_index.dbf |
發(fā)現(xiàn)是dbf文件過(guò)大后,準(zhǔn)備移動(dòng)一下。應(yīng)該存放數(shù)據(jù)庫(kù)文件的oradata掛載點(diǎn)下還有剩余空間可以存放dbf文件。
1
2
3
4
5
6
7
8
9
10
|
/home/oracle/oradata/ora12c >sqlplus / as sysdba SQL*Plus: Release 12.1 . 0.2 . 0 Production on Wed May 20 14 : 18 : 36 2020 Copyright (c) 1982 , 2014 , Oracle. All rights reserved. ERROR: ORA- 09817 : Write to audit file failed. Linux-x86_64 Error: 28 : No space left on device Additional information: 12 ORA- 09945 : Unable to initialize the audit trail file Linux-x86_64 Error: 28 : No space left on device |
oracle sqlplus直接登錄失敗,顯示空間不足。
刪除審計(jì)文件日志
1
2
3
|
/home/oracle/audit \>rm \* /home/oracle/audit \>ll 總用量 0 |
刪除后查看磁盤(pán)空間,發(fā)現(xiàn)剛刪的審計(jì)文件有點(diǎn)少
1
2
3
4
5
6
7
8
9
10
11
12
13
|
/home/oracle/audit \>df -h 文件系統(tǒng) 容量 已用 可用 已用% 掛載點(diǎn) /dev/mapper/lv01-root 22G 4 .5G 16G 23 % / devtmpfs 3 .8G 0 3 .8G 0 % /dev tmpfs 3 .9G 96K 3 .9G 1 % /dev/shm tmpfs 3 .9G 153M 3 .7G 4 % /run tmpfs 3 .9G 0 3 .9G 0 % /sys/fs/cgroup /dev/sda1 190M 132M 44M 75 % /boot /dev/mapper/lv02-home 20G 19G 60K 100 % /home /dev/mapper/oradatalv-oradata 30G 18G 9 .8G 65 % /oradata tmpfs 781M 16K 781M 1 % /run/user/ 42 tmpfs 781M 0 781M 0 % /run/user/ 1001 tmpfs 781M 0 781M 0 % /run/user/ 0 |
刪除后有60k空間剩余,開(kāi)始沒(méi)發(fā)現(xiàn)aud文件路徑有問(wèn)題, 不是正常的aud路徑。
重新查找清理審計(jì)日志釋放空間
1
|
/home/oracle/app/oracle/admin/orcl \>find ./ -name \*aud |
查詢(xún)出結(jié)果后清除前30天的
1
2
|
/home/oracle/app/oracle/admin/orcl \>find ./ -name \*aud -mtime +30 \|xargs rm -f |
關(guān)閉數(shù)據(jù)庫(kù)
1
2
3
4
5
6
7
8
9
10
11
|
/home/oracle/audit \>sqlplus / as sysdba SQL\*Plus: Release 12.1.0.2.0 Production on Wed May 20 14:14:30 2020 Copyright (c) 1982, 2014, Oracle. All rights reserved. Connected to: Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options SQL\> shutdown immediate Database closed. Database dismounted. ORACLE instance shut down. |
復(fù)制dbf文件
1
2
|
/home/oracle/oradata/ora12c \>cp upbs_data.dbf /oradata/orcl/appdata/upbs_data.dbf |
登錄數(shù)據(jù)庫(kù)修改dbf文件路徑
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
home/oracle/app/oracle/admin/orcl \>sqlplus / as sysdba SQL\*Plus: Release 12.1.0.2.0 Production on Wed May 20 14:33:30 2020 Copyright (c) 1982, 2014, Oracle. All rights reserved. Connected to an idle instance. SQL\> startup mount; ORACLE instance started. Total System Global Area 2466250752 bytes Fixed Size 2927384 bytes Variable Size 671089896 bytes Database Buffers 1778384896 bytes Redo Buffers 13848576 bytes Database mounted. SQL\> alter database rename file '/home/oracle/oradata/ora12c/upbs_data.dbf' to '/oradata/orcl/appdata/upbs_data.dbf' ; Database altered. |
重啟數(shù)據(jù)庫(kù)服務(wù)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
SQL\> shutdown immediate ORA-01109: database not open Database dismounted. ORACLE instance shut down. SQL\> startup ORACLE instance started. Total System Global Area 2466250752 bytes Fixed Size 2927384 bytes Variable Size 671089896 bytes Database Buffers 1778384896 bytes Redo Buffers 13848576 bytes Database mounted. Database opened. SQL\> |
plsql重新連接數(shù)據(jù)庫(kù)成功,刪除原來(lái)的dbf文件釋放空間
總結(jié)
到此這篇關(guān)于Oracle dbf文件移動(dòng)的文章就介紹到這了,更多相關(guān)Oracle dbf文件移動(dòng)內(nèi)容請(qǐng)搜索服務(wù)器之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持服務(wù)器之家!
原文鏈接:https://blog.csdn.net/qq_21271511/article/details/106244803