Thursday, October 4, 2012

[SYBASE] How to fix a "suspect" database


Damit ich es wiederfinde, habe ich mir mal folgenden Beitrag aus einem Forumpost kopiert. Das Original ist hier zu finden: http://sybase-developer-network.com/conversation/44016/

 From: Bret Halford 
Clearing the suspect database flag is fairly easy, the suspect bit's
value in sysdatabases.status is 256. This code flips the bit off
if it is on:

sp_configure "allow updates", 1
go

-- on very old versions (pre-11.x), "reconfigure with override" would --
be needed here, it is not needed in current versions.
go
update sysdatabases
set
status = status ^ 256 -- exclusive or operator flip the bit
where
status & 256 = 256
[and name = "mydb"]


If you included the "name" clause, you should get 1 row affected.

The next step is to cause the database to go through recovery again
now that it is no longer marked suspect. On all versions, you can
do this by shutting down and then rebooting the whole ASE server.
In 12.5.4 ESD 1 and higher 12.5.x versions, and in 15.0.2 and above
you can use DBCC DBREBOOT to reboot just the one database

dbcc dbreboot("shutdown", )
go
dbcc dbreboot("restart",
)
go


The database should now either recover normally or hit a
problem and get marked suspect again.

If the problem is some sort of corruption in the database, your
options are to try loading an older dump of the database or
(if no such dump exists, for instance) working with tech support.
Generally speaking, though, if some sort of corruption is
preventing recovery from completing, it is unlikely that the
database can be brought to a transactionally consistent state.

Friday, July 20, 2012

[SYBASE] Stored Procedures erneut kompilieren

Ändert man eine Tabelle in Sybase und hat eine Stored Procedure oder einen Trigger, welcher auf diese Tabelle zugreift, so kann es sein, dass z.B. die Stored Procedure nicht mehr funktioniert. Diese muss dann neu kompiliert werden.

Mit sp_recompile braucht man sich nicht darum zu kümmern, welche Stored Procedures auf die geänderte Tabelle zugreifen. Man wendet sp_recompile stattdessen auf das geänderte Objekt an. Die Stored Procedure erhöht dann lediglich den Zähler "schemacnt". Sybase prüft diesen Zähler bei der Ausführung von z.B. Stored Procedures und rekompiliert die auszuführenden Objekte, wenn ein Unterschied bemerkt wird.

Links:

Wednesday, July 18, 2012

[LINUX] Dateien finden und in separaten Ordner kopieren

Möchte man in Linux Dateien finden und in einen separaten Ordner kopieren, so kann man dies mit folgendem Befehl bewerkstelligen:


find -type f -name "*.jpg" -exec cp {} /tmp/images/ \;

Soll die Verzeichnisstruktur erhalten bleiben:

find -type f -name "*.jpg" -exec cp '{}' /tmp/images/ --parents \;

Monday, March 12, 2012