Sunday, March 11, 2012

Database disconnected from server

SQL Server 2000
Our server froze up and forced a reboot.
When the server came back online, the database was
no longer listed in EM as a database but the datafiles
themselves still exist. In addition, it appears that SQL
Server may still be "holding on" to the data files since when
I try to delete them, the operating system tells me they
can't be deleted.
I'd like to just reattach the datafiles to the server
and have the database reappear. How can I do this?Try to stop SQL Server service move the .MDF and .LDF to
other folder and then start SQL Server again. Move back
SQL Server files to their original folders and then
reattach the database.
Cesar Kubo
>--Original Message--
>SQL Server 2000
>Our server froze up and forced a reboot.
>When the server came back online, the database was
>no longer listed in EM as a database but the datafiles
>themselves still exist. In addition, it appears that
SQL
>Server may still be "holding on" to the data files since
when
>I try to delete them, the operating system tells me they
>can't be deleted.
>I'd like to just reattach the datafiles to the server
>and have the database reappear. How can I do this?
>
>.
>|||Hi Simon,
Happy New Year and thank you for using MSDN Newsgroup! It's my pleasure to
assist you with your issue.
From the information you provided, your SQL Enterprise Manager cannot get
the information of the database, but its MDF and LDF is still in you disk.
You cannot delete them because the system informed you that them are still
in use. You wonder if you can reattatch this files so that the SQL Server
Enterprise Manager could show the database and manage the database, right.
From my experience, in most cases, it is SQL Service that is still using
this file. You can stop the SQL Server Service.
Then, restart you SQL Service, and in you Query Analyzer, run the following
batches:
exec sp_attach_db @.dbname='your_database_name'
@.filename1='MDF_file' --for example: 'c:\test.mdf'
@.filename2='LDF_file' --for example: 'c:\test_log.ldf'
If you do not want to use the former log file, run the following:
exec sp_attatch_single_file_db @.dbname='your_database_name'
@.physname='MDF_file' --for example: 'c:\test.mdf'
Note: The system will create a new log file, but all the information in the
old log file will be lost.
Hoping this information will be helpful in solving your problem. If you
still have questions, please feel free to post new message here and I am
ready to help!
Best regards
Baisong Wei
Microsoft Online Support
----
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
Please reply to newsgroups only. Thanks.

No comments:

Post a Comment