Book Image

Microsoft Exchange Server PowerShell Cookbook

Book Image

Microsoft Exchange Server PowerShell Cookbook

Overview of this book

Table of Contents (21 chapters)
Microsoft Exchange Server PowerShell Cookbook Third Edition
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

Moving databases and logs to another location


As your environment grows or changes over time, it may be necessary to move one or more databases and their log streams to another location. This is one of those tasks that's required to be done from the Exchange Management Shell. As an advantage, the Shell gives you some more flexibility. In this recipe, you will learn how to move the database and log files to another location.

How to do it...

To move the database file and log stream from the DB1 database to a new location, use the following command syntax:

Move-DatabasePath -Identity DB1 `
-EdbFilePath F:\Databases\DB1\Database\DB1.edb `
-LogFolderPath F:\Databases\DB1\Logs `
-Confirm:$false `
-Force

After executing the preceding command, the DB1 database and log files will be moved to the F:\Databases\DB1\Database directory, without prompting you for a confirmation.

How it works...

In this example, you can see that we are moving both the database file and the transaction logs to the same directory...