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/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- centos徹底刪除資料夾、檔案命令CentOS
- 徹底刪除ORACLEOracle
- AIX徹底刪除ORACLEAIOracle
- oracle rac 12徹底刪除,徹底刪除該死的racOracle
- win10系統如何將檔案徹底刪除 win10電腦徹底刪除檔案的方法Win10
- 徹底刪除mac使用者下的所有檔案和資料Mac
- 電腦上怎麼徹底刪除一個檔案?兩種可以直接徹底刪除檔案的操作方法
- Oracle 刪除資料檔案Oracle
- oracle刪除資料檔案Oracle
- SAP 徹底刪除物料主資料操作
- SAP徹底刪除物料主檔操作
- 轉:Oracle刪除資料檔案Oracle
- (個人)windowns系統徹底刪除oracleOracle
- Ubuntu徹底刪除MySqlUbuntuMySql
- 如何徹底刪除資料?AweEraser新手使用小技巧
- 電腦怎麼找回徹底刪除的檔案?年度方法
- mac怎麼徹底刪除檔案不佔用空間Mac
- 檔案從電腦中徹底刪除怎麼恢復
- win8系統刪除大檔案總是提示“徹底刪除”怎麼辦
- Oracle10g刪除資料檔案Oracle
- Mac 將 Sublime 徹底刪除Mac
- Ubuntu下徹底刪除vimUbuntu
- bat批處理徹底刪除0KB頑固檔案BAT
- Oracle恢復誤刪除的資料檔案Oracle
- 刪除空資料檔案
- 徹底刪除mysql容器內容MySql
- oracle誤刪除表空間的資料檔案Oracle
- OS 刪除oracle資料檔案恢復過程Oracle
- 不做第二個“陳老師” 教你徹底刪除硬碟資料硬碟
- (個人)Linux或UNIX系統下徹底刪除oracleLinuxOracle
- win10怎麼徹底刪除office_win10徹底刪除office的詳細教程Win10
- win10怎樣徹底刪除印表機 win10如何徹底刪除印表機驅動Win10
- Win10系統下利用cipher命令徹底刪除硬碟檔案的技巧Win10硬碟
- oracle刪除(釋放)資料檔案/表空間流程Oracle
- Oracle資料庫意外刪除資料檔案的恢復(轉載)Oracle資料庫
- oracle 失誤刪掉資料檔案後,刪除表空間操作Oracle
- gulp刪除檔案和資料夾
- mongodb安裝失敗如何徹底刪除MongoDB