server| Recovery | data | database in SQL Server 7 because MS redesigned the way database files are stored, the tedious process of building a new database is canceled. New storage format, a database consisting of two files, MDF database files and LDF log files. So we can copy the two files of the database you want to back up when we reload the machine, and then restore it after reinstalling.
A stored procedure that provides this type of recovery in SQL Server.
1.sp_attach_db [@dbname =] ' dbname ', [@filename1 =] ' Filename_n '
Add a database to the system, specify the database name in dbname, filename_n the file and log files for the specified database. For example, I have a Voogiya library that stops SQL Server service backup VOOGIYA_DATA.MDF,VOOGIYA_LOG.LDF, starts SQL Server, deletes the library, and then copies the two files to the SQL Server data directory , execute the following statement in Query Analyzer:
EXEC sp_attach_db @dbname = N ' Voogiya ',
@filename1 = N ' D:\mssql7\data\voogiya_data.mdf ',
@filename2 = N ' D:\mssql7\data\voogiya_log.ldf '
Will add this library to SQL Server group.
2.sp_attach_single_file_db [@dbname =] ' dbname ',
[@physname =] ' Physical_name '
This command, like the one above, allows the log file SQL Server to be physical_name as long as the physical file name of the library is written on it. This stored procedure is run to execute the following stored procedures:
sp_detach_db @dbname = ' dbname '
Also take the above example:
EXEC sp_detach_db @dbname = ' Voogiya '
EXEC sp_attach_single_file_db @dbname = ' Voogiya ',
@physname = ' D:\mssql7\data\voogiya_data.mdf '
Be aware that users executing the above stored procedures are in the sysadmin.
The above method runs on Windows Nt 4.0,service pack5,sql Server 7.0.