How to restore a web application in Sharepoint 2007 by using SQL backup
In Sharepoint 2007, Every web application has its own database.
As my experiences are mostly on oracle, I am not really an expert in SQL 2005, but i just tried this scenario and it worked. And I think its quite a handy way to move your sharepoint web applications ( and top level sites of course!) And also by taking regular backup of your each web applications content database; you'll have a backup/recovery solution too..
Lets skip to the steps.
note that i'll call the source sharepoint installation first; and target installation as second.
The first thing you should do is, to go to Central Administration of the web app. you want to move to the second Sharepoint instance. Navigate to application management and find "content databases". Look for the name of the content database / web application you want to move. Go to sql server management studio, connect your (first)Sharepoint Database and take a backup of that content database. (by right clicking >tasks>backup)
now pick up the backup files, download them to the second Sharepoint's database server. Connect the database with sql management studio, and restore the database from backup. (right click databases, restore)
now , go to the second sharepoint's central admin. page.
Navigate Application management and Create web application.
the port name, the application name really does not matter. Just enter the name of the database you've just restored.
(Note that I installed both of the two sharepoint instances using the same windows account. So i used this account to connect both db's.)
create it, and there you go! it works :)
i think this is easier , faster and less painful than stsadm restore or import.