oracle徹底刪除資料檔案
物理刪除資料檔案:
alter database datafile 8 offline drop;
alter database datafile 9 offline drop;
select file#,status$ from file$;
FILE# STATUS$
---------- ----------
1 2
2 2
3 2
4 2
5 2
6 1
7 2
8 2
9 2
10 1
11 1
12 1
13 1
14 1
15 1
16 1
17 1
18 1
19 1
20 1
21 1
22 1
23 1
24 1
SYS@hhw1> delete file$ where FILE#=8;
1 row deleted.
SYS@hhw1> delete file$ where FILE#=9;
1 row deleted.
SYS@hhw1> commit;
Commit complete.
SYS@hhw1> select file_id,file_name,tablespace_name from dba_data_files;
FILE_ID FILE_NAME TABLESPACE_NAME
---------- ------------------------------------------------------------ --------------------
1 +DATA/hhw/datafile/system.256.938483503 SYSTEM
2 +DATA/hhw/datafile/sysaux.257.938483503 SYSAUX
3 +DATA/hhw/datafile/undotbs1.258.938483503 UNDOTBS1
4 +DATA/hhw/datafile/users.259.938483505 USERS
5 +DATA/hhw/datafile/undotbs2.264.938483663 UNDOTBS2
此時資料字典中的資訊已刪除,但控制檔案仍留有記錄,需要重建控制
alter database backup controlfile to trace as '/home/oracle/a.txt';
SYS@hhw1> select file#,name from v$datafile;
FILE# NAME
---------- ------------------------------------------------------------
1 +DATA/hhw/datafile/system.256.938483503
2 +DATA/hhw/datafile/sysaux.257.938483503
3 +DATA/hhw/datafile/undotbs1.258.938483503
4 +DATA/hhw/datafile/users.259.938483505
5 +DATA/hhw/datafile/undotbs2.264.938483663
8 +DATA/hhw/datafile/users.291.970554721 -----仍存在
9 +DATA/hhw/datafile/users.291.963587193 -----仍存在
alter system set cluster_database=false scope=spfile;
shutdown immediate
startup nomount
控制檔案需要修改,去掉offline drop的資料檔案:
CREATE CONTROLFILE REUSE DATABASE "HHW" NORESETLOGS FORCE LOGGING ARCHIVELOG
MAXLOGFILES 192
MAXLOGMEMBERS 3
MAXDATAFILES 1024
MAXINSTANCES 32
MAXLOGHISTORY 292
LOGFILE
GROUP 1 '+DATA/hhw/onlinelog/group_1.261.938483583' SIZE 50M BLOCKSIZE 512,
GROUP 2 '+DATA/hhw/onlinelog/group_2.262.938483583' SIZE 50M BLOCKSIZE 512,
GROUP 3 '+DATA/hhw/onlinelog/group_3.265.938483763' SIZE 50M BLOCKSIZE 512,
GROUP 4 '+DATA/hhw/onlinelog/group_4.266.938483763' SIZE 50M BLOCKSIZE 512
-- STANDBY LOGFILE
DATAFILE
'+DATA/hhw/datafile/system.256.938483503',
'+DATA/hhw/datafile/sysaux.257.938483503',
'+DATA/hhw/datafile/undotbs1.258.938483503',
'+DATA/hhw/datafile/users.259.938483505',
'+DATA/hhw/datafile/undotbs2.264.938483663',
'+DATA/hhw/datafile/users.267.940497227'
CHARACTER SET ZHS16GBK;
alter database open;
alter system set cluster_database=true scope=spfile;
shutdown immediate
srvctl start database -d hhw
SYS@hhw1> select file_id,file_name,tablespace_name from dba_data_files;
FILE_ID FILE_NAME TABLESPACE_NAME
---------- ------------------------------------------------------------ ------------------------------
1 +DATA/hhw/datafile/system.256.938483503 SYSTEM
2 +DATA/hhw/datafile/sysaux.257.938483503 SYSAUX
3 +DATA/hhw/datafile/undotbs1.258.938483503 UNDOTBS1
4 +DATA/hhw/datafile/users.259.938483505 USERS
5 +DATA/hhw/datafile/undotbs2.264.938483663 UNDOTBS2
SYS@hhw1> select file#,name from v$datafile;
FILE# NAME
---------- ------------------------------------------------------------
1 +DATA/hhw/datafile/system.256.938483503
2 +DATA/hhw/datafile/sysaux.257.938483503
3 +DATA/hhw/datafile/undotbs1.258.938483503
4 +DATA/hhw/datafile/users.259.938483505
5 +DATA/hhw/datafile/undotbs2.264.938483663
alter database datafile 8 offline drop;
alter database datafile 9 offline drop;
select file#,status$ from file$;
FILE# STATUS$
---------- ----------
1 2
2 2
3 2
4 2
5 2
6 1
7 2
8 2
9 2
10 1
11 1
12 1
13 1
14 1
15 1
16 1
17 1
18 1
19 1
20 1
21 1
22 1
23 1
24 1
SYS@hhw1> delete file$ where FILE#=8;
1 row deleted.
SYS@hhw1> delete file$ where FILE#=9;
1 row deleted.
SYS@hhw1> commit;
Commit complete.
SYS@hhw1> select file_id,file_name,tablespace_name from dba_data_files;
FILE_ID FILE_NAME TABLESPACE_NAME
---------- ------------------------------------------------------------ --------------------
1 +DATA/hhw/datafile/system.256.938483503 SYSTEM
2 +DATA/hhw/datafile/sysaux.257.938483503 SYSAUX
3 +DATA/hhw/datafile/undotbs1.258.938483503 UNDOTBS1
4 +DATA/hhw/datafile/users.259.938483505 USERS
5 +DATA/hhw/datafile/undotbs2.264.938483663 UNDOTBS2
此時資料字典中的資訊已刪除,但控制檔案仍留有記錄,需要重建控制
alter database backup controlfile to trace as '/home/oracle/a.txt';
SYS@hhw1> select file#,name from v$datafile;
FILE# NAME
---------- ------------------------------------------------------------
1 +DATA/hhw/datafile/system.256.938483503
2 +DATA/hhw/datafile/sysaux.257.938483503
3 +DATA/hhw/datafile/undotbs1.258.938483503
4 +DATA/hhw/datafile/users.259.938483505
5 +DATA/hhw/datafile/undotbs2.264.938483663
8 +DATA/hhw/datafile/users.291.970554721 -----仍存在
9 +DATA/hhw/datafile/users.291.963587193 -----仍存在
alter system set cluster_database=false scope=spfile;
shutdown immediate
startup nomount
控制檔案需要修改,去掉offline drop的資料檔案:
CREATE CONTROLFILE REUSE DATABASE "HHW" NORESETLOGS FORCE LOGGING ARCHIVELOG
MAXLOGFILES 192
MAXLOGMEMBERS 3
MAXDATAFILES 1024
MAXINSTANCES 32
MAXLOGHISTORY 292
LOGFILE
GROUP 1 '+DATA/hhw/onlinelog/group_1.261.938483583' SIZE 50M BLOCKSIZE 512,
GROUP 2 '+DATA/hhw/onlinelog/group_2.262.938483583' SIZE 50M BLOCKSIZE 512,
GROUP 3 '+DATA/hhw/onlinelog/group_3.265.938483763' SIZE 50M BLOCKSIZE 512,
GROUP 4 '+DATA/hhw/onlinelog/group_4.266.938483763' SIZE 50M BLOCKSIZE 512
-- STANDBY LOGFILE
DATAFILE
'+DATA/hhw/datafile/system.256.938483503',
'+DATA/hhw/datafile/sysaux.257.938483503',
'+DATA/hhw/datafile/undotbs1.258.938483503',
'+DATA/hhw/datafile/users.259.938483505',
'+DATA/hhw/datafile/undotbs2.264.938483663',
'+DATA/hhw/datafile/users.267.940497227'
CHARACTER SET ZHS16GBK;
alter database open;
alter system set cluster_database=true scope=spfile;
shutdown immediate
srvctl start database -d hhw
SYS@hhw1> select file_id,file_name,tablespace_name from dba_data_files;
FILE_ID FILE_NAME TABLESPACE_NAME
---------- ------------------------------------------------------------ ------------------------------
1 +DATA/hhw/datafile/system.256.938483503 SYSTEM
2 +DATA/hhw/datafile/sysaux.257.938483503 SYSAUX
3 +DATA/hhw/datafile/undotbs1.258.938483503 UNDOTBS1
4 +DATA/hhw/datafile/users.259.938483505 USERS
5 +DATA/hhw/datafile/undotbs2.264.938483663 UNDOTBS2
SYS@hhw1> select file#,name from v$datafile;
FILE# NAME
---------- ------------------------------------------------------------
1 +DATA/hhw/datafile/system.256.938483503
2 +DATA/hhw/datafile/sysaux.257.938483503
3 +DATA/hhw/datafile/undotbs1.258.938483503
4 +DATA/hhw/datafile/users.259.938483505
5 +DATA/hhw/datafile/undotbs2.264.938483663
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/30345407/viewspace-2155721/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- oracle rac 12徹底刪除,徹底刪除該死的racOracle
- 徹底刪除mac使用者下的所有檔案和資料Mac
- 電腦上怎麼徹底刪除一個檔案?兩種可以直接徹底刪除檔案的操作方法
- Oracle10g刪除資料檔案Oracle
- 電腦怎麼找回徹底刪除的檔案?年度方法
- 如何徹底刪除資料?AweEraser新手使用小技巧
- bat批處理徹底刪除0KB頑固檔案BAT
- Mac 將 Sublime 徹底刪除Mac
- linux下恢復誤刪除oracle的資料檔案LinuxOracle
- 徹底刪除mysql容器內容MySql
- win10怎麼徹底刪除office_win10徹底刪除office的詳細教程Win10
- win10怎樣徹底刪除印表機 win10如何徹底刪除印表機驅動Win10
- Oracle 檔案意外刪除恢復(Linux)OracleLinux
- 電腦怎麼找回徹底刪除的檔案?大家都說簡單的方法
- centos 系統如何徹底刪除docker命令CentOSDocker
- 徹底刪除MySQL步驟介紹ATSSMySql
- mongodb安裝失敗如何徹底刪除MongoDB
- oracle刪除重資料方法Oracle
- hadoop 資料夾檔案的建立與刪除Hadoop
- FileUtils類建立、刪除檔案及資料夾
- 1.7.8. 刪除資料庫密碼檔案資料庫密碼
- 資料檔案誤刪除(DM_單機)
- win10如何徹底刪除hao123主頁 win10徹底刪除hao123主頁的方法Win10
- [待整理]oracle10g刪除(釋放)資料檔案/表空間流程Oracle
- Win10怎樣永久刪除檔案不進入回收站 win10如何將一個檔案徹底刪除而不放入回收站Win10
- oracle 資料庫徹底清除目錄指令碼Oracle資料庫指令碼
- mac上如何徹底刪除IntelliJ IDEA等軟體MacIntelliJIdea
- 教你怎麼從Windows10徹底刪除FlashWindows
- 【Linux】linux下刪除/清空資料夾/檔案命令Linux
- 如何徹底粉碎並清理檔案
- 如何使用CleanMyMac徹底擦除檔案?Mac
- win10怎麼徹底解除安裝office win10徹底刪除office方法Win10
- SVN !檔案刪除
- rm 刪除檔案
- Git——刪除檔案Git
- [Oracle]Oracle資料庫資料被修改或者刪除恢復資料Oracle資料庫
- 在Oracle中,如何定時刪除歸檔日誌檔案?Oracle
- 【北亞資料恢復】誤刪除oracle表和誤刪除oracle表資料的資料恢復方法資料恢復Oracle