Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Move MDF file to new Drive Expand / Collapse
Author
Message
Posted Sunday, October 31, 2010 4:33 AM
SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Friday, June 27, 2014 2:22 AM
Points: 298, Visits: 230
Hi all,

I need your help,

i was moving th MDF file to a newly added drive, the steps i follw was:

1. bring DB ofline
2. Copy MDF file to new Drive
3. Bring Db online.
4. RUN (
USE master GO ALTER DATABASE TEST MODIFY FILE (NAME = test, FILENAME = 'F:\SQL data\test.mdf') GO)
5. Restart SQL services.

now after all this step i found my database goes to suspect mode, can anybody tell me the reason/step i missed and the how to resolve.

error from sql log:
The log scan number (856823:4733:134) passed to log scan in database 'UPSInvite' is not valid. This error may indicate data corruption or that the log file (.ldf) does not match the data file (.mdf).
Post #1013558
Posted Sunday, October 31, 2010 4:49 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Today @ 1:50 PM
Points: 6,191, Visits: 13,340
correct sequence is;


1. ALTER DATABASE TEST MODIFY FILE (NAME = test, FILENAME = 'F:\SQL data\test.mdf')
2. bring DB offline
2. Copy MDF file to new Drive
3. Bring Db online.

Did copy the file or cut and paste?

Before going any further and to avoid compounding the issue, what does the following query return?

select name, physical_name from sys.master_files
where database_id = db_id('TEST') and file_id = 1



-----------------------------------------------------------------------------------------------------------

"Ya can't make an omelette without breaking just a few eggs"
Post #1013560
Posted Sunday, October 31, 2010 5:08 AM
SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Friday, June 27, 2014 2:22 AM
Points: 298, Visits: 230
I just copy paste the file, so to avoid any delay while i found a solution

i change it back to the old location.
Post #1013561
Posted Sunday, October 31, 2010 5:13 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Today @ 1:50 PM
Points: 6,191, Visits: 13,340
Also, make sure the SQL Server instance has permissions on the location you are moving the file to!!

-----------------------------------------------------------------------------------------------------------

"Ya can't make an omelette without breaking just a few eggs"
Post #1013562
Posted Sunday, October 31, 2010 5:17 AM
SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Friday, June 27, 2014 2:22 AM
Points: 298, Visits: 230
thanks for your reply but do you have any idea why my DB went to suspect mode?
Post #1013563
Posted Sunday, October 31, 2010 6:38 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Wednesday, July 23, 2014 12:40 AM
Points: 7,001, Visits: 8,439
it went into suspect mode, because sqlserver keeps synchronisation indicators internally. Because you copied the mdf and then brought the db online, the log file got another sync number than the mdf you copied to the new location.

After restarting sqlserver, these numbers are being checked and it discovered this out of syn situation, so it had to put it in suspect mode.


Johan


Don't drive faster than your guardian angel can fly ...
but keeping both feet on the ground won't get you anywhere

- How to post Performance Problems
- How to post data/code to get the best help


- How to prevent a sore throat after hours of presenting ppt ?


"press F1 for solution", "press shift+F1 for urgent solution"


Need a bit of Powershell? How about this

Who am I ? Sometimes this is me but most of the time this is me
Post #1013567
Posted Sunday, October 31, 2010 6:57 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Today @ 1:50 PM
Points: 6,191, Visits: 13,340
also, you don't need to restart the sql server sevices when changing a database file location with alter database, the offline\online will be sufficient!

-----------------------------------------------------------------------------------------------------------

"Ya can't make an omelette without breaking just a few eggs"
Post #1013569
Posted Sunday, October 31, 2010 7:37 AM
SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Friday, June 27, 2014 2:22 AM
Points: 298, Visits: 230
thanks alot for your kind guidence champions.
Post #1013573
Posted Monday, November 1, 2010 4:35 AM


Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Thursday, July 24, 2014 7:10 AM
Points: 1,155, Visits: 4,624
pujain (10/31/2010)
thanks alot for your kind guidence champions.



Read the Jonathan's article


For better clear


Muthukkumaran Kaliyamoorthy

Helping SQL DBAs and Developers >>>SqlserverBlogForum
Post #1013743
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse