Tuesday, February 9, 2016

SQL Server 2008 error (Operating system error 2(The system cannot find the file specified.)

I faced this error while installing and configuring Sharepoint 2013 Foundation for a client. I tried installing SP 2013 Foundation and it succeeded but the SQL Server component had failed even after many attempts. So I installed SQL Server 2008 Express with SP2 first and then installed SP 2013 Foundation. Now the installation was successful but I kept getting an error when trying to restart SQL service. the exact error was:

FileMgr:tartLogFiles: Operating system error 2(The system cannot find the file specified.) occurred while creating or opening file 'e:\sql10_main_t\sql\mkmastr\databases\objfre\i386\modellog.ldf'. Diagnose and correct the operating system error, and retry the operation.


So after few hours of installing/uninstalling and tweaking I got a solution:


NET START MSSQL$SQLEXPRESS /f /T3608


SQLCMD -S .\SQLEXPRESS

1>SELECT name, physical_name, state_desc FROM sys.master_files ORDER BY database_id;

Now notice those wrong file names, and run following commands ...

Note: you need to change the file name location.


1>ALTER DATABASE model MODIFY FILE ( NAME = modeldev, FILENAME = 'c:\model.mdf');
2>ALTER DATABASE model MODIFY FILE ( NAME = modellog, FILENAME = 'c:\modellog.ldf');
3> go

ALTER DATABASE msdb MODIFY FILE ( NAME = MSDBData, FILENAME = 'c:\MSDBData.mdf');
ALTER DATABASE msdb MODIFY FILE ( NAME = MSDBLog, FILENAME = 'c:\MSDBLog.ldf');

ALTER DATABASE tempdb MODIFY FILE ( NAME = tempdev, FILENAME = 'c:\temp.mdf');
ALTER DATABASE tempdb MODIFY FILE ( NAME = templog, FILENAME = 'c:\temp.ldf');

go

exit;

NET STOP MSSQL$SQLEXPRESS 





Changing the paths as described above worked, but still I was not able to log in.

My solution:

I started the service with NET START again and listed the users:
select loginname from master..syslogins
My windows account was missing, so I have added it:>
CREATE LOGIN [COMPUTERNAME\USERNAME] FROM WINDOWS;
Then I was able to login with Management Studio with Windows Authentication.


Still not being able to use the 'sa' account with the password supplied during the installation. Solution: login as 'sa' and leave the password empty. Then I could change the password to desired value.


Credit: https://social.msdn.microsoft.com/Forums/sqlserver/en-US/54bbcac3-41c5-4a5d-a4f6-2669e538dc82/sqlserver-2008-express-install-error?forum=sqlexpress

No comments:

Post a Comment