Problems with Database backup

Source: Internet
Author: User
Tags mssqlserver

1, there is no database to create a database with the same name, and then select the backup, at this time full backup required, component backup can not

If both normal operation also prompts " database backup in Backup set is different from existing ", execute with statement

RESTORE DATABASE workpointmanage_sassfrom DISK = ' C:\Program Files\Microsoft SQL Server\mssql10_50.mssqlserver\mssql\ Backup\workpointmanage_sass_datafull_201412040742_12040742.bak '   --bak file path with Replace,move ' Workpointmanage_ Sass ' to ' C:\Program Files\Microsoft SQL Server\mssql10_50.mssqlserver\mssql\data\workpointmanage_sass.mdf ',   -- MDF file path move ' workpointmanage_sass_log ' to ' C:\Program Files\Microsoft SQL Server\mssql10_50.mssqlserver\mssql\data\ Workpointmanage_sass.ldf '   --ldf file path

2, database restore prompts the database is occupied, need to separate the database and online, the manual operation is invalid when the following statements can be used

DECLARE @dbname varchar Set @dbname = ' workpointmanage_sass ' declare @sql nvarchar declare @spid int--spid The value is a unique integer set that is assigned to the connection when the user connects @sql = ' Declare getspid cursor forselect spid from sysprocesses where dbid=db_id ("' [email protected]+ ') ' EXEC (@sql) Open Getspidfetch next from getspid to @spidwhile @ @fetch_status <>-1--if fetch The statement did not fail to execute or the row is not in the result set. Beginexec (' kill ' [email protected])--Terminate normal connection fetch next from getspid to @spidendclose getspiddeallocate getspid

Problems with Database backup

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.