Tuesday, 9 February 2010

Restoring and moving a content database Sharepoint 2007

For no other reason than I have had to do this a couple of times this week and I have to keep looking it up!

Restoring a database from a backup file to another database name

RESTORE DATABASE WSS_Content_ArtworksTest
FROM DISK = N'C:\test\WSS_content_artworks.bak'
WITH FILE = 1,
MOVE N'WSS_Content_Artworks' TO N'C:\Program Files\Microsoft Office Servers\12.0\Data\MSSQL.5\MSSQL\Data\WSS_Content_ArtworksTest.mdf',
MOVE N'WSS_Content_Artworks_log' TO N'C:\Program Files\Microsoft Office Servers\12.0\Data\MSSQL.5\MSSQL\Data\WSS_Content_ArtworksTest_log.LDF',
NOUNLOAD,
STATS = 10,
REPLACE
GO

Changing the contentdb.

The original one has been removed using Central Admin. AssignNewDatabaseID is because I already have this database running another site.

stsadm -o addcontentdb -url http://url:6001 -databasename wss_content_ArtworksTest -assignnewdatabaseid D8833462-FD
59-464f-89F3-55CF7AAA6206

No comments:

Post a Comment