|
Question : migrating SQL databases to another server and get some weird error messages
|
|
I have SQL Server 2005 running in Windows Server 2003. Now Im transfering these databases to SQL Server 2008 running in Windows Server 2008.
First I have made scripts to create databases to destination server (look the code).
SELECT 'CREATE DATABASE ' + name FROM master.dbo.sysdatabases Where Name Not In ('master','model','msdb','tempdb')
Then I have run that script in detination server.
Then I have made backup from source SQL by script
SELECT 'BACKUP DATABASE ' + name + ' TO DISK = ''C:\Backups\' + name + '.bak''' + ' WITH NOFORMAT, NOINIT, NAME = N''' + name + '-Full Database Backup''' + ', SKIP, NOREWIND, NOUNLOAD, STATS = 10' FROM master.dbo.sysdatabases Where Name Not In ('master','model','msdb','tempdb')
Then I have restored my backups to destination server
SELECT 'RESTORE DATABASE ' + name + ' FROM DISK = ''C:\Backups\' + name + '.bak'''+ ' WITH REPLACE' FROM master.sys.databases Where Name Not In ('master','model','msdb','tempdb')
Restore process works mostly but there is some databases where I get error messages:
Directory lookup for the file "F:\Econet SQL Server\MSSQL.1\MSSQL\DATA\c01_ec.mdf" failed with the operating system error 3(The system cannot find the path specified.). Msg 3156, Level 16, State 3, Line 1 File 'c01_ecDATA' cannot be restored to 'F:\Econet SQL Server\MSSQL.1\MSSQL\DATA\c01_ec.mdf'. Use WITH MOVE to identify a valid location for the file. Msg 5133, Level 16, State 1, Line 1 Directory lookup for the file "F:\Econet SQL Server\MSSQL.1\MSSQL\DATA\c01_ecl.ldf" failed with the operating system error 3(The system cannot find the path specified.). Msg 3156, Level 16, State 3, Line 1 File 'c01_eclLOG' cannot be restored to 'F:\Econet SQL Server\MSSQL.1\MSSQL\DATA\c01_ecl.ldf'. Use WITH MOVE to identify a valid location for the file. Msg 3119, Level 16, State 1, Line 1 Problems were identified while planning for the RESTORE statement. Previous messages provide details. Msg 3013, Level 16, State 1, Line 1 RESTORE DATABASE is terminating abnormally. Msg 5133, Level 16, State 1, Line 2 Directory lookup for the file "F:\Econet SQL Server\MSSQL.1\MSSQL\DATA\c01_ec1.mdf" failed with the operating system error 3(The system cannot find the path specified.). Msg 3156, Level 16, State 3, Line 2 File 'c01_ec1DATA' cannot be restored to 'F:\Econet SQL Server\MSSQL.1\MSSQL\DATA\c01_ec1.mdf'. Use WITH MOVE to identify a valid location for the file. Msg 5133, Level 16, State 1, Line 2 Directory lookup for the file "F:\Econet SQL Server\MSSQL.1\MSSQL\DATA\c01_ecl1.ldf" failed with the operating system error 3(The system cannot find the path specified.). Msg 3156, Level 16, State 3, Line 2 File 'c01_ecl1LOG' cannot be restored to 'F:\Econet SQL Server\MSSQL.1\MSSQL\DATA\c01_ecl1.ldf'. Use WITH MOVE to identify a valid location for the file. Msg 3119, Level 16, State 1, Line 2 Problems were identified while planning for the RESTORE statement. Previous messages provide details. Msg 3013, Level 16, State 1, Line 2 RESTORE DATABASE is terminating abnormally. Msg 5133, Level 16, State 1, Line 3 Directory lookup for the file "F:\Econet SQL Server\MSSQL.1\MSSQL\DATA\c01_ec2.mdf" failed with the operating system error 3(The system cannot find the path specified.). Msg 3156, Level 16, State 3, Line 3 File 'c01_ec2DATA' cannot be restored to 'F:\Econet SQL Server\MSSQL.1\MSSQL\DATA\c01_ec2.mdf'. Use WITH MOVE to identify a valid location for the file. Msg 5133, Level 16, State 1, Line 3 Directory lookup for the file "F:\Econet SQL Server\MSSQL.1\MSSQL\DATA\c01_ecl2.ldf" failed with the operating system error 3(The system cannot find the path specified.). Msg 3156, Level 16, State 3, Line 3 File 'c01_ecl2LOG' cannot be restored to 'F:\Econet SQL Server\MSSQL.1\MSSQL\DATA\c01_ecl2.ldf'. Use WITH MOVE to identify a valid location for the file. Msg 3119, Level 16, State 1, Line 3 Problems were identified while planning for the RESTORE statement. Previous messages provide details. Msg 3013, Level 16, State 1, Line 3 RESTORE DATABASE is terminating abnormally. Msg 5133, Level 16, State 1, Line 4 Directory lookup for the file "F:\Econet SQL Server\MSSQL.1\MSSQL\DATA\c01_ec3.mdf" failed with the operating system error 3(The system cannot find the path specified.). Msg 3156, Level 16, State 3, Line 4 File 'c01_ec3DATA' cannot be restored to 'F:\Econet SQL Server\MSSQL.1\MSSQL\DATA\c01_ec3.mdf'. Use WITH MOVE to identify a valid location for the file. Msg 5133, Level 16, State 1, Line 4 Directory lookup for the file "F:\Econet SQL Server\MSSQL.1\MSSQL\DATA\c01_ecl3.ldf" failed with the operating system error 3(The system cannot find the path specified.). Msg 3156, Level 16, State 3, Line 4 File 'c01_ecl3LOG' cannot be restored to 'F:\Econet SQL Server\MSSQL.1\MSSQL\DATA\c01_ecl3.ldf'. Use WITH MOVE to identify a valid location for the file. Msg 3119, Level 16, State 1, Line 4 Problems were identified while planning for the RESTORE statement. Previous messages provide details. Msg 3013, Level 16, State 1, Line 4 RESTORE DATABASE is terminating abnormally. Processed 5808 pages for database 'c100_common', file 'c100_ecDATA' on file 1. Processed 4 pages for database 'c100_common', file 'c100_eclLOG' on file 1. Converting database 'c100_common' from version 611 to the current version 655. Database 'c100_common' running the upgrade step from version 611 to version 621. Database 'c100_common' running the upgrade step from version 621 to version 622. Database 'c100_common' running the upgrade step from version 622 to version 625. Database 'c100_common' running the upgrade step from version 625 to version 626. Database 'c100_common' running the upgrade step from version 626 to version 627. Database 'c100_common' running the upgrade step from version 627 to version 628. Database 'c100_common' running the upgrade step from version 628 to version 629. Database 'c100_common' running the upgrade step from version 629 to version 630. Database 'c100_common' running the upgrade step from version 630 to version 631. Database 'c100_common' running the upgrade step from version 631 to version 632. Database 'c100_common' running the upgrade step from version 632 to version 633. Database 'c100_common' running the upgrade step from version 633 to version 634. Database 'c100_common' running the upgrade step from version 634 to version 635. Database 'c100_common' running the upgrade step from version 635 to version 636. Database 'c100_common' running the upgrade step from version 636 to version 637. Database 'c100_common' running the upgrade step from version 637 to version 638. Database 'c100_common' running the upgrade step from version 638 to version 639. Database 'c100_common' running the upgrade step from version 639 to version 640. Database 'c100_common' running the upgrade step from version 640 to version 641. Database 'c100_common' running the upgrade step from version 641 to version 642.
Can some one help why I get these error messages? This path: "F:\Econet SQL Server\MSSQL.1\MSSQL\DATA\c01_ecl2.ldf" should have nothing to do with destination server. It's location of databases in source server. So what might be wrong?
Thanks a lot :)
|
|
Answer : migrating SQL databases to another server and get some weird error messages
|
|
Hawks pointed you in the right direction; here is the full snippet.
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
|
string constr = ConfigurationSettings.AppSettings["ConnString"];
string insertString = "INSERT INTO FormUsers (firstName,lastName,emailAdd, ipAddress, interestedIn, datesubmitted)" +
"values ('" + GetHiddenValuesfName + "','" + GetHiddenValueslName + "','" + GetHiddenValuesEmail + "','" + HttpContext.Current.Request.UserHostAddress + "','" + GetHiddenValuesTab + "','" + DateTime.Now + "')";
SqlConnection conn = new SqlConnection(constr);
conn.Open();
SqlCommand cmd = new SqlCommand(insertString, conn);
cmd.ExecuteNonQuery();
conn.Close();
|
|
|
|
|