Saturday, April 19, 2014

Configuring local Yum repository on RHEL 6

It has been quite sometime since I played around with Redhat Linux. Because Oracle has the same replica and I love Oracle for so many reasons, I stick to Oracle Linux especially at my home setup. But yesterday was a different day.

An early frustration sat in when I was unable to access internet inside the VM. The problem was circular. Internet required installation of guest additions, guest additions required access to some yum repository and my choice of yum repository i.e. Oracle's public yum required Internet. A friend told me that I should configure local yum repository using the installation media.

So, I did and here are the steps if you want to do the same as well.

Please note that the steps are basic and all I am doing is to configure Packages directory of my ISO image as yum repository. You can create multiple yum repositories and define different categories and all that complicated stuff.

Monday, November 4, 2013

Change sizes of all redo logs using one shell script

I had this rather surprisingly difficult puzzle of changing sizes of all members of both redo log groups this past weekend. And that too using one shell script. There are two challenges here.

First is the fact that there is no resize option available for redo logs and my database had only two redo log groups which is the minimum requirement. Oracle writes on all members of a redo log group simultaneously and once it is full it switches to the next group. In order to change to the size of the members of any redo log group you had to drop that group first and then add again with the desired size. Having only two redo log groups means that you can't drop any of them; Oracle won't let you do that.

The solution to this first problem is to add an interim redo log group, drop the first redo log group and recreate it with desired size, then drop the second redo log group and recreate it and finally drop the 3rd interim redo log group.

Friday, June 28, 2013

Oracle database 12C Installation on Linux 64bit

Despite a major architectural change in the product design the installation part of 12C database remains mostly the same. The only notable difference is when you create a database you create two different types of databases.

CDB, which is basically a container database and will not hold any user data and

PDB, which is pluggable database and can be more than one. PDBs will actually hold the user data and ideally there should be one PDB per application (adhering to multitenant architecture).

Here are the complete installation steps performed on Virtual box running Oracle Linux 6 64bit.  

Wednesday, June 26, 2013

12C is here...

Like the arrival of "Man of Steel" or "Dark Knight Rises" or Pakistan vs India cricket match, the anticipation for 12C was by no means lesser. 
Its finally here and you can download it using the link
Finally there is a chance to play around the buzzwords circulating in my head for almost seven months. Multitenancy, Pluggable databases, first database for cloud etc etc.
If you are unable to wait then here is the installation guide for Linux

Thursday, May 30, 2013

Hacking user passwords in Oracle 11g

The title of this post is a bit misleading. I am not a hacker and also this blog is not about how you can cheat on Oracle. The title comes from a colleague who asked me how he can get his password back if he forgets. The simple answer is that you can't. There is an easy way to get back your access to database but there is no way to get back your old password if you forgot. The reason is that Oracle does not store passwords rather it stores the hash value of passwords. There is no known way to decrypt this hash value and mechanism has never been shared by Oracle (and rightly so).
So if you have forgot your password, you can easily ask your DBA to reset it. The DBA will use the following command to do so.
SQL> alter user identified by ;
Regarding hash values being stored inside database, if you have database version 10g or earlier you can use the following command to get hash value.
SQL> select username,password from dba_users where username='SCOTT';
The problem with this approach was that any user can view at least his own password's hash value using the following command.
SQL> select username,password from user_users where username='SCOTT';
Starting from 11g Oracle has changed this. The hash values for passwords are not visible in password column of *_users views. The column will be blank. The hash values are only visible to DBAs now through a new view user$. 
SQL> select name,password
  2  from user$
  3  where name='SCOTT';
NAME       PASSWORD
------------------------------ ------------------------------
SCOTT       F894844C34402B67
It is highly recommended that normal users should not have access to this view.

Wednesday, May 29, 2013

Fusion Middleware RCU fails to create OIM schema

This is what happens when you are trying to install Oracle IAM 11gR2. Normally it happens when you are installing Identity Management suite on Oracle Linux 6, 64 bit version. However in my case I faced this error on 32 bit. It can happen on any schema related to IAM suite and is not just limited to OIM schema. According to Oracle support its a bug which has no clear solution and they are working on it. Check Article id 1469169.1 for more details.
However there are several workarounds available which may or may not work for you. Here they are:
  • Make sure that you have all required packages installed. Here is the list of packages that you must have. 
  • Download the Windows version of RCU and run it from your Windows desktop.
  • Try to run RCU from a 32 bit platform if you are installing on 64 bit server.
  • Use an older version of Oracle Linux like EL 5.
In my case the first workaround worked.

Wednesday, March 6, 2013

Accessing NTFS partition from Linux

Linux does not offer the default support for NTFS partitions. Although you can natively access them but you can't actually use them especially in read/write mode. I required this because my VMs were originally created in Windows and I can't create FAT partitions for them because it has limitation on size of file.

No brainer. I just googled for sometime and found a solution which did not worked in its entirity but with some tweaking I made it to work. You can find the original article here. But here is what worked for me.

You need ntfs-3g drivers to access and modify data on NTFS partitions. To install this driver you first have to create a yum repository for this. The repository is as expected located under fedora project.

Log in using root and execute the following commands to create repository.

$ su
password:
# cd /etc/init.d/yum.repos.d
# wget http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm

The above command will download the rpm file which you will install to create repository.

# rpm -ivh epel-release-6-8.noarch.rpm

Once the repository has been setup, you can now use yum to install the actual driver.

# yum install ntfs-3g

The driver is now installed and you are ready to mount your NTFS partition. Use the following to locate the ntfs partition.

# fdisk -l

In my case I wanted to mount parition located at /dev/sda3. Create a folder to serve as mount point.

# mkdir -p /home/oracle/ntfs

Use the following to mount the drive.

# mount -t ntfs-3g /dev/sda3 /home/oracle/ntfs

Saturday, March 2, 2013

Identity columns to debut in 12C

Identity columns are set to debut in the upcoming new version of oracle database. You no longer had to create sequence and write before insert triggers to auto update primary key columns. The following syntax is set to work in 12c and will do everything for you.

SQL> CREATE TABLE TEST (
ID GENERATE AS IDENTITY COLUMN,
.
.
.
);

Behind the scenes oracle will create the sequence and will update the column when new records are entered.

This is not something new or out of the box as other databases like SQL SERVER and MySQL have this feature for quite sometime. Oracle however relied on the hard programmatic way until now. 12c is set to change that.

Saturday, February 23, 2013

Custom domain and oracle dba from Nexus 7

About a month I decided to change the title of this blog from "Imran's Oracle blog" to "the amazing oracle". It wasn't just a name change but rather the idea change behind this blog. As I have another space of mine where I can share non oracle stuff so I decided this to make something purely oracle related. The new name voiced out from no where when I got rman duplication work like a charm on very first attempt.

Most pleasant thing about it was there was no such domain as yet. So I jumped on it and here it is finally this blog is going in a new direction with its own new name. The platform will still be blogger and I have no plans of changing it in near future. 

Also, I bought Nexus 7 about a month ago. I also recently moved from Windows to Linux and when I got WiFi working on it, I thought to access Linux shell from Nexus 7. After all it requires is a ssh client like Putty. 

I searched and found many ssh client for Nexus 7 and installed ConnectBot. Everything worked so smoothly and within 15 mins I was accessing linux shell from Nexus 7 while laying in my bed. 

When you can access linux shell, you can do just about anything with linux. So I jumped straight to SQL*PLUS and started to play with oracle.  Even took a backup of database using rman. :)


Thursday, February 21, 2013

Getting WiFi networks accessible on oracle linux 6

I recently changed my home laptop from being a Windows machine to a Linux machine. It took more time then I expected because firstly I was not using a distribution which was good for Desktop like Ubuntu or Mint and secondly because I had Windows 8 installed on my laptop and was keen to keep it. Somehow I managed to install oracle linux 6.3 on my laptop but I had to revert back to Windows 7 from Windows 8.

Linux does not include WiFi drivers especially the enterprise linux which is basically meant for database servers connected via LAN cables. I though it like that as well and suggested to myself that I should treat this as my mainframe server and stick to my table every time I need to work on it.

But I was not going to settle on this for too long. So I went on a mission to make WiFi networks accessible. After about an hour of Googling I found the link of a forum which listed a few simple steps to make it work. Not very hopeful I tried those steps and restarted the machine and vola it worked.

You can check that specific forum thread here.

I have nothing but all praises for the person suggesting and solving my problem. For your convenience here the steps.
  1. Download the firmware files by clicking this.
  2. Save the file into any location.
  3. Open a terminal and set your working directory where you have placed the file.
  4. Extract the files using the command: tar xjf broadcom-wl-4.150.10.5.tar.bz2
  5. Navigate to extracted folders: cd broadcom-wl-4.150.10.5/driver
  6. Switch to root user: su (password for root will be prompted).
  7. Issue the command: b43-fwcutter -w /lib/firmware wl_apsta_mimo.o
The above steps are tested on Oracle linux 6.3 but they should work on any oracle, redhat, CentOS or Fedora based distributions. The forum is basically for Fedora.