Saturday 27 December 2008

Not able to Start SQL Service due to diff path of TempDB database.

Issue: SQL services are stopped. Not able to Start due to diff path of TempDB database.
Assessment/Actions taken:
1. When we try to start we are ending up with the below error messages:
udopen: Operating system error 3(The system cannot find the path specified.) during the creation/opening of physical device D:\MSSQL\data\msdbdata.mdf.
FCB::Open failed: Could not open device d:\Program Files\Microsoft SQL Server\MSSQL\data\model.mdf for virtual device number (VDN) 1.
udopen: Operating system error 3(The system cannot find the path specified.) during the creation/opening of physical device D:\MSSQL\data\msdbdata.mdf.

2. These error messages says that few.MDF and .LDF files are missing. When we check, we could see all these files are available on driver C: (Path C:\Program Files\Microsoft SQL Server\MSSQL).

3. So we have copied all these databases from Drive C$ to Drive D$ (to where the MSSQL server is pointing)

4. After this step, we have started the service and experienced an error with the Tempdb database, SQl server service is pointing this database to T:\MSSQL\DATA\tempdb.mdf. But we are unable to find the Drive T$ (There is no Drive T$ on the server).


Log Name: Application
Source: MSSQLSERVER
Date: 27-12-2008 21:27:35
Event ID: 17204
Task Category: Server
Level: Error
Keywords: Classic
User: N/A
Computer: Pawan-PC
Description:
FCB::Open failed: Could not open file C:\MSSQL\TempDB\DATA\tempdb.mdf for file number 1. OS error: 3(failed to retrieve text for this error. Reason: 15105).


This is where the actual problem started, TempDB path is incorrect and we are unable to find the drive. Please follow these steps to resolve this issue:
a. Start SQL Server from a DOS session with minimal config and trace flag to bypass system db recovery (other than master):

Point CMD to Binn Folder C:\MSSQL\MSSQL10.MSSQLSERVER\MSSQL\Binn

NET START MSSQLSERVER /f /T3608

(We are unable to start with the SqlServr -c –f)

If your SQL instance is not the default instance, replace MSSQLSERVER with MSSQL$ where is the instance name.

When the SQL Server is started, you'll see the following:
The SQL Server () service is starting.The SQL Server () service was started successfully.

Then bring up the SQL Server error log and look for the following:
4:20:18.92 Server Dedicated admin connection support was established for listening locally on port 2168.


C:\MSSQL\MSSQL10.MSSQLSERVER\MSSQL\Binn>NET START MSSQLSERVER /f /T3608
The SQL Server (MSSQLSERVER) service is starting.
The SQL Server (MSSQLSERVER) service was started successfully.

b. Connect locally from the DOS prompt using the dedicated admin connection (DAC):
i. For SQL server 2005 use the command:
sqlcmd OR SQLCMD –A (For more info check SQL BOL)
sqlcmd -S tcp:127.0.0.1,
ii. For SQL server 2000 use the command:
Isqlw
iii. If i and ii is not working then Used OSQL utility to connect SQL Server
OSQL –SMSSQL$InstanceName –E

If Default Instance
OSQL –E (For more info check SQL BOL)

c. This will bring you the Query analyzer in SQL Server 2000; in 2005/2008 the prompt will get changed to 1>, then run the alter commands to modify the location of tempdb:

C:\MSSQL\MSSQL10.MSSQLSERVER\MSSQL\Binn>OSQL -E

1> ALTER DATABASE TEMPDB
2> MODIFY FILE
3> (NAME=templog,
4> FILENAME='C:\MSSQL\MSSQL10.MSSQLSERVER\MSSQL\DATA\templog.ldf'
5> )
6> go
The file "templog" has been modified in the system catalog. The new path will
be used the next time the database is started.

1> ALTER DATABASE TEMPDB
2> MODIFY FILE
3> (NAME=tempdev,
4> FILENAME='C:\MSSQL\MSSQL10.MSSQLSERVER\MSSQL\DATA\tempdb.mdf'
5> )
6>
7> go
The file "tempdev" has been modified in the system catalog. The new path will
be used the next time the database is started.
1> exit

C:\MSSQL\MSSQL10.MSSQLSERVER\MSSQL\Binn>NET STOP MSSQLSERVER
The SQL Server (MSSQLSERVER) service is stopping.
The SQL Server (MSSQLSERVER) service was stopped successfully.

Change the paths etc as appropriate if your locations are different.

No comments: