Today, I will reload the machine, I have forgotten that the backup of the Robot database just built under SQL Server (some data has been added), format the C disk. Fortunately, the data file MDF because the previous machine C disk space is not enough, so you start thinking how to use this MDF file to recover the database. I have found some information, this situation has not yet, in Delphibbs to see the information on sp_detach_db, sp_attach_single_file_db stored procedure, exactly what I need. So after practicing, the Robot database is finally restored by the following steps: 1. Newly created the same name database. 2. Remove its log file robot_data.ldf, do not delete the rear process execution not. 3. Set the Robot data to offline. 4. Log in in the query analyzer, perform the following stored procedures, must log in with a superuser, which is the system-level storage process.
EXEC SP_DETACH_DB @dbname = 'Robot'Exec sp_attach_single_file_db @dbname =' robot ', @physname =' E: WebDemo Obot_Data.mdf '
5. Set the Robot data to an online. 6. Refresh the database, the table, the data is intact, happy ..... SQL Server is easy to use, Oracle does not know what to say, write a job to schedule it.