No relevant resource is found in the selected language.

This site uses cookies. By continuing to browse the site you are agreeing to our use of cookies. Read our privacy policy>Search

Reminder

To have a better experience, please upgrade your IE browser.

upgrade
Knowledge Base

FAQ-How to fix offline SYBASE database

Publication Date:  2012-07-25  |   Views:  734  |   Downloads:  0  |   Author:  SU1001576702  |   Document ID:  EKB0000552937

Contents

Issue Description

There are some exceptions(Server lost power, replication data in Veritas, Write data not finishe in database)sometimes. Sybase cannpt recover database file. The status is offline when you use sp_helpdb to check the status of databse:
1> sp_helpdb
2> go
 name     db_size    owner      dbid  created       status                                                                                                
 ------------------------ ------------- ------------------------ ------ --------------         ------------------------------------------------------------------------------------------------------
 alarmdb   500.0 mb  sa          13  jul 12, 2006  not recovered,,, offline 

It means that the related database was offline. We have to fix it.

Alarm Information

None

Handling Process

We use alarmdb as an example here:
1. We need to stop all the processes of U2000 first.

2. Set the status of alarmdb to "bypass recovery"
#. /opt/sybase/sybase.sh
#isql -usa -pxxxx -sdbsvr
1>sp_configure "allow updates",1
2>go
1>use master
2>go
1>update sysdatabases set status=-32768 where name='alarmdb'
2>go
1>shutdown with wait
2>go

3. Rebuild database log, restart sybase,
# su - sybase
$ cd /opt/sybase/ase*/install
$ ./startserver -f ./run_dbsvr
$ ./startserver -f ./run_dbsvr_back
$isql -usa -pxxxx -sdbsvr
1>use master
2>go
1>dbcc rebuild_log(alarmdb,1,1)
2>go
1>dump tran alarmdb with no_log  (Maybe we need wait half hour here)
2>go
1>shutdown with wait
2>go

4. Restart sybase
$ cd /opt/sybase/ase*/install
$ ./startserver -f ./run_dbsvr
$ ./startserver -f ./run_dbsvr_back
$isql -usa -pxxxx -sdbsvr
1>use master
2>go
1>update sysdatabases set status=0 where name='alarmdb'
2>go
1>sp_configure "allow updates",0
2>go
1>shutdown with wait
2>go

5. We need to set the property of alarmdb like this:
1>sp_dboption 'alarmdb', 'select into/bulkcopy/pllsort', true
2>go
6. Restart database and query the status of database to check if it is still offline.

Root Cause

This kind of problem will happen when there are some exceptions(server lost power, replication data in veritas, write data not finishe in database).

Suggestions

none