Tag Archives: SQL

Programming Synology

Edit Synology Photo Station Album Permissions via Script

I’m using Synology Photo Station for storing all my pictures and share access to all family members. Being an IT-Guy I’m very concerned about security and especially the access rights to all albums. Unfortunately, Synology marks a new album always as public. Instructing my family to set the correct album permissions didn’t work because they’re normal users and they don’t want to do any settings for albums. They just want to access and upload their photos.

Synology Photo Station Permissions

At this point, I decided to have a look on the Postgres SQL Database that is being used

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