Oracle Labs by Yuri Khazin, Oracle DBA

May 16, 2016

Linux 6.7 telnet: connect to address x.x.x.x: No route to host

Filed under: Uncategorized — oraclelabs @ 15:39

You are trying to connect with telnet to a freshly unwrapped Red Hat Linux 6.7 (or a derivative, such as Oracle OEL). Why would you use such a commonly despised tool as telnet begs an explanation. Well telnet is still a useful diagnostics tool, sometimes you need to check if you can talk to a web server, to a mail server or, in our case, to Oracle listener on a particular port. And you may run into an interesting problem while trying (other than a fact you need to install telnet binaries as it is not usually included).

So you can ping the other host (which is a Linux 6.7), you can even ssh to it, but the telnet will give you “No route to host” message.

Since ping and ssh do work you rule out the gateway settings (/etc/sysconfig/network) on the client side, the routing table or client side firewall (well, it still could be just it). But a quick check on the target side will show that it’s indeed firewall issue. When you shut down the target’s firewall the telnet message will change to “Connection refused” that is, if you attepmpt to talk to a port where no process is listening. Telnet to a port 1521 returns Oracle listener response. Picture below illustrates just that.

image

So what to do now? We need to add a rule to the firewall on the target side for a particular protocol and port. For instance, port 1521 for Oracle’s listener. Here are the ‘out of the box’ rules:

image

Last rule in the INPUT chain is a reject rule. Adding more rules after it is pointless, the new rule has to be added before the ‘reject’.

iptables -I INPUT 5 -m state –state NEW -m tcp -p tcp –dport 1521 -j ACCEPT

This command will add a rule at a position 5 in the INPUT chain, pushing the last rule to position 6. That’s it. Save the iptables current configuration so it is preserved through reboot.

image

April 15, 2016

How to publish your document from Google Drive (Google Docs) to WordPress

Filed under: Uncategorized — oraclelabs @ 08:52

Want a short answer? – It’s complicated but possible.

As of this time (April 2016) I have tried many different ways to transfer some of my writings from Google Docs to wordpress.com based blog and can’t claim a success. Thing is, both Google and WordPress are constantly changing their API and security and what not, so various plug-ins and techniques just can’t keep up with these changes. Eventually, I came up with a lesser evil approach. That is – the use of a desktop program named  Open Live Writer, which is a successor to Microsoft Live Writer, but now as an open source project.

In short, you can copy your document from Google Docs and paste it into the Live Writer (I think the old Windows Live Write will do just as well, if you happened to have it). After copying into the Writer you keep the text and the pictures (great relief) but may loose table formatting. After posting to your blog you may need to download that post back to the Writer and fix table formatting. As my blog is heavy on in-text pictures this approach was a salvation for me and a great time saver, I can’t imagine being forced to manually upload and re-insert my screenshots into the blog post.There is a small complication with pictures as well, I found out that later. When you copy-paste your document, what gets copied is HTML. When it comes to pictures, you will get links to pictures that are still on Google Drive. If that is acceptable to you then no issue here. If you delete original document from Google and purge the trash bin the WordPress article will have lost the pictures as well. The workaround is to copy pictures one by one and paste them over again in the Writer. This way they become local pictures rather than links to remote files.

P.S. By the way, I tried BlogDesk program as well and it has lost the pictures in the transition, so – no help here. Same applies to Chrome’s plug-in “Google Docs to WordPress” – couldn’t make it work, besides, people say it needs to dial home server in order to connect to both Google and WordPress and that is a security concern.

P.S.2 If you host a wordpress on your server your story is different, there are many wordpress plug-ins that may help you, my case is wordpress.com based blogs.

April 14, 2016

RHEL 6.7, OEL 6.7 network adapters configuration and VM cloning


Cloning of a virtual machine in Oracle’s VB (Virtual Box) presents a particular pain. The exact clone, of course, is created with same MAC and IP addresses for all NICs present. Great for some purposes, not so great if you wanted a duplicate to repurpose. Then you would have reinitialized MACs during or after cloning and your trouble would start as all NICs in the clone won’t be functional upon power up. In older Linux distribution all you had to do is edit MAC addresses in the ifcfg-eth* files in /etc/sysconfig/network-scripts and that was it. Not so now.

In Linux 6 (Red Hat, Fedora, Centos) the hardware device control is primarily done by udev system and by NetworkManager service. This is an out of the box configuration. In the following exercise we will look at a case of a virtualized OEL 6.7 Server, which is a non-GUI Oracle’s package based on RHEL 6.7

Why Server edition? Because it is a headless, non-GUI distro, where all management needs to be done via command line and not through the nice desktop tools.

As stated above, in Linux 6 the udev system looks after changes in hardware and enumerates new NICs while preserving the old NIC records. Both parts are now present in this file: /etc/udev/rules.d/70-persistent-net.rules

Therefore, your /etc/sysconfig/network-scripts/ifcfg-eth* files are now not in sync with persistent rules. We will look at how they should be reconciled.

A few additional notes:

  • In my practice with OEL 6.7 the system-config-network-tui tool had no effect on configuration so I don’t recommend using it
  • Don’t just edit /etc/sysconfig/network-scripts/ifcfg-eth* files after cloning, read this article to the end to understand why you need to examine and change the udev part
  • OEL 6.7 Server (and probably Red Hat, Centos and Fedora distros) come with sshd server preconfigured with some annoying security features that make ssh login very slow. If you went through this article and still have issues logging into your machine you may need to read this guide about “Fixing SSH login long delay”

So, let’s start:

On original machine our network configuration is as follows:

eth0 is an adapter with static IP connected to host-only network

eth1 is an adapter with DHCP connected to NAT network

Both are running

Following are their respective config files

[root@oms1 network-scripts]# cat ifcfg-eth0
DEVICE=eth0BOOTPROTO=none

ONBOOT=yes

IPADDR=20.20.10.21

NETMASK=255.255.255.0

[root@oms1 network-scripts]# cat ifcfg-eth1
DEVICE=eth1HWADDR=08:00:27:F9:3C:34

TYPE=Ethernet

ONBOOT=yes

NM_CONTROLLED=yes

BOOTPROTO=dhcp

Notice, that although ifcfg-eth1 contains HWADDR keyword it is not required and can be removed when udev is allowed to manage the hardware.

Below is the contents of persistent rules (before cloning). Sometimes after cloning, the order of devices may be mixed up, so pay close attention to MAC addresses and then assign the desired names in proper order.

/etc/udev/rules.d/70-persistent-net.rules
# This file was automatically generated by the /lib/udev/write_net_rules# program, run by the persistent-net-generator.rules rules file.

#

# You can modify it, as long as you keep each rule on a single

# line, and change only the value of the NAME= key.

# PCI device 0x8086:0x100f (e1000)

SUBSYSTEM==”net”, ACTION==”add”, DRIVERS==”?*”, ATTR{address}==”08:00:27:7d:f0:88″, ATTR{type}==”1″, KERNEL==”eth*”, NAME=”eth0″

# PCI device 0x8086:0x100e (e1000)

SUBSYSTEM==”net”, ACTION==”add”, DRIVERS==”?*”, ATTR{address}==”08:00:27:f9:3c:34″, ATTR{type}==”1″, KERNEL==”eth*”, NAME=”eth1″

After cloning with MAC address re-initialized the machine comes up like this (new NICs detected but since there are no matching ifcfg-eth* files the NICs are inactive):

Old NICs are eth0 and eth1, the new ones are eth2 and eth3

Delete old NICs:

Rename the ordering of NICs:

Make sure ifcfg* files match (optionally change the static IP)

Make sure original machine is NOT online as the clone will try to come up with same static IP. Reboot the clone machine (necessary, because of change to persistent rules)

After reboot of the clone:

If you want to change the static IP you can do it in ifcfg-eth0 and then restart networks

service network restart

Acknowledgements and references:

July 18, 2014

How to check patchlevel of Oracle Database

Filed under: Oracle Database, Uncategorized — oraclelabs @ 11:18

One way would probably be going through Oracle Inventory, assuming that it is in sync with the actual software. Another way is to query the registry (the registry history).

The following query applies to 11g.

select
b.host_name,
b.instance_name,
to_char(a.action_time, ‘yyyy-mm-dd hh24:mi:ss’) action_time,
substr(a.id,1,10) id,
substr(a.action,1,15) action,
substr(a.version,1,8) version,
substr(a.BUNDLE_SERIES,1,6) bundle,
substr(a.comments,1,30) comments
from sys.registry$history a,
v$instance b
order by a.action_time desc;

If you are into running this query in sqlplus, you can use these column settings:

set lines 130 pages 60
col host_name for a15
col instance_name for a8
col action_time for a20
col id for a8
col action for a15
col version for a12
col bundle for a6
col comments for a30

February 10, 2011

Shareable disks in Virtual Box


Recent versions of Virtual Box (4 and up) have support for “shareable” disks. This feature lets you build a RAC without using Openfiler or some other sort of SAN/NAS simulation software. Saves you one virtual machine in the setup.

I am not sure if this setup can be used with Oracle 10g RAC and whether this feature is stable enough, but here is an article by Tim Hall that describes Oracle 11g RAC built around this kind of disks.

Update: created shareable disks in 3.2.12 and used them under OEL 5.2 (you still need some clusterware-like software to properly share the disks).

Create a free website or blog at WordPress.com.