Category Archives: Computers

Real men do not test backups, remember?

I always said, real men don’t make backups for their important data 🙂
I do not want to lose data. I am in IT industry for some time, and I know, that it is not “IF hard drive will fail”** … but “when will it fail”. Here is the story we all can learn from:

About 20 years ago, I worked for a company which I shall not name, which used CVS as its source repository. All of the developers’ home directories were NFS mounted from a central Network Appliance shared storage (Network Appliance was the manufacturer of the NAS device), so everyone worked in and built on that one central storage pool. The CVS repository also lived in that same pool. Surprisingly, this actually worked pretty well, performance-wise.

One of the big advantages touted for this approach was that it meant that there was a single storage system to back up. Backing up the NA device automatically got all of the devs’ machines and a bunch more. Cool… as long as it gets done.

One day, the NA disk crashed. I don’t know if it was a RAID or what, but whatever the case, it was gone. CVS repo gone. Every single one of 50+ developers’ home directories, including their current checkouts of the codebase, gone. Probably 500 person-years of work, gone.

Backups to the rescue! Oops. It turns out that the sysadmin had never tested the backups. His backup script hadn’t had permission to recurse into all of the developers’ home directories, or into the CVS repo, and had simply skipped everything it couldn’t read. 500 person-years of work, really gone.


Luckily, we had a major client running an installation of our hardware and software that was an order of magnitude bigger and more complex than any other client. To support this big client, we constantly kept one or two developers on site at their facility on the other side of the country. So those developers could work and debug problems, they had one of our workstations on-site, and of course *that* workstation used local disk. The code on that machine was about a week old, and it was only the tip of the tree, since CVS doesn’t keep a local copy of the history, only a single checked-out working tree.

But although we lost the entire history, including all previous tagged releases (there were snapshots of the releases of course… but they were all on the NA box), at least we had an only slightly outdated version of the current source code. The code was imported into a new CVS repo, and we got back to work.

In case you’re wondering about the hapless sysadmin, no he wasn’t fired. That week. He was given a couple of weeks to get the system back up and running, with good backups. He was called on the carpet and swore on his mother’s grave to the CEO that the backups were working. The next day, my boss deleted a file from his home directory and then asked the sysadmin to recover it from backup. The sysadmin was escorted from the building two minutes after he reported that he was unable to recover the file.

from Slashdot by swillden.

** I am talking not only about HDD, but about media in general. And this also applies to humans, because we humans are making mistakes too, and we lose data every day.

Solution to “The term ‘-Version’ is not recognized as the name of a cmdlet…”

When trying to run PowerShell.exe with command line argument -Version, you may get the following error:
-Version : The term '-Version' is not recognized as the name of a cmdlet,
function, script file, or operable program. Check the spelling of the name, or
if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ -Version 2.0 -InputFormat none -File C:\SomeFolder\YoutScript.ps1
+ ~~~~~~~~
+ CategoryInfo : ObjectNotFound: (-Version:String) [], CommandNot
+ FullyQualifiedErrorId : CommandNotFoundException

The command line used:
powershell.exe -ExecutionPolicy Bypass -Version 2.0 -InputFormat none -File C:\SomeFolder\YoutScript.ps1

You can resolve this error, by changing order of Version parameter:

powershell.exe -Version 2.0 -ExecutionPolicy Bypass -InputFormat none -File C:\SomeFolder\YoutScript.ps1

This seems like a bug, because official documentation for the PowerShell does not mention order of parameters. Even more, the use Execution Policy before Version. See the following PowerShell help article in MS site.

VMware vSphere Client could not connect to vCenter version 5.1.0

Recently we had an issue, where we were unable to connect to one of our VMware ESXi vCenter’s (v5.1.0) with vSphere Client. Everything worked, all virtual machines were up, except vCenter.

Digging deeper, the log files revealed the following:
2014-09-19T09:01:09.494+03:00 [02156 warning 'Default'] [VdbStatement] SQL execution failed: cleanup_events_tasks_proc
2014-09-19T09:01:09.494+03:00 [02156 warning 'Default'] [VdbStatement] Execution elapsed time: 69482 ms
2014-09-19T09:01:09.494+03:00 [02156 warning 'Default'] [VdbStatement] Diagnostic data from driver is 42000:1:9002:[Microsoft][SQL Server Native Client 10.0][SQL Server]The transaction log for database 'VIM_VCDB' is full. To find out why space in the log cannot be reused, see the log_reuse_wait_desc column in sys.databases
2014-09-19T09:01:09.494+03:00 [02156 warning 'Default'] [VdbStatement] Bind parameters:
2014-09-19T09:01:09.494+03:00 [02156 error 'Default'] [Vdb::IsRecoverableErrorCode] Unable to recover from 42000:9002
2014-09-19T09:01:09.494+03:00 [02156 error 'Default'] [VdbStatement] SQLError was thrown: "ODBC error: (42000) - [Microsoft][SQL Server Native Client 10.0][SQL Server]The transaction log for database 'VIM_VCDB' is full. To find out why space in the log cannot be reused, see the log_reuse_wait_desc column in sys.databases" is returned when executing SQL statement "cleanup_events_tasks_proc"
2014-09-19T09:01:09.494+03:00 [02156 error 'vpxservicesvpxdEventTaskCleanup'] [VpxdEventTaskCleanup] Error during Event/Task Cleanup: "ODBC error: (42000) - [Microsoft][SQL Server Native Client 10.0][SQL Server]The transaction log for database 'VIM_VCDB' is full. To find out why space in the log cannot be reused, see the log_reuse_wait_desc column in sys.databases" is returned when executing SQL statement "cleanup_events_tasks_proc"
2014-09-19T09:01:09.494+03:00 [02156 warning 'VpxProfiler'] VpxUtil_InvokeWithOpId [TotalTime] took 69482 ms

So we need to clean up the Transaction log for the MS SQL server, or clean up some tables… so we found an article from VMware support – KB1025914.

From VMware, to purge the data in the VPX_EVENT table:

1. Connect to Servername\SQL Database and log in with the appropriate credentials.
2. Click databases to expand and select VIM_VCDB > Tables.
3. Right-click the dbo.VPX_PARAMETER table and select Open.

Note: If you are using SQL Server 2008, right-click the dbo.VPX_PARAMETER table and click Edit Top 200 Rows.
4. Modify event.maxAge to 30, and modify the event.maxAgeEnabled value to true.
5. Modify task.maxAge to 30, and modify the task.maxAgeEnabled value to true.

Note: To improve the time of the data cleanup, run the preceding steps in several intervals. To do this, ensure to keep the default value of event.maxAge and task.maxAge and perform step 6 to run the cleanup. Then, reduce the event.maxAge andtask.maxAge value by 60 and run the cleanup. Repeat the steps until the value is reached to 30 for the final cleanup process.
6. Run the built-in stored procedure:
a. Go to VIM_VCDB > Programmability > Stored Procedures.
b. Right-click dbo.cleanup_events_tasks_proc and select Execute Stored Procedure.

This purges the data from the vpx_event, vpx_event_arg, and vpx_task tables based on the date specified for maxAge.
c. When this has successfully completed, close SQL Management Studio and start the VMware Virtual Center Server service.
To ensure that the default Statistics Level is set to 1:

1. Using the vSphere Client, log into vCenter Server as an administrator.
2. Go to Administration > vCenter Server Settings > Statistics.
3. Under Statistics Intervals, ensure the Statistics Level column is set to 1.
4. To change the value, select the Interval Duration, click Edit and select Level 1 from the dropdown

To download SQL Management Studio 2008 R2 follow this Microsoft SQL Server 2008 R2 RTM – Management Studio Express.

Everything went smooth, except, we didn’t know the SQL server name, and SQL Server 2008 R2 didn’t help much. Later we found, that the name is “.\VIM_SQLEXP”, see the screenshot below.