Bring Sybase database offline

907 views Asked by At

Is there a way to bring a database offline in Sybase ASE 16.0?

I know a database gets set offline when loading a dump, but that can't be the only way to set a database offline.


There is also an official article for that, but it's locked behind a PayWall...

3

There are 3 answers

0
access_granted On BEST ANSWER

DBA-level direct edit of system catalog would place it into that state. Try it on a dev instance to see if this is what you were looking for in re: offline database command.

sp_configure 'allow updates',1
go

reconfigure with override
go

update master..sysdatabases 
set status=512 
where name='<database of interest>'
go

sp_configure 'allow updates',0
go

reconfigure with override
go

Other states you might look into would be:

512  offline 
1024 read only 
2048 dbo use only 
4096 single user 

Some of these states can be set via the sp_dboption calls, like

master..sp_dboption <database of interest>, "read", true
go
2
markp-fuso On

The only idea that comes to mind would be:

dbcc dbreboot('shutdown',<dbname1>[,<dbname2>, ...,<dbnameN>])

The only documentation I'm finding is this wiki page for dbcc dbreboot().

Keep in mind that online database will not make the database available again. To make the database available you'll need to run dbcc dbreboot('restart',<dbname>).

0
Mark On

You can also set the database into "dbo use only" mode, so that only the owner can access it:

use master
go
sp_dboption <databasename>, 'dbo use only', true
go

Should a non-dbo user attempt to use the database, it will result in the message:

User <uid> not allowed in database '<databasename>' - only the owner of this database can
access it.

Any logins that you have aliased to dbo in the database will still have access, though.