Using SQL * Plus on Command Line in Ubuntu

By abhishek

This blog post is an HowTo "Setup SQL*Plus to work on BASH" The commands illustrated in this howto are tested on Ubuntu 9.10 with Oracle Database 10g Express Edition Release 10.2.0.1.0 - Production Installed.

What is SQL * Plus ?

SQL*Plus is a command line SQL and PL/SQL language interface and reporting tool that ships with the Oracle Database Client and Server software. It can be used interactively or driven from scripts. SQL*Plus is frequently used by DBAs and Developers to interact with the Oracle database.

Prerequisite

Oracle Database 10g Express Edition Release 10.2.0.1.0 Installed

Once you have Oracle 10g Installed successfully you can go to

Applications > Oracle Database 10g Express Edition > Run SQL Command Line

and successfully run all your SQL PL/SQL easily but using SQL*Plus directly on BASH is the real fun, Below are the steps which will enable you to use SQL*Plus on BASH

1) set ORACLE_HOME
2) set ORACLE_HOME/bin in $PATH

The above 2 steps can be performed by adding the following lines to .bashrc

export ORACLE_HOME=/usr/lib/oracle/xe/app/oracle/product/10.2.0/server/
export $PATH=$PATH:$ORACLE_HOME/bin

The above 2 Steps are sufficient to use SQL*Plus on Command Line once you have done the steps execute


$ sqlplus user/password@database

In the default install XE would be used as database.

Issues while using the default or only the above method

  • SQL*Plus does not support the Up/Down Arrow command scroll under linux environment which in itself is the biggest problem.
  • Default Editor is not Set which will confuse you while executing ED.
  • Various Other Environment variables are not set

Resolving the above mentioned issues

  • Install rlwrap this will enable the Up/Down Scroll function
    $ sudo apt-get install rlwrap
    now connect to oracle using
    $ rlwrap sqlplus user/password@database
    You will find that Up/Down Scroll is now enabled.
  • Set the most common Environment Variables


    $ rlwrap sqlplus user/password@database
    SQL*Plus: Release 10.2.0.1.0 - Production on Sun Feb 28 23:53:15 2010
    Copyright (c) 1982, 2005, Oracle. All rights reserved.
    Connected to:
    Oracle Database 10g Express Edition Release 10.2.0.1.0 - Production
    SQL> SET EDITFILE "afiedt.buf"
    SQL> DEFINE _EDITOR=vim
    SQL> SET LINESIZE 132
    SQL> SET SERVEROUTPUT ON

    This will set the default editor as VIM, Default Edit File as afiedt.buf LINESIZE as 132 & will mark SERVEROUTUT as ON
    various other variables can also be set similar commands on the SQL prompt

Refer SQL*Plus FAQ's for more information.

4 Steps to add Ubuntu Systems to Active Directory Setup

By abhishek

The IT environment today in any organization is a sort of a mixture where many different Operating Systems are used, and Windows Active Domain Controller exists in majority of such organization.

Below is a 4 step How to on "Connecting Linux (Ubuntu) Systems to Active Directory Setup"

1) Update the Software Repositories

sudo apt-get update

2) Install Required Packages (likewise-open)

sudo apt-get install likewise-open

3) Join The Domain using Domain Administrator Account, replace Administrator with Domain Administrator Username and fqdn..domain with the Fully Qualified Domain Name

sudo domainjoin-cli join fqdn.domain Administrator

4) Update the Startup Scripts

sudo update-rc.d likewise-open defaults
sudo /etc/init.d/likewise-open start

Thats it !! you have now joined the Domain, Log Off or preferably Restart the Machine.

Now you can login using Active Directory Credentials remember appending DOMAIN\ before your username


User Name to Login : DOMAIN\username
Password: domainpassword

This will also create a home Directory for Domain Users under /home/DOMAIN

Contributing to Wikipedia

By abhishek
This user is a Novice Editor and is entitled to display this Service Badge.

Wikipedia today has become an unparalleled source of content on virtually any topic and has grown with a great pace, The content available on wiki is all contributed by users like you and me and is available under a Creative Commons Attribution-ShareAlike Licence which allows reuse of this content in various forms by attributing in a manner specified by the author.

You can also be an author on wikipedia even if you are not so great in writing, still you can contribute to wikipedia by rectifying articles in which you have an understanding, you can correct mistakes done by various authors or even start a new article if it doesn't exist in the list which has now crossed 3,170,000 mark.

So what are you waiting for, start writing and correcting articles to build this free encyclopedia even better, but use this tool effectively do not edit any article in which you don't have any understanding, add articles only on topics where you have understanding always specify references while editing articles. Do not copy any content which is copyrighted it will be deleted for sure.

My Experiences while Editing Wikipedia

I have been using wikipedia since long as many of us and have edited various articles which i thought needed improvement and currently have more than 200 live edits on wikipedia. I have seen many of my edits being deleted for various reasons and i can safely say that there are users out there who continuously watch each edit and if its not up to the mark or violates any policies the edit is deleted within no time. I am currently watching articled related to Kashipur, Uttarakhand, Personalites from Uttarakhand and various topics of my intrest. The latest article i contributed is on Shree Moteshwar (Bheemashankar) Mahadev Temple. below is list of my Top 5 Edited/Contributed Articles

Lets gear up and contribute what all we can, and make Wikipedia Stronger

My Wiki User Contributions Page

GNUnify 2010

By abhishek

GNUnify 2010: A forum to unite Open MindsGNUnify is one of the biggest FOSS Event organized by the students of Symbiosis Institute Of Computer Studies & Research (SICSR) Pune & Pune GNU/Linux Users Group. GNUnify is entering in its 8th year with GNUnify 2010.

When: 19th & 20th Feb 2010

Where:  Symbiosis Institute of Computer Studies and Research, Atur Centre, Gokhale Cross Road, Model Colony, Pune-411016, Maharashtra, INDIA. Tel : +91-20-25675601

Event Website : http://gnunify.in

GNUnify Gallery: http://gnunify.in/gallery

LFU Update : Story in Linux for You March 2009 (pg 36)

Hope to see a great Event ahead

Domains in Your own language

By abhishek

I am sure that by now you would have at least seen one domain name which was written in a non-english language but still if you have not seen any such domain the screen shot below would explain the entire story. I would try to explain the mechanism behind these kind of Domain Names in this post


Domain in Hindi

Domain Names which can be viewed in a language-specific script are known as Internationalized Domain Names or IDNs. This concept was introduced in December 1996 and was first implemented in 1998 but ICANN issued guidelines for the use of IDNA only in June 2003 any by today most of the TLDs support IDNs.

The Working

As we all know that a domain name has to resolve to an IP Address to function, but as language-specific domain names contains NON-ASCII characters and there are various limitations in their use, to overcome this basic limitation an encoding mechanism for such names is implemented by which this collection of  NON-ASCII characters are used to prepare a suitable character set which can be used, lets check the process with the following example


http://काशीपुर.com  = http://www.xn--11b6bsw3bni.com/

now अभिषेक.com contains 2 parts अभिषेक and com in which com is already an ASCII string and hence left as it is, अभिषेक is processed by Nameprep and then converted to Punycode to get l1b6a6dvbzbxc which is a meaningless string for most of us, this output is prepended with xn-- to produce xn--l1b6a6dvbzbxc which becomes the first part of the domain name an entry for this (xn--l1b6a6dvbzbxc.com) is made in DNS to map these names with IP Addresses.

IDNs are registered with a limited number of registrars by using their ASCII equivalent strings, currently .com/.net/.info and various other ccTLD are available for registration .org is expected to be available by this month (January 2010) end, ccTLD .in is currently not available for IDNs.

Starting November 2009 ICANN have started registering language-specific TLDs as well and such TLDs are expected to hit the internet somewhere mid-2010, we may soon see some domains with  .भारत as TLDs soon if Indian Government applies for such a TLD :)

IDNs are not much popular in India currently but still the domain parking race have already begun for Hindi TLDs for instance domains like भारत.com, पुणे.com and various others are already gone

Use of IDN have opened up new ways for Localization and Internationalization but using IDNs have also raised various ASCII Spoofing concerns due to which various Browsers do not have all the IDN TLDs enabled by default for instance  the Newer Versions Firefox  does not support .com IDNs by default to enable the same you need to set a parameter "network.IDN.whitelist.com;true" in firefox configuration using about:config, please be careful while doing so this may not be always recommended due to various reasons check this for further information on this.