简体   繁体   中英

Recovering database with filestream

I had a database setup with a filestream. The filestream storage was on a separate drive than the datafiles. The server was migrated to virtual, and the drive letter unknowingly changed. The database went into 'Recovery Pending' mode. I didn't realize at first what had happened, so I took it offline in hopes of bringing it back online. That didn't work. For other reasons, I couldn't change the drive letter back on the existing drive, so I added another with the original letter, copied the filestream data, but it still won't come online. The following error:

A file activation error occurred. The physical file name 'E:\\SQL Data\\AutoServiceATtachments\\AutoService_Filestream' may be incorrect'

What should my next steps be? This is SQL Server 2012.

Just for anyone who may come across this, I have figured it out. I backed up all the files, dropped the database, and then attached it again, with the following syntax:

USE [master]
GO
CREATE DATABASE [FileStreamDB] ON 
( FILENAME = N'C:\FileStreamDB\FileStreamDB.mdf' ),
( FILENAME = N'C:\FileStreamDB\FileStreamDB_log.ldf' ),
FILEGROUP [FileStreamGroup] CONTAINS FILESTREAM DEFAULT 
( NAME = N'FileStreamDB_FSData', FILENAME = N'C:\FileStreamDB\FileStreamData' )
FOR ATTACH
GO

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM