SQL database file restore command

zhaozj2021-02-16  90

EXEC SP_ATTACH_SINGLE_FILE_DB @dbname = '' '% s' ', @physname =' '% s' '; EXEC SP_ATTACH_DB @dbname =' '% s' ', @ filename1 =' '% s', @ filename2 = '' % s' ''

DBNAME: Database name

Filename1: Database file 1 (MDF)

FileName2: Database File 2 (LDF)

PhysName: Database Main File (MDF)

Such as: dbname = 'master'

Filename1 = 'c: / program files / microsoft sql server / mssql / data / master.mdf'

Filename2 = 'c: / program files / microsoft SQL Server / MSSQL / DATA / MASTLOG.LDF'

PhysName = 'c: / program files / microsoft SQL Server / MSSQL / DATA / MASTER.MDF'

转载请注明原文地址:https://www.9cbs.com/read-13865.html

New Post(0)