My Oracle Data Guard HowTo

Just my notes on using Data Guard, I also have some for Data Guard Broker.

Advertisements

Bad interface, bad interface (vSphere UI)

So, I’m using vSphere for the first time, and I don’t see any info where I expect it to be (actually because I didn’t have privileges to see it). I’m thinking maybe I just need to refresh the screen for the VM I’m looking at and click the refresh button.

Bad, bad, vSphere, don’t you know what the “refresh” button looks like … seriously, rebooting a VM is not a good thing to do by accident and you aren’t helping with that problem by using what looks like a refresh button for a reboot button.

 

Am I wrong here? Let me know.

How to reference a shell variable named by another shell variable

Have you ever had the need to get the value of a shell variable, but the name was all, or partly, determined by another shell variable. That happened to me this week and once you know how to do it it is pretty simple, but it is hard to figure it out.

I’ll try to clarify. I have a shell variable that has been set with a password. To find that variable I have another variable. The second variable is the User Name and is called USER. The first is the password and is called USERPW. (Note: I’m not saying this is the best way to handle passwords, it is what I had to work with.)

In a given situation I’ll need the password for a user that is provided by the variable USER. I thought I could get this in a variety of ways:

$${USER}pw}
${${USER}PW}

etc…

To end the story and give you what you came looking for. Here is the solution (in a test script):

->cat deref.ksh
#!/bin/bash
export USER=MYUSER
export USERPW=
. /somewhere/pwds.sh # this script sets environment variables with passwords
echo echo deference
eval USERPW=\$${USER}PW
echo ${USER}
echo ${USERPW}
sqlplus -s ${USER}/${USERPW} << eof
show user
eof

Here is the output that shows it worked. The last line is the output from the Oracle database.

->./deref.ksh
echo deference
MYUSER 
mysupersecret
USER is "NDTC_DBA"

Selecting rows when the data does not exist

This just came up again at a job. The customer needs to select a month worth of results for a particular object in their system, but the data does not exist for a whole month. Even if it doesn’t they need to show a row for it. So here is how you can Select rows when the data does not exist

Taking care of your computer (Windows)

I’ve created this page for my family, so they don’t have to remember what to do. If you don’t do these things you really should. Please click here…

A simple Oracle Point-In-Time Recovery

As stated, a nice simple example of Oracle Point-In-Time recovery…

Re-create user SQL script

The following is a script I created to generate a script to recreate specific users from a database, so they can be created elsewhere. I typically use this for end-users who do not have schemas. Read here Re-create user SQL script