Kayıtlar

MSSQL etiketine sahip yayınlar gösteriliyor

SQL Server Database Snapshot

Merhabalar , Database Snapshot özellikleri SQL 2005 'den itibaren bizlerin kullanımına sunulan çok sevdiğim özelliklerden birisi. Kısaca DataBase Snapshot , Veri tabanın o anda bir resmini çekmeye benzer. Veri tabanın Snapshot oluşturduğu andan itibaren elimizde read-only bir kopyasını elde etmiş oluruz. Temel amacı ise Asıl veri tabanımızda ,snapshot oluşturulduğu andan sonra, değiştirilmiş kayıtların orjinal hallerini saklayıp gerektiğinde düzeltmektir. İsterseniz örnek bir senaryo ile daha iyi anlıyalım, daha sonra da olumlu ve olumsuz yanlarından bahsedelim. CREATE DATABASE  CUSTOMER_SS_CASE1  ON  ( NAME  = CUSTOMER, FILENAME =  'C:\SQLDATA\CUSTOMER_SS_CASE1.SS' ) AS  SNAPSHOT OF CUSTOMER; Senaryomuz'da Customer veritabanın da önemli değişiklik planlıyoruz. 3 farklı case den oluşan değişikliğin ilk adımında belirtilen dosya altına Veritabanımızın o andaki snapshot'nı aldık. Şu andan itibaren yapılan tüm update,delete,insert işlemleri öncesinde ,orjinal halleri s

Lock Request time out period exceeded Error 1222

  Bu hatayı, SSMS açmaya çalışırken (Tabloları,sp,view vs. görüntülemek adına) zaman zaman karşımıza çıkabilir. Sebebi ise o anda sistemi kilitleyen ciddi olabilecek bir işin çalışması yada açık transaction bırakıp lock koyması olabilir.    Bunun için şu dmv ler ile neler oluyor bakabiliriz. select   distinct   object_name ( a . rsc_objid ), a . req_spid , b . loginame from   sys . syslockinfo  a   ( nolock )   join   sys . sysprocesses  b   ( nolock )   on  a . req_spid = b . spid where   object_name ( a . rsc_objid )   is   not   null    Bu query hangi tablo lock almış, proccesID ve LoginName, neyi tutuyor bunu görebiliriz.Daha sonra doğru proccesi bulup kill edersek sorunu çözmüş oluruz.  

MSSql & WSUS: Database cannot be opened. Marked as suspected

Hi, the WSUS DB (MSSQL Express 2005) of a customer won’t start after a hardware failure and bluescreen. Here are the steps which recovers the database back in an usable state. The SQL Server Instance logs errors like this "Could not redo log record (183366:6166:54), for transaction ID (0:117029942), on page (1:657511), database 'SUSDB' (database ID 5). Page: LSN = (183267:2976:260), type = 2. Log: OpCode = 2, context 3, PrevPageLSN: (183366:1717:287). Restore from a backup of the database, or repair the database." in  “C:\Windows\SYSMSI\SSEE\MSSQL.2005\MSSQL\LOG\ERRORLOG”  and the database is down. First connect to the DB Instance using a named pipe c:\> sqlcmd -S np:\\.\pipe\MSSQL$MICROSOFT##SSEE\sql\query and see state of the Database. Replace SUSDB with the Databasename of your DB. Try to repair the Database. The repair attempt fails… DBCC CHECKDB ('SUSDB') WITH NO_INFOMSGS, ALL_ERRORMSGS; go Error MEssage: Database ‘SUSDB’ cannot be opened