SQL database location, in the Citrix XenApp / Presentation Server forum on BrianMadden.com
Brian Madden Logo
Your independent source for desktop virtualization, consumerization, and enterprise mobility management.

SQL database location, in the Citrix XenApp / Presentation Server forum on BrianMadden.com

rated by 0 users
Answered (Verified) This post has 1 verified answer | 6 Replies | 2 Followers

Top 100 Contributor
Points 2,634
Mowens posted on Mon, Dec 7 2009 2:36 PM

Is there a way to see the location of my database? This particular farm was built before I got here, and there is no documentation. How can I see where it is located?

Bonus points:

is it possible to move the database to anouther server? Or do I have to rebuild the farm?

  • | Post Points: 20

Answered (Verified) Verified Answer

Top 10 Contributor
Points 48,651
Verified by Mowens

Yes, you can move the database (once you find out where it is).  There is no need to rebuild.  I've moved our database two or three times over the last three years and it's never been a problem.  As for finding it, try running the following VBS script on one of your farm servers:

Const HKEY_LOCAL_MACHINE = &H80000002

strComputer = "."

Set objReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\default:StdRegProv")

' Get the Farm name and DataSourceName environment variable for this server.

strKeyPath = "Software\Citrix\IMA"
strEntryName = "Neighborhood"
objReg.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath,strEntryName,strFarmName
strEntryName = "DataSourceName"
objReg.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath,strEntryName,strDataSourceName

' Display the current Farm name and DataSourceName

WScript.Echo "Current Farm: "& strFarmName
WScript.Echo "Current DataSourceName: "& strDataSourceName

Const ForReading = 1
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objTextFile = objFSO.OpenTextFile(strDataSourceName, ForReading)
Do While objTextFile.AtEndOfStream <> True
 strLinetoParse = objTextFile.ReadLine
 if Left(strLinetoParse, 7) = "SERVER=" then Wscript.Echo strLinetoParse
 if Left(strLinetoParse, 9) = "DATABASE=" then Wscript.Echo strLinetoParse
Loop
objTextFile.Close

It will display the DSN file you are currently using, what the conncetion strings are to your database (and therefore its location) and so on.  Hope this helps!

Dan

 

Why is it called "Common Sense"? It doesn't seem all that common!

  • | Post Points: 40

All Replies

Top 10 Contributor
Points 48,651
Verified by Mowens

Yes, you can move the database (once you find out where it is).  There is no need to rebuild.  I've moved our database two or three times over the last three years and it's never been a problem.  As for finding it, try running the following VBS script on one of your farm servers:

Const HKEY_LOCAL_MACHINE = &H80000002

strComputer = "."

Set objReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\default:StdRegProv")

' Get the Farm name and DataSourceName environment variable for this server.

strKeyPath = "Software\Citrix\IMA"
strEntryName = "Neighborhood"
objReg.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath,strEntryName,strFarmName
strEntryName = "DataSourceName"
objReg.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath,strEntryName,strDataSourceName

' Display the current Farm name and DataSourceName

WScript.Echo "Current Farm: "& strFarmName
WScript.Echo "Current DataSourceName: "& strDataSourceName

Const ForReading = 1
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objTextFile = objFSO.OpenTextFile(strDataSourceName, ForReading)
Do While objTextFile.AtEndOfStream <> True
 strLinetoParse = objTextFile.ReadLine
 if Left(strLinetoParse, 7) = "SERVER=" then Wscript.Echo strLinetoParse
 if Left(strLinetoParse, 9) = "DATABASE=" then Wscript.Echo strLinetoParse
Loop
objTextFile.Close

It will display the DSN file you are currently using, what the conncetion strings are to your database (and therefore its location) and so on.  Hope this helps!

Dan

 

Why is it called "Common Sense"? It doesn't seem all that common!

  • | Post Points: 40
Top 100 Contributor
Points 2,634

That did it. Thank you.

  • | Post Points: 5
Top 100 Contributor
Points 2,634
Mowens replied on Wed, Feb 24 2010 12:55 PM

Is there a way I can do this without scripting it? Maybe looking in the registry or something?

  • | Post Points: 20
Top 10 Contributor
Points 48,651

If you look at the script, a lot of the information comes from the registry anyway.  The script just pullsit all together more conveniently, since some of the data has to be extracted from the DSN file that the registry points to.

Why is it called "Common Sense"? It doesn't seem all that common!

  • | Post Points: 20
Top 100 Contributor
Points 2,634
Mowens replied on Wed, Feb 24 2010 1:10 PM

I did notice that. However, I dont see the locations in the registry. Would this be different for XenApp 5.0 on server 2008?

  • | Post Points: 20
Top 10 Contributor
Points 48,651

That's entirely possible.  I have not yet had the opportunity to run this script against a XA5 server.  The Base OS shouldn't matter, but who knows...

Why is it called "Common Sense"? It doesn't seem all that common!

  • | Post Points: 5
Page 1 of 1 (7 items) | RSS