How To Attach Database Without Transaction Log Using ATTACH_REBUILD_LOG

It is possible to attach the database without a log file using ATTACH_REBUILD_LOG. With the help of the following script, we attach the ASPNETDB database when there is only mdf file.

Because there is not a log file, it creates a new log file as you see below.

You can find the details of the detach and attach operations in the article titled “How To Change The Disk Of Database Files“.

If you want to detach or attach database containing filestream data you may want to read the article “How To Detach and Attach a Database Containing FileStream Data“.

Author: dbtut

We are a team with over 10 years of database management and BI experience. Our Expertises: Oracle, SQL Server, PostgreSQL, MySQL, MongoDB, Elasticsearch, Kibana, Grafana.

Leave a Reply

Your email address will not be published. Required fields are marked *