July 1, 2013 at 7:28 am
Hi,
I have data file and log file at different location.
data file at location:
D:\Folder1\test.mdf
while log file at place
D:\folder2\test_log.ldf
Now I want to move this log file to D\folder1\test_log.ldf
How can I achieve this?
_______________________________________________________________
To get quick answer follow this link:
http://www.sqlservercentral.com/articles/Best+Practices/61537/
July 1, 2013 at 7:33 am
If you can afford some downtime then you can detach database, move log file to new location then reattach and point the database to the new location of the log file.
---------------------------------------------------------
It takes a minimal capacity for rational thought to see that the corporate 'free press' is a structurally irrational and biased, and extremely violent, system of elite propaganda.
David Edwards - Media lens[/url]
Society has varying and conflicting interests; what is called objectivity is the disguise of one of these interests - that of neutrality. But neutrality is a fiction in an unneutral world. There are victims, there are executioners, and there are bystanders... and the 'objectivity' of the bystander calls for inaction while other heads fall.
Howard Zinn
July 1, 2013 at 7:39 am
1. Take the database OFFLINE
2. copy the LOG file to the new location
3. Change the location in the master database with code:
ALTER DATABASE [dbname] MODIFY FILE (NAME = 'logical_name', FILENAME = 'drive_path_filename')
4. bring the database ONLINE (if this doesn't succeed then step 2 has failed)
5. remove the old (original) file (if this file is blocked, then step 3 has failed)
July 1, 2013 at 7:40 am
kapil_kk (7/1/2013)
Hi,I have data file and log file at different location.
data file at location:
D:\Folder1\test.mdf
while log file at place
D:\folder2\test_log.ldf
Now I want to move this log file to D\folder1\test_log.ldf
How can I achieve this?
I first detach the databse
EXEC sp_detach_db @dbname = N'dump';
Then move the data and logfile to new path
after I run this script
EXEC sp_attach_db @dbname = N'dump',
@filename1 = N'D:\test\dump.mdf', @filename2 = N'D:\test\dump_log.ldf';
GO
But its gives me error:
Unable to open the physical file "D:\test\dump.mdf". Operating system error 5: "5(failed to retrieve text for this error. Reason: 15105)".
_______________________________________________________________
To get quick answer follow this link:
http://www.sqlservercentral.com/articles/Best+Practices/61537/
July 1, 2013 at 7:50 am
Possibly the security settings on the folder?
---------------------------------------------------------
It takes a minimal capacity for rational thought to see that the corporate 'free press' is a structurally irrational and biased, and extremely violent, system of elite propaganda.
David Edwards - Media lens[/url]
Society has varying and conflicting interests; what is called objectivity is the disguise of one of these interests - that of neutrality. But neutrality is a fiction in an unneutral world. There are victims, there are executioners, and there are bystanders... and the 'objectivity' of the bystander calls for inaction while other heads fall.
Howard Zinn
July 1, 2013 at 7:52 am
Operating system error 5 is Access Denied. The SQL Server service does not have full rights on that folder.
p.s. sp_attach_db is deprecated and should not be used. Use CREATE DATABASE ... FOR ATTACH.
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
July 1, 2013 at 7:53 am
GilaMonster (7/1/2013)
Operating system error 5 is Access Denied. The SQL Server service does not have full rights on that folder.
How to grant it ful rights?
_______________________________________________________________
To get quick answer follow this link:
http://www.sqlservercentral.com/articles/Best+Practices/61537/
July 1, 2013 at 7:57 am
HanShi (7/1/2013)
1. Take the database OFFLINE2. copy the LOG file to the new location
3. Change the location in the master database with code:
ALTER DATABASE [dbname] MODIFY FILE (NAME = 'logical_name', FILENAME = 'drive_path_filename')
4. bring the database ONLINE (if this doesn't succeed then step 2 has failed)
5. remove the old (original) file (if this file is blocked, then step 3 has failed)
i tried these steps but got error at step 4
Operating system error 5: "5(failed to retrieve text for this error. Reason: 15105)".
_______________________________________________________________
To get quick answer follow this link:
http://www.sqlservercentral.com/articles/Best+Practices/61537/
July 1, 2013 at 8:00 am
RIGHT-CLICK folder, click properties then Security tab, click EDIT then give the SQL Server Service account Full control of the folder.
---------------------------------------------------------
It takes a minimal capacity for rational thought to see that the corporate 'free press' is a structurally irrational and biased, and extremely violent, system of elite propaganda.
David Edwards - Media lens[/url]
Society has varying and conflicting interests; what is called objectivity is the disguise of one of these interests - that of neutrality. But neutrality is a fiction in an unneutral world. There are victims, there are executioners, and there are bystanders... and the 'objectivity' of the bystander calls for inaction while other heads fall.
Howard Zinn
July 1, 2013 at 8:10 am
Abu Dina (7/1/2013)
RIGHT-CLICK folder, click properties then Security tab, click EDIT then give the SQL Server Service account Full control of the folder.
ohhh yes, that was permission issue with the folder i have correct that..
thanks for your help 🙂
_______________________________________________________________
To get quick answer follow this link:
http://www.sqlservercentral.com/articles/Best+Practices/61537/
Viewing 10 posts - 1 through 9 (of 9 total)
You must be logged in to reply to this topic. Login to reply