I need a PowerShell script which could perform the following:
- How to Back up and Content Database of a Web Application
- Restore a Content Database on a newly created Web Application
If both web apps are in the same farm, the fastest and easiest way is to detach DB from app A and reattach DB from B.
This script should do the job (can't test by now, don't fire it blindly).
[Edit] and of course, backup the whole content database before
Using the SharePoint PowerShell console
See this MSDN article: Use Windows PowerShell to back up a Web application in SharePoint Server.
Use this command to restore a content DB:
See this TechNet article: Use Windows PowerShell to restore a SharePoint content database.
Please ensure that you understand these commands and run tests to know what is going to happen. Other links: