7. ケース1 物理破損 論理破損
◆エラーLogの例
Master系の破損
・・・
2015-04-13 09:06:19.33 サーバー SQL Server is starting at normal priority base (=7). →
2015-04-13 09:06:19.33 サーバー Detected 4 CPUs. This is an informational message; no →
2015-04-13 09:06:19.35 サーバー Using dynamic lock allocation. Initial allocation of →
2015-04-13 09:06:19.37 サーバー Node configuration: node 0: CPU mask: 0x0000000f →
2015-04-13 09:06:19.39 spid6s Starting up database 'master'.
2015-04-13 09:06:19.45 spid6s エラー: 9003、重大度: 20、状態: 1。
2015-04-13 09:06:19.45 spid6s The log scan number (259:80:2) passed to log scan in →
2015-04-13 09:06:19.65 spid6s Cannot recover the master database. SQL Server is unable →
・・・
The log scan number (259:80:2) passed to log scan in database 'master'
is not valid. This error may indicate data corruption or that the
log file (.ldf) does not match the data file (.mdf). If this error
occurred during replication, re-create the publication. Otherwise,
restore from backup if the problem results in a failure during
startup.
Cannot recover the master database. SQL Server is unable to run.
Restore master from a full backup, repair it, or rebuild it. For
more information about how to rebuild the master database, see SQL
Server Books Online.
29. ケース3
◆どこが壊れているか特定&修復③
データ系の破損
・どの行か
物理破損
SELECT * FROM [テーブル名]
CROSS APPLY sys.fn_PhysLocCracker(%%physloc%%)
where file_id = @FileID and page_id <> @PageID
⇒としたいところですが、上記はエラーになります。
sys.fn_PhysLocCracker(%%physloc%%)はtableの行が
selectできないとエラーになるので・・・
30. ケース3
◆どこが壊れているか特定&修復④
データ系の破損
・select * from [テーブル名]をやりましょう
⇒どこかで落ちます
⇒select * from where [キー]
where条件にはPKEYのキーを指定します。
どんどんしぼっていって、
select * from [壊れているテーブル] where キー <=50
select * from [壊れているテーブル] where キー >=55
のようなSelectできるSQLを作る
※キーが51から54までのデータが死んでいるということ。
⇒さらに51から54のレコードでもBLOBカラムを除くともう
少し絞れるかもしれません。ページが違うため
物理破損