An error occurred while creating the database (Microsoft. SqlServer. Smo ).

Source: Internet
Author: User
The Charging System of the IDC is complete, but I knocked it on my laptop and didn't implement remote release. The result was only a PASS ~ Come back and re-export your database to the desktop. Because the SQL installed in my notebook is different from the desktop version, I have encountered some problems. For specific solutions, refer to blog. csdn. netmascfarticle.

The Charging System of the IDC is complete, but I knocked it on my laptop and didn't implement remote release. The result was only a PASS ~ Back to re export your database to the desktop, because my laptop installed SQL and desktop version is not the same, so encountered some problems, specific solution please refer to blog: http://blog.csdn.net/mascf/article/

The Charging System of the IDC is complete, but I knocked it on my laptop and didn't implement remote release. The result was only a PASS ~ Back to re export your database to the desktop, because my laptop installed SQL and desktop version is not the same, so encountered some problems, specific solution please refer to blog: http://blog.csdn.net/mascf/article/details/38644759

The script is exported successfully, but a problem occurs when you create a database. The following problems occur during the creation process:

(But I forget the keyword is as follows)

Failed to create database (Microsoft. SqlServer. Smo ))

An exception occurred when executing a Transact-SQL statement or batch processing. (Microsoft. SqlServer. ConnectionInfo)

Unable to obtain the exclusive lock on the database 'model'

This phenomenon is caused by deadlocks.

Solution: Find the process id that occupies the model database and kill the process to get the resource.

The procedure is as follows:

Run the following code in the query Analyzer:

declare @sql varchar(100)while 1=1beginselect top 1 @sql = 'kill '+cast(spid asvarchar(3))from master..sysprocesseswhere spid > 50 and spid <> @@spidif @@rowcount = 0breakexec(@sql)end

Then you can create a new database. The re-generated database contains no content. We need to add an administrator to create a new query:

Insert into user_info (userID, PWD, Level, UserName, Head) values ('1', '1', 'admin', 'xu fengzhu ', 'admin ')

Now, let's test it on the desktop!

Related Article

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.