Automated Testing Users

Imagine a situation where a production database is copied to test, and the data scrambled. Our testers want to access the database because they need to find some data to use for testing.

  • The testing is automated.
  • The refresh is automated
  • The scrambling is automated.

How do we get the testers the password in a secure fashion? Also, how do we ensure testers don’t just use the test user normally? They should log in with their own user name and passwords. Also, the test user shouldn’t have the same password all the time, it should change periodically. This will ensure that if a tester has found out the password because they need it to develop the automated tests, they won’t know it after they leave, or be tempted to use it when they ought to be using their own user name.

Reducing Downtime With Tmadmin

Reducing Downtime

I want to reduce down time. Is it possible to clear a cache, or to restart a server without downtime? Tmadmin is provided by Oracle to perform low level tasks and includes this type of functionality.

Lets have a look.

Purging the cache

This can’t be done if cache sharing is enabled, but if it isn’t, it clears the cache for each process one at a time without downtime.

Un-Delete Open file

There is a way to un-delete a file if a program has it open in Linux.

How directory entries work in Unix

When you remove a file on Linux, what actually happens is that the file is unlinked. Lets have a look. I start with a clean directory:

1
2
3
4
$ ls -la
total 4
drwxrwxr-x  2 me me    6 Sep  4 15:58 .
drwxrwxr-x 14 me me 4096 Sep  4 15:28 ..

The directory has two entries, the current directory and the parent directory. The second entry, the number (2 and 14 above), is the number of links to the file. The current directory has 2 links, one for it’s entry in itself ‘.’ and one for its entry in the parent directory. If we create a file, it has one link:

Delete Online Logs

In the Oracle training courses they always say:

Your junior DBA deleted the online redo logs.

Of course, it is never your junior DBA that does that. They are standing behind you laughing.

Anyway, what to do if your junior DBA deletes the online redo logs. Or even if someone else does it, is first of all, not to panic. According to Ask TOM the worst thing to do is a shut down abort because if you do that, the database will need to be recovered from the online redo logs, and they have been removed.

More Windows Woes

Introduction

Having tested my Windows Ansible build all seemed to be going well. A colleague took the script and ran it, and all seemed to be well, except that Microsoft word didn’t work - It just hung.

The Problem

On the Windows process scheduler Microsoft Office can be invoked to run a macro to populate a template to form a Word Document.

The problem was that despite the Ansible install having run, and supposedly being repeatable, it didn’t work. The process never ended. Looking at task manager we can see that Microsoft Word is running, but it never ended.

Vagrant Multi VM provisioning

Multiple VMs required

I am looking into Postgresql, replication and fail over. One way to set this up is to have a primary, a standby and a witness server. Two run databases, and one - the witness to decide whether a fail over is needed. To test this it would be nice to create three VMs on my desktop to help test ansible scripts. I have downloaded Virtualbox from Oracle, and my desktop has loads of memory. It would be nice to be able to script the creation of the VMs and then be able to run the same ansible playbook that has been developed for the “real” VMs. Then I can learn postgres and help develop the playbook and associated scripts.

How We Use Ansible

Introduction

I realise I have written a few posts on Ansible, but no overview on how we manage it. I haven’t done any training on Ansible, and this is my first effort at automation (Apart from some bash and python scripts) so there is probably much that could be improved.

Our Systems

We have about 15 - 25 environments to manage, depending on how you count them. Around 2-5 of these are vanilla in one form or another, so don’t need to be managed by Ansible. The rest are all production like to some extent, so need to be managed in a similar manner.

Ansible Strings And Numbers

I had a playbook fail because of the error dict object has no element

It took me ages to debug it, but the problem is that I had defined the index as a string, but was trying to match it to a number. To fix it, I only had to quote the version in the inventory, and everything worked.

I was only caught by this because I was using an old inventory file to test with. I think it used to automatically cast numbers to string, but that stopped a while ago.