Tuesday, April 14, 2009

Got irritated by the Sharepoint GUID naming conventions!!!!!!!

Give your own naming conventions to the sharepoint databases instead of the GUID names generated on its own.

There is always a creation of the sharepoint admin content database when we configure MOSS 2007. If we are using a single database server and have multiple MOSS farms, then problems comes up related to manageability of the databases. There is always confusion among the sharepoint content DBs as they are differenciated from each other by the GUIDs mentioned in their names. To avoid such confusions, follow the below steps-
For example,
1> Take a backup of the admin content database "SharePoint_AdminContent_046d584c-2f4b-49a3-93df-a7bd0dde771f" and restore it as "Servername_Sharepoint_AdminContent" on the same database server.

2> create a command file with the below details and name it as renameDB.cmd. Please note the the text between [] should be provided by you before you run the command file.
Rem splpri = SQL server
Rem mossdb_old = old Moss content Database
Rem mossdb_new = new Moss content Database
Rem mosssite = Moss URLRem
sspadm = SSP login acct
Rem ssppass = Password for ssp login
Rem domain = domain for sspadmin login

SET sqlpri= [Database Server Name]
SET mossdb_old=SharePoint_AdminContent_046d584c-2f4b-49a3-93df-a7bd0dde771f
SET mossdb_new=ServerName_Sharepoint_AdminContent
SET mosssite=http:// [Central Administration URL]
SET sspadm= [Service Account]
SET ssppass= [Service Account pwd]
SET domain= [Service account Domain]
--------------------------ECHO.
ECHO Preparing %mosssite% Content Databasestsadm -o preparetomove -contentdb %sqlpri%:%mossdb_old% -site %mosssite%

ECHO Removing content database for %mosssite%
stsadm -o deletecontentdb -url %mosssite% -databasename %mossdb_old% -databaseserver %sqlpri%

ECHO Stopping and restarting IISECHO.

iisreset /noforce

ECHO.

ECHO Adding content database for %mosssite%

stsadm -o addcontentdb -url %mosssite% -databasename %mossdb_new% -databaseserver %sqlpri%

ECHO Stopping and Restarting IIS

ECHO.

cd\iisreset

Create a CMD File

1> Create a new text document.
2> Copy paste the highlighted text as mentioned above into the text file
3> Rename the text file as RENAMEDB.cmd
4> This shall create the command file.

Once the command file is created, Copy the command file to the BIN folder of the sharepoint i.e. "C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\BIN" in the web server. Then from the command prompt go to the above path and type RENAMEDB.cmd and press enter. This should be it.

You can verify the same by going to application management--> content databases--> then select the central administration. Here you can see your new content database name coming up.

You can go back to the database server and delete the "SharePoint_AdminContent_046d584c-2f4b-49a3-93df-a7bd0dde771f".

No comments:

Post a Comment