Home > Backend Development > PHP Tutorial > How to recover data in SQL Server_PHP Tutorial

How to recover data in SQL Server_PHP Tutorial

WBOY
Release: 2016-07-13 17:01:08
Original
954 people have browsed it

Several ways to restore data in SQL server:
1. Naturally, the recovery method of backup is backup. This method is the safest and most reliable method and is also very simple to operate. Just select restore in the enterprise manager of sql server. That's it.
It can also be done using T-SQL:
RESTORE DATABASE test FROM DISK = ‘c:mssql7 ackup est.bak’
Of course this is for file recovery, if it is device recovery, it is also possible.
2. But sometimes, the SQL server is paralyzed when we are not prepared, and sometimes it is caused by the paralysis of NT. (At this time, Doufu still has the portrait of Gates on the wall. (I bought a few tomatoes), what should I do? At this time, we can only use the system stored procedures provided in t-sql of sql server:
sp_atach_db
Here is a simple example:
sp_attach_db @dbname = N'pubs',
@ filename1 = N'c:mssql7datapubs.mdf',
@filename2 = N'c:mssql7datapubs_log.ldf'
This method should be said to have a high success rate, but in practice I heard that this is the case Finally, the database becomes read-only, and there is nothing you can do about it. If there is only mdf and no ldf file, you can use sp_attach_single_file
sp_attach_single_file_db @dbname = 'pubs', @physname = 'c:mssql7datapubs.mdf'
This method is originally used to reverse the sp_deatach operation, but It can still be used successfully.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/631185.htmlTechArticleSeveral ways to restore data in SQL server: 1. Naturally, the backup recovery method backup This method is The safest and most reliable method is also very simple to operate. Just use sql s...
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template