Workaround for unable to write to database

Source: Internet
Author: User

Intermediary transaction http://www.aliyun.com/zixun/aggregation/6858.html ">seo diagnose Taobao guest cloud host technology Hall

These two days I found that a portal that I was running had problems with data that could not be written, new members can not register, the information can not be published, can not log on the membership system, it is not found the reason to restore the backup database, but in the process of recovering the MSSQL database, prompted the database log full, please empty the database log Restore。 I think that's probably why the data can't be written correctly, then Baidu search the relevant information, and finally found the reason, the program run out, repair success, the source code released today, hope to help everyone, we have similar problems in the future have to empty the database log method, can also solve similar problems, empty the database log does not damage the server data, can solve the database can not write the reason, the code is as follows:

' SQL database connection parameters: Database name (sqldatabasename), user password (sqlpassword), user name (sqlusername),

' Connection name (Sqllocalname) (Local locally, field IP)

Const sqldatabasename = "Database name"

Const sqlpassword = "Database user password"

Const sqlusername = "Database user name"

Const sqllocalname = "Database Server" if the server is native, it can be set to: (local), if it is remote to set the database IP address

' Please do not modify the following

Dim ConnStr

ConnStr = "Provider = SQLOLEDB; User ID = "& Sqlusername &"; Password = "& SQLPassword &"; Initial Catalog = "&

Sqldatabasename & "; Data Source = "& Sqllocalname &";

Set conn = Server.CreateObject ("ADODB. Connection ")

Conn.Open ConnStr

Conn.execute ("DUMP TRANSACTION" & Sqldatabasename & "with No_log")

Conn.execute ("DBCC shrinkdatabase (& Sqldatabasename &)")

Conn.close

Set conn=nothing

Response.Write Your MSSQL database log has been emptied. "

%>

above code for and MSSQL database, support ASP space and set, Save the above code as So-and-so name. asp, and then in the input saved Web page address, the program runs automatically empty the database log, the perfect solution to the database can not write the problem, I hope the above code for SEO webmaster Help, thank you.

Author: seoer Xi yuan site: http://www.noseo.org.cn/

All rights reserved. Reprint must be linked to the form of the author and the original site and this statement.

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.