日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

delete file$ recovery----惜分飞

發布時間:2024/9/21 编程问答 40 豆豆
生活随笔 收集整理的這篇文章主要介紹了 delete file$ recovery----惜分飞 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

最近遭遇幾次有人因為對oracle不太理解,由于各種情況下,刪除了file$中的部分記錄,從而使得該文件之后的文件都丟失,使得數據庫出現各種異常情況。這里演示了可以重啟數據庫的情況下兩種常見的刪除file$中記錄的恢復

創建表空間和表

SQL> startup ORACLE instance started. Total System Global Area 2421825536 bytes Fixed Size????????????????? 2215744 bytes Variable Size??????????? 1828716736 bytes Database Buffers????????? 570425344 bytes Redo Buffers?????????????? 20467712 bytes Database mounted. Database opened. SQL> create tablespace tbs_delete_file datafile '/home/oracle/oradata/xifenfei/file01.dbf' size 128M; Tablespace created. SQL> alter tablespace tbs_delete_file add datafile '/home/oracle/oradata/xifenfei/file02.dbf' size 128M; Tablespace altered. SQL> alter tablespace tbs_delete_file add datafile '/home/oracle/oradata/xifenfei/file03.dbf' size 128M; Tablespace altered. SQL> create table t_xifenfei tablespace tbs_delete_file ??2? as? select * from dba_objects; Table created. SQL> insert into t_xifenfei select * from dba_objects; 71895 rows created. SQL> / 71895 rows created. SQL> / 71895 rows created. SQL> / 71895 rows created. SQL> commit; Commit complete. SQL> select count(*) from t_xifenfei; ??COUNT(*) ---------- ????359475

刪除file$中記錄

SQL> select ts#,file# from file$;???? ???????TS#????? FILE# ---------- ---------- ?????????0????????? 1 ?????????1????????? 2 ?????????2????????? 3 ?????????4????????? 4 ?????????6????????? 5 ?????????6????????? 6 ?????????6????????? 7 7 rows selected. [oracle@localhost ~]$ ss SQL*Plus: Release 11.2.0.1.0 Production on Fri Jun 2 23:30:57 2017 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> delete from file$ where file#=5; 1 row deleted. SQL> commit; Commit complete. SQL> shutdown immediate; Database closed. Database dismounted. ORACLE instance shut down. 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@localhost tmp]$ ss SQL*Plus: Release 11.2.0.1.0 Production on Fri Jun 2 23:46:33 2017 Copyright (c) 1982, 2009, Oracle.? All rights reserved. Connected to an idle instance. SQL> startup ORACLE instance started. Total System Global Area 2421825536 bytes Fixed Size????????????????? 2215744 bytes Variable Size??????????? 1828716736 bytes Database Buffers????????? 570425344 bytes Redo Buffers?????????????? 20467712 bytes Database mounted. Database opened. SQL> select file# from file$; ?????FILE# ---------- ?????????1 ?????????2 ?????????3 ?????????4 ?????????6 ?????????7 6 rows selected. SQL> select file# from v$datafile; ?????FILE# ---------- ?????????1 ?????????2 ?????????3 ?????????4 ?????????5 ?????????6 ?????????7 7 rows selected. SQL> select count(*) from t_xifenfei; ??COUNT(*) ---------- ????359475

數據庫啟動正常,而且文件也未從控制文件中刪除,而且記錄查詢正常,考慮通過邏輯方式遷移數據。

測試重建控制文件

SQL> startup nomount ORACLE instance started. Total System Global Area 2421825536 bytes Fixed Size????????????????? 2215744 bytes Variable Size??????????? 1828716736 bytes Database Buffers????????? 570425344 bytes Redo Buffers?????????????? 20467712 bytes SQL> CREATE CONTROLFILE REUSE DATABASE "TEST" NORESETLOGS? NOARCHIVELOG ??2????? MAXLOGFILES 16 ??3????? MAXLOGMEMBERS 3 ????MAXDATAFILES 100 ????MAXINSTANCES 8 ????MAXLOGHISTORY 292 ??4??? 5??? 6??? 7? LOGFILE ??8??? GROUP 1 '/home/oracle/oradata/xifenfei/redo01.log'? SIZE 50M BLOCKSIZE 512, ??GROUP 2 '/home/oracle/oradata/xifenfei/redo02.log'? SIZE 50M BLOCKSIZE 512, ??GROUP 3 '/home/oracle/oradata/xifenfei/redo03.log'? SIZE 50M BLOCKSIZE 512 ??9?? 10?? 11? DATAFILE ?12??? '/home/oracle/oradata/xifenfei/system01.dbf', ??'/home/oracle/oradata/xifenfei/sysaux01.dbf', ??'/home/oracle/oradata/xifenfei/undotbs01.dbf', ?13?? 14?? 15??? '/home/oracle/oradata/xifenfei/users01.dbf', ??'/home/oracle/oradata/xifenfei/file01.dbf', ?16?? 17??? '/home/oracle/oradata/xifenfei/file02.dbf', ??'/home/oracle/oradata/xifenfei/file03.dbf' CHARACTER SET AL32UTF8 ?18?? 19?? 20? ; Control file created. SQL> alter database open; Database altered. SQL> select file# from v$datafile; ?????FILE# ---------- ?????????1 ?????????2 ?????????3 ?????????4 SQL> select file# from file$; ?????FILE# ---------- ?????????1 ?????????2 ?????????3 ?????????4 ?????????6 ?????????7 6 rows selected. SQL> select count(*) from t_xifenfei; select count(*) from t_xifenfei ?????????????????????* ERROR at line 1: ORA-00600: internal error code, arguments: [25029], [6], [], [], [], [], [],[], [], [], [], []

刪除file$中記錄,然后重啟庫之后,大于刪除的file#之后的數據文件全部丟失.

alert日志報錯

Fri Jun 02 23:49:42 2017 alter database open Fri Jun 02 23:49:42 2017 Thread 1 advanced to log sequence 9 (thread open) Thread 1 opened at log sequence 9 ??Current log# 3 seq# 9 mem# 0: /home/oracle/oradata/xifenfei/redo03.log Successful open of redo thread 1 MTTR advisory is disabled because FAST_START_MTTR_TARGET is not set Fri Jun 02 23:49:42 2017 SMON: enabling cache recovery Successfully onlined Undo Tablespace 2. Dictionary check beginning Tablespace 'TEMP' #3 found in data dictionary, but not in the controlfile. Adding to controlfile. File #5 in the controlfile not found in data dictionary. Removing file from controlfile. data file 5: '/home/oracle/oradata/xifenfei/file01.dbf' File #6 in the controlfile not found in data dictionary. Removing file from controlfile. data file 6: '/home/oracle/oradata/xifenfei/file02.dbf' File #7 in the controlfile not found in data dictionary. Removing file from controlfile. data file 7: '/home/oracle/oradata/xifenfei/file03.dbf' Dictionary check complete Verifying file header compatibility for 11g tablespace encryption.. Verifying 11g file header compatibility for tablespace encryption completed SMON: enabling tx recovery ********************************************************************* WARNING: The following temporary tablespaces contain no files. ?????????This condition can occur when a backup controlfile has ?????????been restored.? It may be necessary to add files to these ?????????tablespaces.? That can be done using the SQL statement: ?? ?????????ALTER TABLESPACE <tablespace_name> ADD TEMPFILE ?? ?????????Alternatively, if these temporary tablespaces are no longer ?????????needed, then they can be dropped. ???????????Empty temporary tablespace: TEMP ********************************************************************* Database Characterset is AL32UTF8 No Resource Manager plan active ********************************************************** WARNING: Files may exists in db_recovery_file_dest that are not known to the database. Use the RMAN command CATALOG RECOVERY AREA to re-catalog any such files. If files cannot be cataloged, then manually delete them using OS command. One of the following events caused this: 1. A backup controlfile was restored. 2. A standby controlfile was restored. 3. The controlfile was re-created. 4. db_recovery_file_dest had previously been enabled and ???then disabled. ********************************************************** replication_dependency_tracking turned off (no async multimaster replication found) Starting background process QMNC Fri Jun 02 23:49:43 2017 QMNC started with pid=20, OS id=11886 LOGSTDBY: Validating controlfile with logical metadata LOGSTDBY: Validation complete Completed: alter database open Fri Jun 02 23:49:44 2017 db_recovery_file_dest_size of 3882 MB is 0.00% used. This is a user-specified limit on the amount of space that will be used by this database for recovery-related files, and does not reflect the amount of space available in the underlying filesystem or ASM diskgroup. Fri Jun 02 23:49:44 2017 Errors in file /opt/oracle/diag/rdbms/test/test/trace/test_m001_11890.trc? (incident=84344): ORA-00600: internal error code, arguments: [25029], [6], [], [], [], [], [], [], [], [], [], [] Incident details in: /opt/oracle/diag/rdbms/test/test/incident/incdir_84344/test_m001_11890_i84344.trc Errors in file /opt/oracle/diag/rdbms/test/test/trace/test_m001_11890.trc: ORA-00600: internal error code, arguments: [25029], [6], [], [], [], [], [], [], [], [], [], [] Fri Jun 02 23:49:45 2017 Trace dumping is performing id=[cdmp_20170602234945] Fri Jun 02 23:49:46 2017 Starting background process CJQ0 Fri Jun 02 23:49:46 2017 CJQ0 started with pid=21, OS id=11902

這里報錯明顯,由于file$.file#=5被刪除,重建控制文件之后,file#在5之后的數據文件全部從控制文件中刪除,類似提示File #5 in the controlfile not found in data dictionary. Removing file from controlfile.

插入file$記錄恢復

--找出來被刪除的file$中記錄 [oracle@localhost dump]$ more SYS_FILE\$.dat 5|2|16384|6|5|0|0|0|993135||20971522|||| --插入被file$刪除記錄 SQL> insert into file$ values(5,2,16384,6,5,0,0,0,993135,null,20971522,null,null,null); 1 row created. SQL> commit; Commit complete. SQL> select file# from file$; ?????FILE# ---------- ?????????1 ?????????2 ?????????3 ?????????4 ?????????5 ?????????6 ?????????7 7 rows selected. --重啟數據庫,創建控制文件 SQL> shutdown immediate Database closed. Database dismounted. ORACLE instance shut down. SQL> startup nomount ORACLE instance started. Total System Global Area 2421825536 bytes Fixed Size????????????????? 2215744 bytes Variable Size??????????? 1828716736 bytes Database Buffers????????? 570425344 bytes Redo Buffers?????????????? 20467712 bytes SQL> CREATE CONTROLFILE REUSE DATABASE "TEST" NORESETLOGS? NOARCHIVELOG ??2????? MAXLOGFILES 16 ??3????? MAXLOGMEMBERS 3 ????MAXDATAFILES 100 ????MAXINSTANCES 8 ??4??? 5??? 6????? MAXLOGHISTORY 292 ??7? LOGFILE ??GROUP 1 '/home/oracle/oradata/xifenfei/redo01.log'? SIZE 50M BLOCKSIZE 512, ??GROUP 2 '/home/oracle/oradata/xifenfei/redo02.log'? SIZE 50M BLOCKSIZE 512, ??8??? 9?? 10??? GROUP 3 '/home/oracle/oradata/xifenfei/redo03.log'? SIZE 50M BLOCKSIZE 512 DATAFILE ?11?? 12??? '/home/oracle/oradata/xifenfei/system01.dbf', ??'/home/oracle/oradata/xifenfei/sysaux01.dbf', ?13?? 14??? '/home/oracle/oradata/xifenfei/undotbs01.dbf', ?15??? '/home/oracle/oradata/xifenfei/users01.dbf', ??'/home/oracle/oradata/xifenfei/file01.dbf', ??'/home/oracle/oradata/xifenfei/file02.dbf', ?16?? 17?? 18??? '/home/oracle/oradata/xifenfei/file03.dbf' ?19? CHARACTER SET AL32UTF8 ; 20? Control file created. SQL> alter database open; alter database open * ERROR at line 1: ORA-01113: file 5 needs media recovery ORA-01110: data file 5: '/home/oracle/oradata/xifenfei/file01.dbf' SQL> recover database; Media recovery complete. SQL> alter database open; Database altered. SQL> select file# from file$; ?????FILE# ---------- ?????????1 ?????????2 ?????????3 ?????????4 ?????????5 ?????????6 ?????????7 7 rows selected. SQL> select file# from v$datafile; ?????FILE# ---------- ?????????1 ?????????2 ?????????3 ?????????4 ?????????5 ?????????6 ?????????7 7 rows selected. SQL> select count(*) from t_xifenfei; ??COUNT(*) ---------- ????359475

alert日志正常,未提示刪除控制文件中數據文件

alter database open Fri Jun 02 23:56:52 2017 Thread 1 advanced to log sequence 10 (thread open) Thread 1 opened at log sequence 10 ??Current log# 1 seq# 10 mem# 0: /home/oracle/oradata/xifenfei/redo01.log Successful open of redo thread 1 MTTR advisory is disabled because FAST_START_MTTR_TARGET is not set Fri Jun 02 23:56:52 2017 SMON: enabling cache recovery Successfully onlined Undo Tablespace 2. Dictionary check beginning Tablespace 'TEMP' #3 found in data dictionary, but not in the controlfile. Adding to controlfile. Dictionary check complete Verifying file header compatibility for 11g tablespace encryption.. Verifying 11g file header compatibility for tablespace encryption completed SMON: enabling tx recovery ********************************************************************* WARNING: The following temporary tablespaces contain no files. ?????????This condition can occur when a backup controlfile has ?????????been restored.? It may be necessary to add files to these ?????????tablespaces.? That can be done using the SQL statement: ?? ?????????ALTER TABLESPACE <tablespace_name> ADD TEMPFILE ?? ?????????Alternatively, if these temporary tablespaces are no longer ?????????needed, then they can be dropped. ???????????Empty temporary tablespace: TEMP ********************************************************************* Database Characterset is AL32UTF8 No Resource Manager plan active ********************************************************** WARNING: Files may exists in db_recovery_file_dest that are not known to the database. Use the RMAN command CATALOG RECOVERY AREA to re-catalog any such files. If files cannot be cataloged, then manually delete them using OS command. One of the following events caused this: 1. A backup controlfile was restored. 2. A standby controlfile was restored. 3. The controlfile was re-created. 4. db_recovery_file_dest had previously been enabled and ???then disabled. ********************************************************** replication_dependency_tracking turned off (no async multimaster replication found) Starting background process QMNC Fri Jun 02 23:56:53 2017 QMNC started with pid=20, OS id=12127 LOGSTDBY: Validating controlfile with logical metadata LOGSTDBY: Validation complete Completed: alter database open

通過插入刪除記錄,重建控制文件,數據庫恢復正常,而且相關記錄也可以查詢。

結論總結
1. 如果刪除file$中的記錄,而且控制文件未重建,數據庫可以正常啟動,而且可以查詢數據
2. 如果刪除file$中的記錄,而且控制文件被重建,在數據庫啟動過程中,從被刪除文件之后的所有文件記錄從控制文件中刪除(類似:File N in the controlfile not found in data dictionary. Removing file from controlfile.).可以在數據庫open之后,插入被刪除的記錄,重建控制文件,數據會被恢復回來.如果數據庫無法啟動,需要通過其他方式進行恢復被刪除記錄

總結

以上是生活随笔為你收集整理的delete file$ recovery----惜分飞的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。

主站蜘蛛池模板: 贝利弗山的秘密1985版免费观看 | 日本高清视频www | 亚洲三级免费 | 粉嫩aⅴ一区二区三区四区五区 | 牛牛av在线 | 日韩精品久久一区二区 | 三级做爰在线观看视频 | 乱淫67194 | 亚洲精品123区 | 久久久精品人妻一区二区三区四 | 欧美午夜久久久 | 性工作者十日谈 | 欧美一区二区三区日韩 | 色天天综合网 | 中文字幕精品无码亚 | 日日噜噜噜夜夜爽爽狠狠视频97 | 日本高清视频www夜色资源 | 亚洲高清网站 | 亚洲综合不卡 | 人妻天天爽夜夜爽一区二区三区 | 偷拍夫妻性生活 | 女攻总攻大胸奶汁(高h) | 无套中出丰满人妻无码 | 中文字幕1页 | 成人av第一页 | 亚洲系列在线 | av五十路 | 日本成人在线一区 | va视频在线 | 国产黄色观看 | 天天干天天爽 | 色婷婷777| 亚洲电影一区二区 | 国产一级片免费视频 | 九九九九九热 | 2024国产精品视频 | 色婷婷视频在线观看 | aaaaa级少妇高潮大片免费看 | 亚洲欧美综合视频 | 色噜噜一区二区三区 | 日本中文在线播放 | 美女精品久久久 | 一区二区三区国产在线观看 | 久久精品无码一区二区三区免费 | 看了下面会湿的视频 | 91手机在线 | 男女操网站 | 天天躁日日躁bbbbb | 一级久久久久久 | 91人妻一区二区 | 久久只有这里有精品 | 超碰在线91 | 成人免费视频大全 | 无码人妻aⅴ一区二区三区玉蒲团 | 91麻豆国产精品 | 99久久精| 偷拍一区二区三区 | 久久久久黄| 亚洲第二色 | 日本少妇裸体 | 成人精品久久 | 黄瓜视频在线观看 | 少妇被躁爽到高潮无码人狍大战 | 四色成人av永久网址 | 国产午夜精品一区二区三区四区 | 日韩成人av影院 | 97干干干| 九一国产在线观看 | 久久97精品 | 亚洲AV无码久久精品浪潮 | 国产黄大片在线观看画质优化 | 成人午夜视频在线 | 欧美综合自拍 | 天堂av2021| 粉嫩aⅴ一区二区三区 | 看了让人下面流水的视频 | 国产三级精品三级在线观看 | 精品91在线| 九九色精品| 91久精品 | 欧美 日韩 人妻 高清 中文 | 国产88av| 国产激情视频在线观看 | 精品久久久久久久久久久久久久久久 | 国产精品一区二区三区四区在线观看 | 五月六月婷婷 | 亚州精品国产精品乱码不99按摩 | 亚洲av无码一区二区三区在线播放 | 国产91热爆ts人妖在线 | 色鬼综合 | 永久免费视频网站 | 国产精品一区二区人人爽 | 朝鲜黄色片 | 在线看中文字幕 | 毛片无码免费无码播放 | 麻豆久久久 | 人人爱爱人人 | 久久高潮视频 | 91精品国产色综合久久不卡粉嫩 |