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. 


Tuesday, February 19, 2013

RMAN, new configuration parameters in 11g

Configuration parameters define the overall environmental behavior of rman. You can set these parameters to automate things as well as define bevaviors with repect to different commands. In 11g there are two new parameters which are basically two new features. You can use the following command to list all configuration parameters with their default values.

RMAN> show all;
using target database control file instead of recovery catalog
RMAN configuration parameters for database with db_unique_name ORCL are:
CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # default
CONFIGURE BACKUP OPTIMIZATION OFF; # default
CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default
CONFIGURE CONTROLFILE AUTOBACKUP OFF; # default
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '%F'; # default
CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO BACKUPSET; # default
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE MAXSETSIZE TO UNLIMITED; # default
CONFIGURE ENCRYPTION FOR DATABASE OFF; # default
CONFIGURE ENCRYPTION ALGORITHM 'AES128'; # default
CONFIGURE COMPRESSION ALGORITHM 'BASIC' AS OF RELEASE 'DEFAULT' OPTIMIZE FOR LOAD TRUE ; # default
CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default
CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/u01/app/oracle/product/11.2.0/dbhome_1/dbs/snapcf_orcl.f'; # default

I have highlighted both the new parameters. First one, as you may have guessed RMAN now allows you to compress the backup sets generated via rman. The configuration allows you to set the default compression algorithm which you want to use while taking backups. By default it is set to basic which you can change depending on your requirement. To see the list of algorithms available you can use the following command. Note the description column which states which algorithm is suited for what situations.

SQL> select algorithm_name,algorithm_description,is_default
  2  from V$RMAN_COMPRESSION_ALGORITHM;
ALGORITHM_NAME       ALGORITHM_DESCRIPTION  IS_
------------------------------ -------------------------------------------------- ---
BZIP2       good compression ratio  NO
BASIC       good compression ratio  YES
LOW       maximum possible compression speed  NO
ZLIB       balance between speed and compression ratio  NO
MEDIUM       balance between speed and compression ratio  NO
HIGH       maximum possible compression ratio  NO

6 rows selected.

You can change the value of parameter using the following command.

RMAN> configure compression algorithm "low";
new RMAN configuration parameters:
CONFIGURE COMPRESSION ALGORITHM 'low' AS OF RELEASE 'DEFAULT' OPTIMIZE FOR LOAD TRUE;
new RMAN configuration parameters are successfully stored
RMAN> 


The other parameter allows you to set the archivelog deletion policy. As name suggests that this setting when set will cause automatic deletion of archivelogs. This is a very handsome feature in itself and will require another post for full details.
Enough to state is that you can set policy like delete archivelogs after two backups. RMAN will delete archive logs which have been backed up twice. 

Monday, February 11, 2013

Create restore points for specific SCN and one that preserve in 11g

Restore points were introduced in 10g as part of amazing new flashback technology. You can check my earlier post about them here if you want to know more about them first hand.

In 11g there are two minor tweaks in the concept. Normally when you create restore point, it is created on current SCN. Now you can customize this behavior. You can create restore point to some earlier SCN. The only rule is here that SCN should exist in first place.

For example, issue the following command to know the current SCN of database.

SQL> select current_scn from v$database;

CURRENT_SCN
-----------
    1017119

Suppose we want to create restore point on 1017000 instead of current one. Following command will do that.

SQL> create restore point restore1 as of scn 1017000;

Restore point created.

You can also use time-stamp instead of SCN.

SQL> create restore point restore2 as of timestamp to_date('10-Feb-2013');

Restore point created.

The second concept is of perseverance. Oracle has a retention policy for keeping restore points and once that retention point is reached, the restore points created earlier are deleted in order of their creation. Now you can control that as well. Suppose you want to create a restore point and also want it to be preserved until and unless you drop it yourself, you can use the following command.

SQL> create restore point restore3 preserve;

Restore point created.

You can check which restore points are preserved and which are not by using the following query.

SQL> select name,preserved from v$restore_point;

NAME                           PRE
------------------------------ ---
RESTORE3                       YES
RESTORE1                       NO
RESTORE2                       NO