Recovery method for copying SQL Server 7 database

zhaozj2021-02-08  239

Recovery method for copying SQL Server 7 database

Keywords: SQL Server

Copy SQL Server 7 Database Recovery Method Cancel the new device to build a cumbersome process of re-establishing the database by Rederating the database file in SQL Server 7. 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.

转载请注明原文地址:https://www.9cbs.com/read-2554.html

New Post(0)