DBA > Job Interview Questions > Sybase Interview Questions and Answers

Fixing a Munged Log in Sybase ?

More DBA job interview questions and answers at http://dba.fyicenter.com/Interview-Questions/

(Continued from previous question...)

Fixing a Munged Log in Sybase ?

Sybase Technical Support states that this is extremely dangerous as it "jacks up the value of the timestamp" which is used for recovery purposes. This may cause potential database corruption if the system fails while the timestamp rolls over.

In 4.9.2, you could only run the dbcc rebuild_log command once and after that you would have to use bcp to rebuild the database
In System 10, you can run this command about 10 times.
In System 11 I (Pablo, previous editor) tried it about 20 times and no problem.
1. use master
2. go
1. select count(*) from your_database..syslogs
2. go

-----------
some number

1. sp_configure "allow updates",1
2. go
1. reconfigure with override /* for system 10 and below only*/
2. go

1. begin tran
2. go

/* Save the following status to be used later... */
1. select saved_status=status from sysdatabases where name = "your_database"
2. go
1. update sysdatabases set status = -32768 where name = "your_database"
2. go
1. commit tran
2. go
1. shutdown
2. go

1. dbcc rebuild_log (your_database, 0, 0)
2. go
DB-LIBRARY error (severity 9):
Unexpected EOF from SQL Server.

1. dbcc rebuild_log (your_database, 1, 1)
2. go
DBCC execution completed. If DBCC printed error messages, see your System
Administrator.


1. use your_database
2. go
1. select count(*) from syslogs
2. go

-----------
1

1. begin tran
2. go
1. update sysdatabases set status = saved_status where name = "your_database"
2. go
(1 row affected)
1. commit tran
2. go
1. shutdown
2. go

(Continued on next question...)

Other Job Interview Questions