DBA’s often need to attach a database from SQL data file most of the cases provided by Vendor or during DR where T-Log does not have any significance, So we may well create a new log file instead of copying the log file over the network.
The TSQL used to attach a database with rebuild log option is given below,
CREATE DATABASE <dbname> ON (FILENAME = ‘<FilePath>) FOR ATTACH_REBUILD_LOG
CREATE DATABASE Testdb ON (Filename = ‘D:\Data\Testdb_data.mdf) FOR ATTACH_REBUILD_LOG
Post a Comment