Monday, September 20, 2010

SQL : Database cannot be opened due to inaccessible files or insufficient memory or disk space

STEP1: identify the db status:
use master
select databaseproperty(‘db_name’,'isShutdown’)
Most of them it would return 1 in this situation
STEP2: Clear up the internal db status:
use master
alter database db_name set offline
it would return with no error in most cases
STEP3: Get detail error message:
use master
alter database db_name set online
After step3, sql server will first verify the log file, if the log file is okay, it will verify the rest of the data file(s). Most of time it is because of the file location or file properties setting. For example if it is file location issue:
alter database db_name
modify (file=’logical name’, filename=’physical name’)
go

1 comment:

Alex said...

recovery for sql server can repair mdf files from any version of SQL Server. The program doesn't modify source data during recovering. It can show restored .mdf and starts under all available MS Windows.