Main | May 2006 »

March 30, 2006

How to recover a Microsoft SQL master database

I am by no means a SQL expert but due to the life of a network engineer I get to see a little of everything. If anyone has any suggestions or comments on the steps I used feel free to make them. Recently we had an issue with a client that there master database was corrupt and MSSQL would not start. We had an old backup of the master database and the .mdf and .ldf of the client databases only. Below I have listed out the steps we took to recover the master database and the client databases.


- We started sqlservr.exe as an application using the trace flag -T3608 and it gave the error:

Error: 9003, Severity: 20, State: 1.

Cannot recover the master database. Exiting.

- We then proceeded with reinstallation of sql server for a named intance:NEW. and also applied sp3.

- Started sqlservr.exe -c -m -snew

- Restore database master from disk = 'D:\SQLDATAold\mssql\BACKUP\master_db_200503130200.BAK' with replace

- Started sqlservr.exe -T3608

- Checked the consistency of the Master database using: dbcc checkdb ('MASTER') - zero consistencies

- Next detached the Model database :sp_detach_db 'model'

- Renamed the new instance model db files

- Attached the Model database using: sp_attach_db 'model','D:\sqldata\MSSQL$NEW\Data\model.mdf','D:\sqldata\MSSQL$NEW\Data\modellog.ldf'

- Then took care of the Temp db by : Alter database tempdb modify file (name= 'tempdev', filename = 'D:\sqldata\MSSQL$NEW\Data\tempdb.mdf')

Alter database tempdb modify file (name= 'templog', filename = 'D:\sqldata\MSSQL$NEW\Data\templog.ldf')

- Detached the MSDB database: sp_detach_db 'msdb' and attached it back pointing to the right location:

sp_attach_db 'msdb','D:\sqldata\MSSQL$NEW\Data\msdbdata.mdf', 'D:\sqldata\MSSQL$NEW\Data\msdblog.ldf'

- Then changed the server name by executing the following commands

- select @@servername

- sp_dropserver 'BTLAPP'

- sp_addserver 'BTLAPP\NEW', 'LOCAL'

- Attached the DOCUWARE database and checked its consistencies: dbcc checkdb ('DOCUWARE') - zero consistencies


This worked really well the only drawback is the new instance name of MSSQL. We had to change the ODBC on every client workstation to point to the new name.

Posted by Travis Davies on March 30, 2006 | Permalink | Comments (4)

March 27, 2006

Automatic Outlook Profile for Office 2003 using Terminal Services Issues

I have run into a isssue with “somtimes“ when you create a MS Ofice transform file for custom Office intallations, they dont work. I have many times setup Citrix and Terminal servers to have the Outlook profile be created automatically when the user logs in. It works great. No extra helpdesk requests. And if you are using published applications and no desktop via Citrix it is priceless. The issue I have is when it is just won't work or stops working. This has happened on upgrades, new servers, old servers, etc. This is how FINALLY can get it to work 99.9% of the time. The key was a tool in the office rescource kit that I never would have thought to use. The Custom Maitenance Wizard. Here are the steps I have been using with great sucsess. I use this after I install Office with the custom transforms file and the Outlook profile is not beng automatically created.

===========

I) Uninstalled Office 2003

1) Used the Control Panel Add\Remove Programs applet to uninstall Office 2003.

2) Deleted the Program Files\Microsoft Office folder

4) Deleted the following registry keys:

HKLM\Software\Microsoft\Office

HKLM\Software\Microsoft\OfficeCustomizeWizard (if present)

HKLM\Software\Microsoft\Windows NT\CurrentVersion\Terminal Server\Install\Software\Microsoft\Office

HKLM\Software\Microsoft\Windows NT\CurrentVersion\Terminal Server\Install\Software\Microsoft\OfficeCustomizeWizard

HKCU\Software\Microsoft\Office

HKCU\Software\Microsoft\OfficeCustomizeWizard

II) Rebooted the server

III) Reinstalled Office 2003 using your custom MST file

IV)Created new CMW file using the Custom Maintenance Wizard Tool

In the CMW Wizard, Modified the Outlook settings (Step 12/18)

Selected Modify Profile option, configured the exchange server name and %username%

Executed the CMW file,

MAINTWIZ.EXE /c C:\OFFICE.CMW /l*V C:\CMW.Log

Maintwiz.exe can be found in C:\Program Files\ORKTOOLS\ORK11\TOOLS\Custom Maintenance Wizard

Maintenance wizard create the following registry key

HKLM\Software\Microsoft\OfficeCustomMaintenanceWizard

HKCU\Software\Microsoft\OfficeCustomMaintenanceWizard

Related articles:

(How to create a custom maintenance wizard file)

(How To Use the CMW)

(How to install Office 2003 on Windows Terminal Server)

Posted by Travis Davies on March 27, 2006 | Permalink | Comments (2)