【Oracleデータリカバリ】ORA-01122,ORA-01110,ORA-01200エラ

プロのOracle Databaseの復旧サービスを提供
携帯番号: +86 13764045638 メール:[email protected]

 

たまにはORA-01122,ORA-01110,ORA-01200エラが現れる、例えば:

ORA-01122: database file 9 failed verification check
ORA-01110: data file 9: ‘/u02/oradata/orcl/users01.dbf ‘
ORA-01200: actual file size of 64000 is smaller than correct size of 65600
[oracle@mlab2 ~]$ oerr ora 1122
01122, 00000, “database file %s failed verification check”
// *Cause: The information in this file is inconsistent with information
// from the control file. See accompanying message for reason.
// *Action: Make certain that the db files and control files are the correct
// files for this database.
[oracle@mlab2 ~]$ oerr ora 1110
01110, 00000, “data file %s: ‘%s’”
// *Cause: Reporting file name for details of another error. The reported
// name can be of the old file if a data file move operation is
// in progress.
// *Action: See associated error message.
[oracle@mlab2 ~]$ oerr ora 1200
01200, 00000, “actual file size of %s is smaller than correct size of %s blocks”
// *Cause: The size of the file as returned by the operating system is smaller
// than the size of the file as indicated in the file header and the
// control file. Somehow the file has been truncated. Maybe it is the
// result of a half completed copy.
// *Action: Restore a good copy of the data file and do recovery as needed.

バックアップもアーカイブバックアップもある場合に、バックアップをリカバリすることでトラブルをリカバリできる。この記事ではバックアップがない場合に、トラブルを解決するために、いろんな方法を検討する。SYSTEMテーブルスペースのデータファイルに対して同じ方法を使わないでください。

まずはデータベースごとに対してコールドバックアップする。ORA-01110 とORA-01122のエラを分析して、トラブルが起きたファイル番号を見つけ出せる。例えば、以下の例にはFILE#=9ファイルがエラになった:

ORA-01122: database file 9 failed verification check
ORA-01110: data file 9: ‘/u02/oradata/orcl/users01.dbf ‘

前の例にはORA-01200: actual file size of 64000 is smaller than correct size of 65600,つまりファイル実際のサイズは64000*db_block_size+一つのOracle BLock=64000 * 8192 + 8192 =524296192
ls -ltr データファイルで再びサイズを確認できる。

けど、ORACLEがデータファイルヘッダから獲得したデータファイルの理論的なサイズは65600 –> 65000 * 8192 +8192=532488192 bytesである。

二つの結果を比べてみれば、65600-64000=1600のブロックの差があるかも知れないので、ddで調整することより、今のデータファイルに追加できる。当然、追加したは空のブロックである。
例えば:

dd if=<locationf datafile having problem> of=<output/target datafile> count=< > bs=<db_block_size in bytes>

dd if=/u02/oradata/orcl/users01.dbf of=/tmp/corr_temp.DBF count=64000 bs=8192

1600の空のブロックを新しいデータファイルに追加する
dd if=/dev/zero of=<location of datafile> bs=<db_block_size in bytes> seek=<Actual block number reported + 1 > count=<Difference in number of block>

例えばdd if=/dev/zero of=/u02/oradata/careware/users01.dbf bs=8192 seek=64001 count=1600 conv=notrun

データを起動した時にデータファイルヘッダとコントロールファイル情報だけをテストするから、前のの操作はORACLEテストを騙すことができる。けど、データベースを起動した後にすべての使用可能なデータをエクスポートして、データベースを再構造してください。


Posted

in

by

Tags:

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *