Tag Archives: Database

XenDesktop

Citrix XenDesktop SQL Database: Display all client connections

One of my customers came up to me and asked me how to query the Citrix XenDesktop Database using SQL queries to get a list of all connections that have been made.
The first thing to keep in mind is, that XenDesktop stores the information only for a couple of days – depending on your license (Enterprise or Platinum licenses). So if you’re interested in a long-term solution, then you should put the output / result of my query into another database or file for archiving.

Read More
VMware

VMware vCenter Database Shrink Script

Whenever you’re using VMware vCenter in conjunction with Microsoft SQL Server Express Edition one day your database will run out of free space and vCenter Service will crash.

In VMware vCenter Server Settings, you can configure a period of time how long to retain old events and tasks in the database. Unfortunately, the cleanup process is a SQL Server Agent Job – remember: the free SQL Server Express Edition does not have an SQL Server Agent Service.

Many of my customers experienced this problem so I decided to write a simple batch script:

osql.exe -S VCSERVVCenter -U vpxadm -P vpxadm -d VCDB -Q "cleanup_events_tasks_proc"
osql.exe -S VCSERVVCenter -U vpxadm -P vpxadm -d VCDB -Q "DBCC SHRINKDATABASE(N'VCDB' )"
osql.exe -S VCSERVVCenter -U vpxadm -P vpxadm -d VCDB -Q "DBCC SHRINKFILE (N'VCDB' , 0, TRUNCATEONLY)"

You just need to modify the parameters, like database server, instance name, user, password e.g. to fit your environment.

Now you can just create a simple Windows Task using the Scheduled Task functionality to run this script periodically.

That’s it – your database won’t be run out of space anymore…

Read More