Устсан, гэмтсэн system datafile -ийг нөөцөөс сэргээх

system01.dbf файлыг нөөцөөс сэргээж туршицгаая.

Файлыг устгана.

[oracle@node214 ~]$
[oracle@node214 ~]$ . oraenv
ORACLE_SID = [DB11G] ?
The Oracle base for ORACLE_HOME=/u01/app/oracle/product/11.2.0/db_1 is /u01/app/oracle
[oracle@node214 ~]$
[oracle@node214 ~]$ cd /u01/app/oracle/oradata/DB11G/

drwxr-x--- 2 oracle oinstall      4096 Jan 27 19:35 .
drwxr-x--- 5 oracle oinstall      4096 Jan 23 10:17 ..
-rw-r----- 1 oracle oinstall   9748480 Feb  1 01:46 control01.ctl
-rw-r----- 1 oracle oinstall 209723392 Feb  1 01:46 example01.dbf
-rw-r----- 1 oracle oinstall  52429312 Jan 29 07:02 redo01.log
-rw-r----- 1 oracle oinstall  52429312 Jan 29 07:02 redo02.log
-rw-r----- 1 oracle oinstall  52429312 Jan 29 07:06 redo03.log
-rw-r----- 1 oracle oinstall 671096832 Feb  1 01:46 sysaux01.dbf
-rw-r----- 1 oracle oinstall 754982912 Feb  1 01:46 system01.dbf
-rw-r----- 1 oracle oinstall  30416896 Feb  1 01:00 temp01.dbf
-rw-r----- 1 oracle oinstall 524296192 Feb  1 01:46 test_assm01.dbf
-rw-r----- 1 oracle oinstall 524296192 Feb  1 01:46 test_mssm01.dbf
-rw-r----- 1 oracle oinstall 104865792 Feb  1 01:46 undotbs01.dbf
-rw-r----- 1 oracle oinstall 360456192 Feb  1 01:46 users01.dbf
[oracle@node214 DB11G]$ rm system01.dbf
[oracle@node214 DB11G]$ ls -la
total 3270008
drwxr-x--- 2 oracle oinstall      4096 Feb  1 03:14 .
drwxr-x--- 5 oracle oinstall      4096 Jan 23 10:17 ..
-rw-r----- 1 oracle oinstall   9748480 Feb  1 03:15 control01.ctl
-rw-r----- 1 oracle oinstall 209723392 Feb  1 03:12 example01.dbf
-rw-r----- 1 oracle oinstall  52429312 Jan 29 07:02 redo01.log
-rw-r----- 1 oracle oinstall  52429312 Jan 29 07:02 redo02.log
-rw-r----- 1 oracle oinstall  52429312 Jan 29 07:06 redo03.log
-rw-r----- 1 oracle oinstall 671096832 Feb  1 03:12 sysaux01.dbf
-rw-r----- 1 oracle oinstall 754982912 Feb  1 03:15 system01.dbf
-rw-r----- 1 oracle oinstall  30416896 Feb  1 03:12 temp01.dbf
-rw-r----- 1 oracle oinstall 524296192 Feb  1 03:12 test_assm01.dbf
-rw-r----- 1 oracle oinstall 524296192 Feb  1 03:12 test_mssm01.dbf
-rw-r----- 1 oracle oinstall 104865792 Feb  1 03:12 undotbs01.dbf
-rw-r----- 1 oracle oinstall 360456192 Feb  1 03:12 users01.dbf
[oracle@node214 DB11G]$

Dictionary-с мэдээлэл авахыг оролдоцгооё. Dictionary мэдээллүүд system tablespace-т хадгалагддаг билээ.

[oracle@node214 ~]$
[oracle@node214 ~]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on Wed Feb 1 03:13:28 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>
SQL>
SQL>
SQL> desc dict;
ERROR:
ORA-00604: error occurred at recursive SQL level 1
ORA-01116: error in opening database file 1
ORA-01110: data file 1: '/u01/app/oracle/oradata/DB11G/system01.dbf'
ORA-27041: unable to open file
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
ORA-00604: error occurred at recursive SQL level 1
ORA-01116: error in opening database file 1
ORA-01110: data file 1: '/u01/app/oracle/oradata/DB11G/system01.dbf'
ORA-27041: unable to open file
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3

system01.dbf файлыг нээж чадахгүй байна гэсэн алдаа гарч байна. Бид өмнө уг файлыг устгасан байгаа билээ. Тиймээс баазыг унтрааж mount горимд эхлүүлье. Учир нь controlfile-ийг нээж datafile-ийн мэдээллийг авч нээснээр open горимд шилждэг билээ.

SQL> shu abort
ORACLE instance shut down.

SQL> startup mount
ORACLE instance started.

Total System Global Area  217157632 bytes
Fixed Size		    2211928 bytes
Variable Size		  159387560 bytes
Database Buffers	   50331648 bytes
Redo Buffers		    5226496 bytes
Database mounted.
SQL>

Одоо бид шаардлагатай датафайлтай ажиллах боломж бүрдэж байна. Тиймээс нөөцлөлтөөс сэргээе. rman ашиглана.

[oracle@node214 ~]$
[oracle@node214 ~]$ rman target /

Recovery Manager: Release 11.2.0.1.0 - Production on Wed Feb 1 03:14:11 2017

Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.

connected to target database: DB11G (DBID=403682774, not open)

RMAN> restore datafile 1;

Starting restore at 01-FEB-17
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=20 device type=DISK

channel ORA_DISK_1: starting datafile backup set restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_DISK_1: restoring datafile 00001 to /u01/app/oracle/oradata/DB11G/system01.dbf
channel ORA_DISK_1: reading from backup piece /u01/app/oracle/flash_recovery_area/DB11G/backupset/2017_01_28/o1_mf_nnndf_TAG20170128T054242_d8qhply9_.bkp
channel ORA_DISK_1: piece handle=/u01/app/oracle/flash_recovery_area/DB11G/backupset/2017_01_28/o1_mf_nnndf_TAG20170128T054242_d8qhply9_.bkp tag=TAG20170128T054242
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:55
Finished restore at 01-FEB-17

RMAN>

Файлыг сэргээсэн тул одоо тухайн үеэс хойшхи мэдээллийг лог файлаас татах шаардлагатай. Тиймээс уг үйлдлийг хийцгээе.

RMAN> recover datafile 1;

Starting recover at 01-FEB-17
using channel ORA_DISK_1

starting media recovery

archived log for thread 1 with sequence 28 is already on disk as file /u01/app/oracle/flash_recovery_area/DB11G/archivelog/2017_01_28/o1_mf_1_28_d8qo5srf_.arc
archived log for thread 1 with sequence 29 is already on disk as file /u01/app/oracle/flash_recovery_area/DB11G/archivelog/2017_01_28/o1_mf_1_29_d8rff6qv_.arc
archived log for thread 1 with sequence 30 is already on disk as file /u01/app/oracle/flash_recovery_area/DB11G/archivelog/2017_01_29/o1_mf_1_30_d8t8zy3h_.arc
archived log for thread 1 with sequence 31 is already on disk as file /u01/app/oracle/flash_recovery_area/DB11G/archivelog/2017_01_30/o1_mf_1_31_d8woywy6_.arc
archived log for thread 1 with sequence 32 is already on disk as file /u01/app/oracle/flash_recovery_area/DB11G/archivelog/2017_01_30/o1_mf_1_32_d8xchc3k_.arc
archived log for thread 1 with sequence 33 is already on disk as file /u01/app/oracle/flash_recovery_area/DB11G/archivelog/2017_01_30/o1_mf_1_33_d8yksj0g_.arc
archived log for thread 1 with sequence 34 is already on disk as file /u01/app/oracle/flash_recovery_area/DB11G/archivelog/2017_01_31/o1_mf_1_34_d8z0xlrg_.arc
archived log for thread 1 with sequence 35 is already on disk as file /u01/app/oracle/flash_recovery_area/DB11G/archivelog/2017_01_31/o1_mf_1_35_d906h576_.arc
archived log for thread 1 with sequence 36 is already on disk as file /u01/app/oracle/flash_recovery_area/DB11G/archivelog/2017_01_31/o1_mf_1_36_d90xgvx6_.arc
archived log for thread 1 with sequence 37 is already on disk as file /u01/app/oracle/flash_recovery_area/DB11G/archivelog/2017_01_31/o1_mf_1_37_d91656v1_.arc
archived log for thread 1 with sequence 38 is already on disk as file /u01/app/oracle/flash_recovery_area/DB11G/archivelog/2017_02_01/o1_mf_1_38_d91f52sf_.arc
archived log file name=/u01/app/oracle/flash_recovery_area/DB11G/archivelog/2017_01_28/o1_mf_1_28_d8qo5srf_.arc thread=1 sequence=28
archived log file name=/u01/app/oracle/flash_recovery_area/DB11G/archivelog/2017_01_28/o1_mf_1_29_d8rff6qv_.arc thread=1 sequence=29
archived log file name=/u01/app/oracle/flash_recovery_area/DB11G/archivelog/2017_01_29/o1_mf_1_30_d8t8zy3h_.arc thread=1 sequence=30
archived log file name=/u01/app/oracle/flash_recovery_area/DB11G/archivelog/2017_01_30/o1_mf_1_31_d8woywy6_.arc thread=1 sequence=31
archived log file name=/u01/app/oracle/flash_recovery_area/DB11G/archivelog/2017_01_30/o1_mf_1_32_d8xchc3k_.arc thread=1 sequence=32
archived log file name=/u01/app/oracle/flash_recovery_area/DB11G/archivelog/2017_01_30/o1_mf_1_33_d8yksj0g_.arc thread=1 sequence=33
archived log file name=/u01/app/oracle/flash_recovery_area/DB11G/archivelog/2017_01_31/o1_mf_1_34_d8z0xlrg_.arc thread=1 sequence=34
archived log file name=/u01/app/oracle/flash_recovery_area/DB11G/archivelog/2017_01_31/o1_mf_1_35_d906h576_.arc thread=1 sequence=35
archived log file name=/u01/app/oracle/flash_recovery_area/DB11G/archivelog/2017_01_31/o1_mf_1_36_d90xgvx6_.arc thread=1 sequence=36
media recovery complete, elapsed time: 00:00:28
Finished recover at 01-FEB-17

RMAN>

Файл бүрэн сэргэлээ. Тиймээс баазыг нээцгээе.

SQL>
SQL> alter database open;

Database altered.

SQL> desc dict;
 Name					   Null?    Type
 ----------------------------------------- -------- ----------------------------
 TABLE_NAME					    VARCHAR2(30)
 COMMENTS					    VARCHAR2(4000)

SQL>
1 Like