Oracle archive log cleanup script

Here’s a quick bash script to clean up archive logs older than a week. It reads the Oracle SIDs from /etc/oratab and invokes rman for each SID. One could put this in cron to be run once a day to keep disk space usage in check.

Read more ›

Posted in Uncategorized

Installing systemtap on CentOS 7

I recently had the need to install systemtap on one of my CentOS 7 VMs and the process isn’t as straight forward as it should be. It seems not all packages needed are built for all revisions of the kernel. After much searching, I managed to get this working and wanted to archive this procedure. In order to get this running (safely), we need compatible version numbers for the kernel, kernel-devel, and kernel-debuginfo packages. Let’s first get a list of availaible versions for these packages:

# yum --enablerepo=*-debuginfo --showduplicates list kernel kernel-devel kernel-debuginfo
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirror.beyondhosting.net
 * extras: repos.mia.quadranet.com
 * updates: centos.mirrors.tds.net
Installed Packages
kernel.x86_64 3.10.0-123.el7 @anaconda
kernel.x86_64 3.10.0-229.4.2.el7 @updates
Available Packages
kernel.x86_64 3.10.0-229.el7 base
kernel.x86_64 3.10.0-229.1.2.el7 updates
kernel.x86_64 3.10.0-229.4.2.el7 updates
kernel-debuginfo.x86_64 3.10.0-123.el7 base-debuginfo
kernel-debuginfo.x86_64 3.10.0-123.1.2.el7 base-debuginfo
kernel-debuginfo.x86_64 3.10.0-123.4.2.el7 base-debuginfo
kernel-debuginfo.x86_64 3.10.0-123.4.4.el7 base-debuginfo
kernel-debuginfo.x86_64 3.10.0-123.6.3.el7 base-debuginfo
kernel-debuginfo.x86_64 3.10.0-123.8.1.el7 base-debuginfo
kernel-debuginfo.x86_64 3.10.0-123.9.2.el7 base-debuginfo
kernel-debuginfo.x86_64 3.10.0-123.9.3.el7 base-debuginfo
kernel-debuginfo.x86_64 3.10.0-123.13.1.el7 base-debuginfo
kernel-debuginfo.x86_64 3.10.0-123.13.2.el7 base-debuginfo
kernel-debuginfo.x86_64 3.10.0-123.20.1.el7 base-debuginfo
kernel-debuginfo.x86_64 3.10.0-229.el7 base-debuginfo
kernel-debuginfo.x86_64 3.10.0-229.1.2.el7 base-debuginfo
kernel-devel.x86_64 3.10.0-229.el7 base
kernel-devel.x86_64 3.10.0-229.1.2.el7 updates
kernel-devel.x86_64 3.10.0-229.4.2.el7 updates

The latest version of the kernel-debuginfo package is 3.10.0-229.1.2.el7 and is common among the required packages so we’ll install this version:

# yum --enablerepo=*-debuginfo install kernel-3.10.0-229.1.2.el7 kernel-debuginfo-3.10.0-229.1.2.el7 kernel-devel-3.10.0-229.1.2.el7 systemtap

Once this completes, reboot and ensure you select the matching kernel version.

Sit back and enjoy running systemtap.

 

Posted in linux, Technology, Virtualization

Installing Oracle 12c on CentOS 7

I wanted to capture the changes which need to be done to a fresh centos7 server install to support Oracle 12C. The server was installed with Basic Server using a 4GB swap device but before we can start the Oracle install, we need to prepare the system.

  1. Create credentials

    # for f in oinstall dba oper; do groupadd $f; done
    # useradd -g oinstall -G dba,oper oracle

  2. Install additional packages:

    # yum install binutils compat-libcap1 compat-libstdc++ gcc gcc-c++ glibc glibc-devel ksh libaio libaio-devel libgcc libstdc++ libstdc++-devel make sysstat net-tools telnet

  3. Disable the firewall

    # iptables --flush
    # systemctl mask firewalld
    # systemctl stop firewalld

  4. Tune open file descriptor limit
    using your favorite editor, edit /etc/security/limits.conf and add the following:

    oracle soft nofile 4096
    oracle hard nofile 65536
    oracle hard nproc 16384

  5. Tune shared memory
    check current shared memory:

    # df -ht tmpfs | grep /dev/shm
    tmpfs 1.9G 912M 984M 49% /dev/shm

    using  your favorite editor, edit /etc/fstab and add or update the following:

    none      /dev/shm        tmpfs   defaults,size=8G        0 0

    remount /dev/shm to reflect new value and check again:

    # mount -o remount /dev/shm
    # df -ht tmpfs | grep /dev/shm
    tmpfs 8.0G 456M 7.6G 6% /dev/shm
  6. Create /etc/oraInst.loc

    # cat > /etc/oraInst.loc
    inventory_loc=/u01/app/oracle/oraInventory
    inst_group=oinstall
    ^D

    Correct permissions

    # chown oracle:oinstall /etc/oraInst.loc
    # chmod 644 /etc/oraInst.loc

  7. Modify or create a response file.
    Make a copy of the response file found in the Oracle install directory, database/response/db_install.rsp and edit to match your environment. Here is the list of variables which were changed in my install:

    oracle.install.option=INSTALL_DB_SWONLY
    ORACLE_HOSTNAME=centos
    UNIX_GROUP_NAME=oinstall
    INVENTORY_LOCATION=/u01/12.1.0.2/database/stage/products.xml
    SELECTED_LANGUAGES=en
    ORACLE_HOME=/u01/app/oracle/product/12.1.0.2/db_1
    ORACLE_BASE=/u01/app/oracle
    oracle.install.db.InstallEdition=EE
    oracle.install.db.DBA_GROUP=dba
    oracle.install.db.OPER_GROUP=oper
    oracle.install.db.BACKUPDBA_GROUP=dba
    oracle.install.db.DGDBA_GROUP=dba
    oracle.install.db.KMDBA_GROUP=dba
    SECURITY_UPDATES_VIA_MYORACLESUPPORT=false
    DECLINE_SECURITY_UPDATES=true

  8. Install Oracle
    Log in as the oracle user and run the installer:

    % ./runInstaller -force -silent -responseFile ~/db_install.rsp
Posted in linux, Technology, Virtualization

Focaccia Style Flax Bread

Ingredients:

  • 2 cups flax seed meal
  • 1 Tablespoon baking powder
  • 1 teaspoon salt
  • 5 beaten eggs
  • 1/2 cup water
  • 1/4 cup oil

Preparation:

Preheat oven to 350 F. Prepare pan (a 10×15 pan with sides works best) with oiled parchment paper or a silicone mat.

  1. Mix dry ingredients well – a whisk works well.
  2. Add wet to dry, and combine well. Make sure there aren’t obvious strings of egg white hanging out in the batter.
  3. Let batter set for 2 to 3 minutes to thicken up some (leave it too long and it gets past the point where it’s easy to spread.)
  4. Pour batter onto pan. Because it’s going to tend to mound in the middle, you’ll get a more even thickness if you spread it away from the center somewhat, in roughly a rectangle an inch or two from the sides of the pan (you can go all the way to the edge, but it will be thinner).
  5. Bake for about 20 minutes, until it springs back when you touch the top and/or is visibly browning even more than flax already is.
  6. Cool and cut into whatever size slices you want. You don’t need a sharp knife; I usually just cut it with a spatula.

Nutritional Information:

Each of 12 servings has less than a gram of effective carbohydrate (.7 grams to be exact) plus 5 grams fiber, 6 grams protein, and 185 calories.

 

Posted in Recipe Tagged with: , ,

FreeBSD / FreeNAS Clone Jail

I recently had the need to update my shiny new FreeBSD jailed server because I wanted to migrate to WordPress. I didn’t want to bring down the existing server while I did the install and converted my content so I managed to clone my existing jailed server using warden:

 warden export name_of_jail --dir=/directory_for_warden_file 

This will take a while… Once done, you can import the warden file creating a new jail:

 warden import jail_warden_file.wdn --host=jailbird --ipv4=192.168.1.105/24 

You’ve now got a cloned jail and a template for creating other jailed servers.

Posted in BSD, Technology, Virtualization Tagged with: , , , ,

Solaris 11.1 Install with metadb slice

If you need to a Solaris 11.x install which will use Solaris Volume Manger and want the metadbs on the boot disk, here’s a procedure to get the job done.
Read more ›

Posted in Solaris, Technology Tagged with: , ,

Solaris 11 Tips

Static IP

Solaris 11 network stack is using crossbow so network administration is completely different now. In order to switch from DHCP to a static IP, we need to do the following:

# netadm enable -p ncp DefaultFixed
# ipadm create-ip net0
# ipadm create-addr -T static -a 192.168.1.21/24 net0/v4

Enable root login

rolemod -K type=normal root

Install Gnome

pfexec pkg install --accept solaris-desktop

Automated Installer

If the installadm client fails to boot and you land at the grub prompt, you may be missing next-server directive in the dhcp configuration. This should follow the filename directive.

# vi /etc/inet/dhcpd4.conf
...

host 08002746E9C3 {
  hardware ethernet 08:00:27:46:E9:C3;
  if option arch = 00:00 {
    filename "0108002746E9C3.bios";
  } else if option arch = 00:07 {
    filename "0108002746E9C3.uefi";
  }
  next-server 192.168.2.1;
}
Posted in Solaris, Technology Tagged with: ,

Solaris Cluster in a Box

A VirtualBox Solaris Cluster complete with shared storage and quorum disk!

Host System

The host system is a Mac running 10.8:

Intel Core i7-3770K Ivy Bridge 3.5GHz
16Gb RAM
GeForce GTX 470 1280M
At the time of this article, I’m running Mac OSX 10.8.2 with VirtualBox 4.2.6. The Solaris Cluster is 3.3 running in a Solaris 10u10 virtual machine.
Read more ›

Posted in Solaris Cluster, Technology, Virtualization Tagged with: , , ,

VirtualBox Serial Port Console on Solaris 10

If you’re like me and prefer the command line to the GUI, here’s a trick and script to help you manage your Solaris VMs.

  1. Enable a serial port for the VM.
    1. Enable Port 1
    2. Port Number COM1
    3. Port Mode: Host Pipe
    4. Create Pipe
    5. Port/File Path: /tmp/vb-VM-NAME-console
  2. Perform a reconfiguration boot on the VM.
  3. Install socat on the host system

    sudo apt-get install socat
  4. Change the eeprom console device for the VM:

    eeprom console=ttya
  5. Change the /boot/grub/menu.lst for the VM:

    ...
    # To enable grub serial console to ttya uncomment the following lines
    # and comment out the splashimage line below
    # WARNING: don't enable grub serial console when BIOS console serial
    #       redirection is active!!!
    serial --unit=0 --speed=9600
    terminal serial
    #
    # Uncomment the following line to enable GRUB splashimage on console
    #splashimage /boot/grub/splash.xpm.gz
    #
    # To chainload another OS
    ...
  6. Bring down the VM:

    init 5
  7. Once this is done, we can now tell VirtualBox to boot the VM headless and connect with socat

    VBoxManage startvm node1 --type headless && socat -,raw,echo=0 /tmp/vb-node1-console

    I wrote a perl script to handle booting and connecting the console. Feel free to download: vb.pl


    $ vb.pl -h
    usage:

    vb.pl -l
    vb.pl -n VM -b
    vb.pl -n VM -p
    vb.pl -h

    -l : list VirtualBox machines
    -n : name of the VirtualBox machine
    -b : power on and boot machine
    -p : power off machine
    -h : this message.
Posted in Technology, Virtualization Tagged with: , ,

Clone a VirtualBox Disk

  1. Get a list of drives first

    VBoxManage list hdds
  2. Clone the desired drive using the UUID:

    VBoxManage clonehd 3ce7cfe9-845d-4358-9120-7a46390bcf8c ~/.VirtualBox/HardDisks/newname

     

Posted in Technology, Virtualization Tagged with: , , ,