Oracle dbf文件移動的方法
背景
oracle空間不足,發(fā)現(xiàn)dbf文件未按設(shè)計的路徑存放,linux磁盤掛載空間未利用,需要移動一下位置錯誤的dbf文件。
檢查文件系統(tǒng)
/home/oracle \>df -h 文件系統(tǒng) 容量 已用 可用 已用% 掛載點 /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掛載點下空間已達到100%。
檢查大文件
/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文件過大后,準備移動一下。應(yīng)該存放數(shù)據(jù)庫文件的oradata掛載點下還有剩余空間可以存放dbf文件。
/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直接登錄失敗,顯示空間不足。
刪除審計文件日志
/home/oracle/audit \>rm \* /home/oracle/audit \>ll 總用量 0
刪除后查看磁盤空間,發(fā)現(xiàn)剛刪的審計文件有點少
/home/oracle/audit \>df -h 文件系統(tǒng) 容量 已用 可用 已用% 掛載點 /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空間剩余,開始沒發(fā)現(xiàn)aud文件路徑有問題, 不是正常的aud路徑。
重新查找清理審計日志釋放空間
/home/oracle/app/oracle/admin/orcl \>find ./ -name \*aud
查詢出結(jié)果后清除前30天的
/home/oracle/app/oracle/admin/orcl \>find ./ -name \*aud -mtime +30 \|xargs rm -f
關(guān)閉數(shù)據(jù)庫
/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.
復制dbf文件
/home/oracle/oradata/ora12c \>cp upbs_data.dbf /oradata/orcl/appdata/upbs_data.dbf
登錄數(shù)據(jù)庫修改dbf文件路徑
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ù)庫服務(wù)
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ù)庫成功,刪除原來的dbf文件釋放空間
總結(jié)
到此這篇關(guān)于Oracle dbf文件移動的文章就介紹到這了,更多相關(guān)Oracle dbf文件移動內(nèi)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!
相關(guān)文章
Oracle觸發(fā)器表發(fā)生了變化 觸發(fā)器不能讀它的解決方法(必看)
下面小編就為大家?guī)硪黄狾racle觸發(fā)器表發(fā)生了變化 觸發(fā)器不能讀它的解決方法(必看)。小編覺得挺不錯的,現(xiàn)在就分享給大家,也給大家做個參考。一起跟隨小編過來看看吧2017-04-04Oracle通過LogMiner實現(xiàn)數(shù)據(jù)同步遷移
這篇文章主要介紹了Oracle通過LogMiner實現(xiàn)數(shù)據(jù)同步遷移的方法,文中講解非常細致,代碼幫助大家更好的理解和學習,感興趣的朋友可以了解下2020-07-07Maven中央倉庫正式成為Oracle官方JDBC驅(qū)動程序組件分發(fā)中心(推薦)
這篇文章主要介紹了Maven中央倉庫正式成為Oracle官方JDBC驅(qū)動程序組件分發(fā)中心,本文給大家介紹的非常詳細,對大家的學習或工作具有一定的參考借鑒價值,需要的朋友可以參考下2020-07-07Oracle單行函數(shù)(字符,數(shù)值,日期,轉(zhuǎn)換)
這篇文章主要介紹了Oracle單行函數(shù)(字符,數(shù)值,日期,轉(zhuǎn)換),本文結(jié)合實例代碼給大家介紹的非常詳細,對大家的學習或工作具有一定的參考借鑒價值,需要的朋友可以參考下2023-07-07window10 安裝Oracle19C 和SQL Developer 的圖文教程
這篇文章主要介紹了window10 安裝Oracle19C 和SQL Developer 教程(圖文詳解),本文給大家介紹的非常詳細,對大家的學習或工作具有一定的參考借鑒價值,需要的朋友可以參考下2021-03-03