Recovery method for copying SQL Server 7 database
In SQL Server 7, since MS redesigned the storage method of the database file, the new device re-established the re-establishing database. New storage format, a database includes two files, MDF database files, and LDF log files. So we copy the two files of the database you want to back up when you reload the machine backup, and then restore it after reinstalling. This recovery method is provided in SQL Server. 1.sp_attach_db [@dbname =] 'DBNAME', [@ filename1 =] 'filename_n' Add a database to the system, specify the database name, filename_n specify the file and log file of the database name, filename_n specified the database. For example, I have a voogiya library, stop SQL Server service backup voogiya_data.mdf, voogiya_log.ldf, launch SQL Server, remove this library, then copy this two on the SQL Server Data directory, execute in Query Analyzer The following statement: exec sp_attach_db @dbname = n'voogiya ', @ filename1 = n'd: /msql7/data/voogiya_data.mdf', @ filename2 = n'd: /msql7/data/voogiya_log.ldf 'will put this The library is added to SQL Server Group. 2.sp_attach_single_file_db [@dbname =] 'dbname', [@physName =] 'physical_name' This command is the same, in Physical_name, just write the physical file name of the library The log file SQL Server will re-establish. Run the stored procedure must be executed following stored procedure: sp_detach_db @dbname = 'dbname' similar to the above example: EXEC sp_detach_db @dbname = 'voogiya' EXEC sp_attach_single_file_db @dbname = 'voogiya', @physname = 'd: /msql7/data/voogiya_data.mdf 'To pay attention to the user who performs the above stored procedure to be in sysadmin. The above method runs over Windows NT 4.0, Service Pack5, SQL Server 7.0.