March 8, 2015 at 4:49 am
I had to to relocate the database log file and I issued an Alter database command but by mistake I put a space in the file name as below. The space is at the beginning file name. Now I am unable get the database loaded to SQL Server. The database has 2 replications configured, so deleting and re-attaching the database means the replication needs to be re-configured. Is there an alternative way to issue a command to update the database FILENAME ? Not sure if this can be edited in master database (sys files).
ALTER DATABASE [User_DB]
MODIFY FILE (NAME = User_DB_log, FILENAME = 'I:\SQLLogs\ User_DB_log.ldf')
GO
March 8, 2015 at 8:00 am
miamikk204 (3/8/2015)
I had to to relocate the database log file and I issued an Alter database command but by mistake I put a space in the file name as below. The space is at the beginning file name. Now I am unable get the database loaded to SQL Server. The database has 2 replications configured, so deleting and re-attaching the database means the replication needs to be re-configured. Is there an alternative way to issue a command to update the database FILENAME ? Not sure if this can be edited in master database (sys files).ALTER DATABASE [User_DB]
MODIFY FILE (NAME = User_DB_log, FILENAME = 'I:\SQLLogs\ User_DB_log.ldf')
GO
If this is a regular user database , do this ...
Stop your replication. Find your new path or check it. Take the database offline.
Then run this:
USE master
GO
ALTER DATABASE MyDatabase
MODIFY FILE
( NAME = MyDatabase_Data,
FILENAME = 'C:\Disk2\MyDatabase.mdf'); -- New file path
Then move the actual mdf file at Os level.
Start your database.
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply