I have recently taken over a client that is moving to a new Application running on SQL 2005. The previous tech left everything in the default C: but we have limited space. The Application has been installed and it created a new database. I would like to use this script to move the system DB's and the Application DB.
Can I add the following where APPDB is the application created database in the respective locations:
sqlcmd -E -S%SQLName% -Q"ALTER DATABASE tempdb MODIFY FILE (NAME = 'APPDB', FILENAME = '%NewPath%\APPDB.mdf')"
sqlcmd -E -S%SQLName% -Q"ALTER DATABASE APPDB MODIFY FILE (NAME = 'APPDB', FILENAME = '%NewPath%\APPDB.ldf')"
move %OldPath%\APPDB.mdf %NewPath%
move %OldPath%\APPDB.ldf %NewPath%
This is a low risk as it is a new server and application (could be rebuilt at a high $ cost to customer), but it could be useful knowledge as I run into these type of situations in my line of work.