Tuesday, February 14, 2012

Database Corrupt: error 823

Hello there
After i tried to run DBCC CheckDb and it gave error, i has made to detach
the database.
When i tried to attach i got error 823: error (Bad page id).
What i can do now to fix the MDF file?You would want to restore from a backup. If you do not have a backup, the
following might help you recover what left of your data. Any doubt, contact
MS support.
1. make a backup of your *.mdf, *.ldf
2. set the db in emergency mode
exec sp_configure 'update','1'
reconfigure with override
go
update sysdatabases
set status=32768
where name='your_db'
go
--stop sqlserver
shutdown
--now restart sqlserver
go
3. rebuild log
dbcc rebuild_log('your_db','<fullpath_log_filename>')
go
4. attempt to fix with loss of data
exec sp_dboption 'your_db', 'single user', 'true'
dbcc checkdb('your_db',repair_allow_data_loss
)
go
5. reset db status
update sysdatabases
set status=0
where name='your_db'
go
6. turn off update
exec sp_configure 'update','0'
reconfigure with override
go
7. restart sqlserver
-oj
"Roy Goldhammer" <roy@.hotmail.com> wrote in message
news:u%23YeqpKiGHA.3496@.TK2MSFTNGP04.phx.gbl...
> Hello there
> After i tried to run DBCC CheckDb and it gave error, i has made to detach
> the database.
> When i tried to attach i got error 823: error (Bad page id).
> What i can do now to fix the MDF file?
>|||... and some additional thoughts about corrupt or suspect databases:
http://www.karaszi.com/SQLServer/in..._suspect_db.asp
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"oj" <nospam_ojngo@.home.com> wrote in message news:OtA57zTiGHA.3848@.TK2MSFTNGP04.phx.gbl...

> You would want to restore from a backup. If you do not have a backup, the
> following might help you recover what left of your data. Any doubt, contac
t
> MS support.
> 1. make a backup of your *.mdf, *.ldf
> 2. set the db in emergency mode
> exec sp_configure 'update','1'
> reconfigure with override
> go
> update sysdatabases
> set status=32768
> where name='your_db'
> go
> --stop sqlserver
> shutdown
> --now restart sqlserver
> go
> 3. rebuild log
> dbcc rebuild_log('your_db','<fullpath_log_filename>')
> go
> 4. attempt to fix with loss of data
> exec sp_dboption 'your_db', 'single user', 'true'
> dbcc checkdb('your_db',repair_allow_data_loss
)
> go
> 5. reset db status
> update sysdatabases
> set status=0
> where name='your_db'
> go
> 6. turn off update
> exec sp_configure 'update','0'
> reconfigure with override
> go
> 7. restart sqlserver
>
>
> --
> -oj
>
> "Roy Goldhammer" <roy@.hotmail.com> wrote in message
> news:u%23YeqpKiGHA.3496@.TK2MSFTNGP04.phx.gbl...
>

No comments:

Post a Comment