Sunday, March 28, 2010

List of commands I frequently use in Oracle

Listed below commands I fequently use on Oracle in Linux OS environment.
(I will keep updating as I come across more)...
Oracle Commands:
  • .How to find whether listener is running or not? 
    • lsnrctl status
    • to start listener 
      • lsnrctl start
    • to stop listener
      • lsnrctl stop 
    • to list services
      • lsnrctl services
  • To Configure Listener
    • from command prompt type netca
  • to start dbconsole (Enterprise Manager Console)
    • emctl start dbconsole
  • to stop dbconsole
    • emctl stop dbconsole
  • to access Enterprise Manager
    • https://<service_name>:1158/
      • for example if your service name is my.example.com then access url will be https://my.example.com:1158/
  • How to start Oracle dB?
    • sqlplus /nolog
    • sql> connect / as sysdba
    • startup
  • How to shutdown Oracle dB?
    • shutdown immediate
  • How to lock a user account & of course to unlock?  
    • SQL> ALTER USER <username>  ACCOUNT LOCK;
    • SQL> ALTER USER <username> ACCOUNT UNLOCK;
    • If you want to change the password while you unlock, use the following command: 
      • SQL> ALTER  USER <username> IDENTIFIED BY <password> ACCOUNT UNLOCK;

How to make SQLDeveloper work on Linux

SQLDeveloper ver 1.1.is a Java Product, much like JDeveloper. Unfortunately it does not seem to update java path automatically.
After Installing JDK in linux, open the file sqldeveloper.conf (path: $ORACLE_HOME/opt/sqldeveloper/sqldeveloper/bin) and modify the parameter SetJavaHome to point to the actual path where jdk resides.
Ex: I had installed JDK in /usr/java directory. So my entry for SetJavaHome is /usr/java/jdk1.6.0_18

List of Commands I use frequently in Linux/Unix

Being a developer, I hardly ever use Unix/Linux. However,every now and then I need to do work on Linux. Instead of keep searching internet or bug my friendly colleagues, I think it is a better idea to list out Linux commands below. So here goes (I will keep updating as I come across more)...


  • remove directory /files.
    • rm -fr *.*
    • f flag will force remove (and not interactively ask whether you need to remove or not)
    • r flag will allows for recursively deleting all files and directories
    • note: if there is a need to ask before deleting any file, then use i flag
  • How to find ip address in Linux?
    • ifconfig will print the ip address
    • note: if the above command returns "not found", then, use /sbin/ifconfig
  • How to find Disk Usage: Link to baobob: Linux Disk usage analysis and cleanup tools
  • How to find out where "java" or any other file installed (its complete path)?
    • the command whereis java will list the complete path
  • How to execute .bash_profile after changes?
    • . ./.bash_profile (there should be a space between the first dot and the second one)
  • create alias for commands
    • alias cls=`clear tput`
  • How to count number of files in a directory?
    • file . -type f wc -l
  • How to display present working directory in the prompt?
    • In bash shell, set PS1=`\w` (I also add a colon ":" and a greater than symbol ">" at the end like this: PS1=`\w :>` for further references goto everything.com
  • Vi Commands
    • How to display filename while working inside vi?
      Type Ctrl+G
    • How to display line numbers?
      Press ':' and type set number
    • How to display mode we are working on (APPEND or OPEN...)?
      Press ':' and type set showmode