the BiTTer and SwEEt of Me
tarian jari-jemari diatas tuts keyboard…

Mar
10

The story begun with an unexpected server problem,  my database crashed, its status changed into ‘SUSPECT’, if we would trace back further, this accident seems to be an impact of the electrical failure.

I remember once in the past, Anastasia guided me how to handle SQLServer, and if there’s a ’suspect’ database there are steps to be done:
1. Turn off the SQL Server’s service
2. Copy and backup .MDF and .LDF file of the ’suspect’ database
3. Turn on the service again
4. Detach the database, this might delete the master .MDF and .LDF files
5. Re-attach the .MDF file using an SQL script: sp_attach_single_file_db. A complete resource can be found in here: http://msdn2.microsoft.com/en-us/library/ms174385.aspx

6. After the .MDF is attached, the .LDF or log file will be created automatically.

The solution can also be applied when your database log files is/are beginning to explode.

But on my case yesterday, that solution didn’t work. Perhaps the solution didn’t work on SQL Server 2005, under MS. Windows 2003 x64.

When i tried this script:

sp_attach_single_file_db [ @dbname= ] 'dbname', [ @physname= ] 'physical_name'

then the result was:

File activation failure. The physical file name “C:\xxxxxx\xxxxxx_log.ldf” may be incorrect.
The log cannot be rebuilt because the database was not cleanly shut down.
Msg 1813, Level 16, State 2, Line 1
Could not open new database ‘XXXXXX’. CREATE DATABASE is aborted.

grmmbll…how can it be, i thought…then i tried another weapon:

sp_attach_db [ @dbname= ] 'dbname'        , [ @filename1= ] 'filename_n' [ ,...16 ]

Alas!!..enemies were still alive..
Msg 1813, Level 16, State 2, Line 1Could not open new database ‘XXXXXX’. CREATE DATABASE is aborted.
Msg 3316, Level 21, State 1, Line 1
During undo of a logged operation in database ‘XXXXXX’, an error occurred at log record ID (257:73855:17). The row was not found. Restore the database from a full backup, or repair the database.

I got more headaches, so i used my ultimate missile, which means, using the SQLServer 2005’s wizard:
But there came yet another error:

TITLE: Microsoft SQL Server Management Studio
——————————

Attach database failed for Server ‘QQQQQQQQQ’. (Microsoft.SqlServer.Smo)

For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=9.00.3042.00&EvtSrc=Microsoft.SqlServer.Management.Smo.ExceptionTemplates.FailedOperationExceptionText&EvtID=Attach+database+Server&LinkId=20476

——————————
ADDITIONAL INFORMATION:
An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.ConnectionInfo)
——————————
During undo of a logged operation in database ‘XXXXXX’, an error occurred at log record ID (257:73855:17). The row was not found. Restore the database from a full backup, or repair the database.
Could not open new database ‘XXXXXX’. CREATE DATABASE is aborted. (Microsoft SQL Server, Error: 3316)

For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&EvtSrc=MSSQLServer&EvtID=3316&LinkId=20476
——————————
BUTTONS:
OK
——————————

Oh no, so what should i do?..i began to scratch my head as if i got my head itchy..
after lurking around the web, i found some links which potentially have the solutions:
1. http://www.webservertalk.com/archive132-2006-3-1445098.html
2. http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=630182&SiteID=1
3. http://www.experts-exchange.com/Microsoft/Development/MS-SQL-Server/Q_22465639.html

MOre or less, the solutions are alike:

1. Back up the .mdf/.ndf files at first!!!
2. Change the database context to Master and allow updates to system tables:

   Use Master
   Go
   sp_configure ‘allow updates’, 1
   reconfigure with override
   Go

3. Set the database in Emergency (bypass recovery) mode:

   select * from sysdatabases where name = ‘<db_name>’
   – note the value of the status column for later use in # 6
   begin tran
   update sysdatabases set status = 32768 where name = ‘<db_name>’
   – Verify one row is updated before committing
   commit tran

4. Stop and restart SQL server.
5. Call DBCC REBUILD_LOG command to rebuild a “blank” log file based on the
suspected db.
      The syntax for DBCC REBUILD_LOG is as follows:

   DBCC rebuild_log(‘<db_name>’,'<log_filename>’)

   where <db_name> is the name of the database and <log_filename> is
   the physical path to the new log file, not a logical file name. If you
do not
   specify the full path, the new log is created in the Windows NT system
root
   directory (by default, this is the Winnt\System32 directory).

6. Set the database in single-user mode and run DBCC CHECKDB to validate
   physical consistency:

   sp_dboption ‘<db_name>’, ’single user’, ‘true’
   DBCC checkdb(‘<db_name>’)
   Go
   begin tran
   update sysdatabases set status = <prior value> where name = ‘<db_name>’
   – verify one row is updated before committing
   commit tran
   Go

7. Turn off the updates to system tables by using:

   sp_configure ‘allow updates’, 0
   reconfigure with override
   Go

A big BUT come…but…it didn’t work too..the server shouted at me…

“Ad hoc updates to system catalogs are not allowed.”

I found that in SQL 2005 we can’t update System Tables directly

 (http://www.webservertalk.com/archive132-2006-3-1445098.html)

What should I do then?!

Feb
06

akhirnya keluar juga keputusan di kantor kalau hari jumat masuk dan SKB 3 menteri juga di adopt disini..yaah..maka menanglah mereka yang iri, mereka yang tak punya kehidupan diluar kantor, dan mereka yang tak punya keluarga…sorry aja yah njing, we have our real life outside this concrete building.

Feb
05

ngebaca link di Detik.com (http://www.detiknews.com/indexfr.php?url=http://www.detiknews.com/index.php/detik.read/tahun/2008/bulan/02/tgl/05/time/125756/idnews/889403/idkanal/10)

isinya bilang ada revisi SKB 3 menteri tentang penghapusan cuti bersama di tahun 2008, huuufff..padahal jujur aja buat gw, gw kerja hanya menunggu hari gajian, weekend, dan tentu saja..cuti bersama.

hidup udah berat, harga merangkak naik, apa salahnya dapet hari istimewa untuk keluarga.

andai gw punya kuasa, dan andai ini dunia gw…

Feb
05

kau begitu sempurna….

lagu itu berulang terputar di winamp gw, suara kerennya Gita Gutawa sayup-sayup terdengar ditengah dering-dering telpon. hati gw menerawang ke si cantik di ujung sana, si cantik yang kupinang tahun lalu, dia yang begitu sempurna … dimataku.

Feb
05

Dear Love,

Tak terasa telah setahun berlalu sejak hari itu, sejak janji terucap, senyum terurai, air mata bahagia berlinang, dan tawa berderai

Tak terasa telah setahun berlalu sejak hari itu, ketika kota ini dicurahi air kehidupan, ketika kota ini sempat tak kuasa menahan arus, dan ketika si mamat tak bisa sekolah

Tak terasa pula, telah setahun wajahmu cantikmu aku tatap saat dirimu terlelap, telah setahun pula sabar dan kasihmu merawat aku, telah setahun pula cinta dan sayangmu melingkupi aku

semoga akan ada 50th anniversary, 100th anniversary, dan n-th anniversary

cintai aku dalam tawa dan tangismu, sebagaimana ku mencintaimu dalam hidup dan matiku

to my Dearest Nadia Sarah.

Jan
30

Bapak Pembangunan

Untuk dia yang mengantarkan kami maju sekian langkah ke depan

Untuk jalan raya dan jalan tol, listrik, swasembada pangan, ekspor, impor, pertumbuhan ekonomi, bank, sekolah, klompencapir, budaya, informasi, dan yang paling penting, stabilitas.

Negeri ini tak butuh demokrasi, negeri ini penuh kera yang senang berteriak-teriak, merusak, malas, tidak disiplin, dan bodoh

Negeri ini butuh keteraturan, kedisiplinan, dan stabilitas, walau itu berarti tangan besi. Dan hingga saat inipun, negeri ini tidak siap untuk lepas dari itu semua. Bunuh semua kera yang senang berteriak, bunuh semua kera-kera pemalas, bodoh, tidak disiplin itu…atau negeri ini butuh Soeharto yang lain.

Terlalu banyak kera-kera hidup yang tak memberi manfaat apa-apa bagi negeri ini, satu Soeharto tak kan mampu ditandingi sejuta mereka yang bodoh, malas, anarkis

Selamat jalan bapak pembangunan

Jan
28

our ex president

Innalillahi wa inna ilaihi raji’un.

Telah meninggal dunia, salah satu manusia yang berjasa besar bagi negeri ini,

H.M Soeharto

Semoga amal ibadahnya diterima disisi Allah SWT.

Jan
17

pengen deh ada undang-undang, stop merokok ato mati!

Jan
15

dalam sebuah volume majalah otomotif diceritakan tentang seorang mahasiswa yang seneng modifikasi mobil yang dia biasa kendarai, entah diceperin, ato’ cat eksentrik, ato’ sampai mengubah chassis mobil tersebut..dia merasa bangga akan hal itu.

menilik lebih lanjut, ternyata e ternyata, mobil yang bersangkutan gak dibeli dari keringat sendiri, ternyata dibeliin ortu..kutu kupret..gak pantes deh bangga disitu. lebih parahnya lagi kalo’ ternyata belinya juga dari uang mark-up ato’ uang korupsi, ato’ ngibul sana-sini..

tapi kalo’ gw lewat depan beberapa kampus ato’ bahkan beberapa sekolah menengah atas, bisa dipastiin pasti ada mobil-mobil ato’ motor-motor yang dibawa siswa/mahasiswa disana, dan kalo’ diliat lebih lanjut, lewat metode statistik sederhana seperti quesioner ato’ sekedar random sampling, bisa nebak gak lo, berapa persen mobil/motor yang bener2 dibeli dari usaha siswa/mahasiswa tersebut?

jelek2 kalo’ usaha sendiri lebih keren kali daripada yang dibeliin…

jadi, kalo’ bukan dari usaha sendiri…nyebur got aja !!

Jan
08