Saturday 21 July 2012

set the SQLPLUS Environment

SQL>SET SERVEROUTPUT ON

define _editor=vi
set serveroutput on size 1000000
set trimspool on
set long 5000
set linesize 100
set pagesize 9999
column plan_plus_exp format a80
column global_name new_value gname
set termout off
define gname=idle
column global_name new_value gname


select lower(user) || '@' || substr( global_name, 1,
decode( dot, 0, length(global_name), dot-1) ) global_name
from (select global_name, instr(global_name,'.') dot from global_name );
set sqlprompt '&gname> '
set termout on


  • DEFINE _EDITOR=VI: This sets up the default editor SQL*Plus will use. You may set the default editor to be your favorite text editor (not a word processor) such as Notepad or emacs.
  • SET SERVEROUTPUT ON SIZE 1000000: This enables DBMS_OUTPUT to be on by default (hence you don’t have to type it in each and every time). It also sets the default buffer size as large as possible.
  • SET TRIMSPOOL ON: When spooling text, lines will be blank-trimmed and not fixed width. If this is set to OFF (the default), spooled lines will be as wide as your LINESIZE setting.
  • SET LONG 5000: This sets the default number of bytes displayed when selecting LONG and CLOB columns.
  • SET LINESIZE 100: This sets the width of the lines displayed by SQL*Plus to be 100 characters.
  • SET PAGESIZE 9999: This sets the PAGESIZE, which controls how frequently SQL*Plus prints out headings, to a large number (you get one set of headings per page).
  • COLUMN PLAN_PLUS_EXP FORMAT A80: This sets the default width of the explain plan output you receive with AUTOTRACE. A80 is generally wide enough to hold the full plan.
define gname=idle
column global_name new_value gname
select lower(user) || '@' || substr( global_name,1,
decode( dot, 0, length(global_name), dot-1) ) global_name
from (select global_name, instr(global_name,'.') dot from global_name );
set sqlprompt '&gname> '
  • The directive COLUMN GLOBAL_NAME NEW_VALUE GNAME tells SQL*Plus to take the last value it retrieves for any column named GLOBAL_NAME and place it into the substitution variable GNAME. I then select the GLOBAL_NAME out of the database and concatenate this with the username I am logged in with. That makes my prompt look like this:

ops$tkyte@ora10g>

so I know who I am as well as where I am.




Setting up SCOTT/TIGER Schema


Sample Table Structures for Practice:-


The SCOTT/TIGER schema may already exist in your database. It is generally included during a
typical installation, but it is not a mandatory component of the database.


In 9i

  1. $ cd $ORACLE_HOME/sqlplus/demo
  2. Run "demobld.sql" when connected as any user
In 10g on wards.

  1. $ cd $ORACLE_HOME/rdbms/admin
  2. $ cp utlsampl.sql  /prod/ravi10/admin/scripts/table.sql
  3. connect to the any user and run "table.sql".
              SQL> @?/prod/ravi10/admin/scripts/table.sql


demobld.sql (or) utlsampl.sql will create and populate five tables.

CREATE TABLE EMP
(EMPNO NUMBER(4) NOT NULL,
ENAME VARCHAR2(10),
JOB VARCHAR2(9),
MGR NUMBER(4),
HIREDATE DATE,
SAL NUMBER(7, 2),
COMM NUMBER(7, 2),
DEPTNO NUMBER(2)
);


INSERT INTO EMP VALUES (7369, 'SMITH', 'CLERK', 7902,
TO_DATE('17-DEC-1980', 'DD-MON-YYYY'), 800, NULL, 20);
INSERT INTO EMP VALUES (7499, 'ALLEN', 'SALESMAN', 7698,
TO_DATE('20-FEB-1981', 'DD-MON-YYYY'), 1600, 300, 30);
INSERT INTO EMP VALUES (7521, 'WARD', 'SALESMAN', 7698,
TO_DATE('22-FEB-1981', 'DD-MON-YYYY'), 1250, 500, 30);
INSERT INTO EMP VALUES (7566, 'JONES', 'MANAGER', 7839,
TO_DATE('2-APR-1981', 'DD-MON-YYYY'), 2975, NULL, 20);
INSERT INTO EMP VALUES (7654, 'MARTIN', 'SALESMAN', 7698,
TO_DATE('28-SEP-1981', 'DD-MON-YYYY'), 1250, 1400, 30);
INSERT INTO EMP VALUES (7698, 'BLAKE', 'MANAGER', 7839,
TO_DATE('1-MAY-1981', 'DD-MON-YYYY'), 2850, NULL, 30);
INSERT INTO EMP VALUES (7782, 'CLARK', 'MANAGER', 7839,
TO_DATE('9-JUN-1981', 'DD-MON-YYYY'), 2450, NULL, 10);
INSERT INTO EMP VALUES (7788, 'SCOTT', 'ANALYST', 7566,
TO_DATE('09-DEC-1982', 'DD-MON-YYYY'), 3000, NULL, 20);
INSERT INTO EMP VALUES (7839, 'KING', 'PRESIDENT', NULL,
TO_DATE('17-NOV-1981', 'DD-MON-YYYY'), 5000, NULL, 10);
INSERT INTO EMP VALUES (7844, 'TURNER', 'SALESMAN', 7698,
xxvi ■SETTING UP YOUR ENVIRONMENT
5300FM.qxd 8/18/05 10:18 AM Page xxvi
TO_DATE('8-SEP-1981', 'DD-MON-YYYY'), 1500, 0, 30);
INSERT INTO EMP VALUES (7876, 'ADAMS', 'CLERK', 7788,
TO_DATE('12-JAN-1983', 'DD-MON-YYYY'), 1100, NULL, 20);
INSERT INTO EMP VALUES (7900, 'JAMES', 'CLERK', 7698,
TO_DATE('3-DEC-1981', 'DD-MON-YYYY'), 950, NULL, 30);
INSERT INTO EMP VALUES (7902, 'FORD', 'ANALYST', 7566,
TO_DATE('3-DEC-1981', 'DD-MON-YYYY'), 3000, NULL, 20);
INSERT INTO EMP VALUES (7934, 'MILLER', 'CLERK', 7782,
TO_DATE('23-JAN-1982', 'DD-MON-YYYY'), 1300, NULL, 10);
CREATE TABLE DEPT
(DEPTNO NUMBER(2),
DNAME VARCHAR2(14),
LOC VARCHAR2(13)
);
INSERT INTO DEPT VALUES (10, 'ACCOUNTING', 'NEW YORK');


CREATE TABLE DEPT
(DEPTNO NUMBER(2),
DNAME VARCHAR2(14),
LOC VARCHAR2(13)
);
INSERT INTO DEPT VALUES (10, 'ACCOUNTING', 'NEW YORK');
INSERT INTO DEPT VALUES (20, 'RESEARCH', 'DALLAS');
INSERT INTO DEPT VALUES (30, 'SALES', 'CHICAGO');
INSERT INTO DEPT VALUES (40, 'OPERATIONS', 'BOSTON');


Friday 20 July 2012

OEM Stand Alone

OEM Stand Alone

OEM Stand Alone Steps:

prerequisites:-

  • check the configrations

               $ which emca
                 /u01/app/oracle/product/10.2.0.1/bin/emca
               $ which emctl
                 /u01/app/oracle/product/10.2.0.1/bin/emctl

Note: "$ emca -help " for help
  • Listener and tnsnames are in up state.
  • Database must be in open state.
SQL> SELECT open_mode FROM V$DATABASE;
 READ WRITE
          or
SQL> SELECT status from v$instance;
   OPEN
SQL> SELECT schema,comp_id,status,version FROM DBA_REGISTRY;

 SCHEMA      COMP_ID       STATUS      VERSION
-------------------------------------------------
   SYS        CATALOG       VALID      10.2.0.1
   SYS        CATPROC       VALID      10.2.0.1

step1:- 

$ emca -config dbcontrol db -repos create

oracle sid = ravi10
port number = 1530
sys password =
dbsnmp password =
 ........
 ........

Note: this type of link will be came & open in browser connect and access the database.
Checking the OEM :

$ emctl status dbconsole
TZ set to Asia/Calcutta
Oracle Enterprise Manager 10g Database Control Release 10.2.0.2.0
Copyright (c) 1996, 2005 Oracle Corporation.  All rights reserved.
http://ravi.apps.com:1158/em/console/aboutApplication
EM Daemon is not running.
------------------------------------------------------------------
Logs are generated in directory /u01/oraprod/db/tech_st/10.2.0//ravi.apps.com_prod/sysman/log



$ emctl start dbconsole
TZ set to Asia/Calcutta
Oracle Enterprise Manager 10g Database Control Release 10.2.0.2.0
Copyright (c) 1996, 2005 Oracle Corporation.  All rights reserved.
http://ravi.apps.com:1158/em/console/aboutApplication
Starting Oracle Enterprise Manager 10g Database Control ....
 started.
------------------------------------------------------------------
Logs are generated in directory /u01/oraprod/db/tech_st/10.2.0//ravi.apps.com_prod/sysman/log

$ emctl stop dbconsole
TZ set to Asia/Calcutta
Oracle Enterprise Manager 10g Database Control Release 10.2.0.2.0
Copyright (c) 1996, 2005 Oracle Corporation.  All rights reserved.
http://ravi.apps.com:1158/em/console/aboutApplication
Stopping Oracle Enterprise Manager 10g Database Control ...

 Cannot determine Oracle Enterprise Manager 10g Database Control process. /u01/oraprod/db/tech_st/10.2.0//ravi.apps.com_prod/emctl.pid does not exist.
[oraprod@ravi prod_ravi]$



steps to delete dbcontrol manually ========================= 
Please drop using the below steps and create it. 1- Delete DBControl Configuration Files Manually: 
Remove the following directories from your filesystem: 
<ORACLE_HOME>/<hostname>_<db_unique_name> <ORACLE_HOME>/oc4j/j2ee/OC4J_DBConsole_<hostname>_<db_unique_name> 
2- Delete DBControl Repository Objects Manually: 
a- Drop AQ related objects in the SYSMAN schema: 
Logon to SQL*PLUS as user SYS and execute the following: 
SQL> exec DBMS_AQADM.DROP_QUEUE_TABLE(queue_table=>'SYSMAN.MGMT_NOTIFY_QTABLE',force=>TRUE); 
b- Drop the DBControl Repository Objects: 
Logon to SQL*PLUS as user SYS and execute the following: 
SQL> DECLARE CURSOR c1 IS SELECT owner, synonym_name name FROM dba_synonyms WHERE table_owner = 'SYSMAN'; BEGIN FOR r1 IN c1 LOOP IF r1.owner = 'PUBLIC' THEN EXECUTE IMMEDIATE 'DROP PUBLIC SYNONYM '||r1.name; ELSE EXECUTE IMMEDIATE 'DROP SYNONYM '||r1.owner||'.'||r1.name; END IF; END LOOP; END; SQL> DROP USER mgmt_view CASCADE; SQL> DROP ROLE mgmt_user; SQL> DROP USER sysman CASCADE; SQL> drop public synonym MGMT_TARGET_BLACKOUTS; SQL> drop public synonym MGMT_AVAILABLITY; SQL> drop public synonym SETEMVIEWUSERCONTEXT; 


Before install db-control , make sure you have come up with below prerequisite 

*********************************************************************EMCA checks*********************************** 
Environment Variables Check: 

Before running EMCA command following environment variables must be set. 
ORACLE_HOSTANME=<hostname of the server> 
ORACLE_HOME=<Absolute path of Database oracle home> 
ORACLE_SID=<SID of Database> 
ORACLE_UNQNAME=<db_unique_name from database> 
LD_LIBRARY_PATH=$ORACLE_HOME/lib (For 32 bit Linux) 
----On AIX: LIBPATH=$LD_LIBRARY_PATH;$ORACLE_HOME/lib32 
TNS_ADMIN=<TNS Admin directory> : In case listener is running from non default location 

Database Check:

1)-Ensure that the Database is up and running by executing the below commands: 
<ORACLE_HOME>/bin/sqlplus "/ as sysdba" 
SQL> select status from v$instance; 

2)-Ensure that the Listener servicing the Database is up and running by executing the below command: 
<ORACLE_HOME>/bin/lsnrctl status <listener name> 

3)-SYS should be able to establish connection to the Database both via the listener and also the bequeath adaptor. 
<ORACLE_HOME>/bin/sqlplus sys as sysdba 
or 
<ORACLE_HOME>/bin/sqlplus "sys as sysdba" 
and 
<ORACLE_HOME>/bin/sqlplus sys/<Password>@<TNS Connect descriptor> 

If above connection fails take corrective actions to get the connection working from sqlplus. 

4)-Password file should be correctly configured for SYS user connection. 

Verify the initialization parameter REMOTE_LOGIN_PASSWORDFILE is set to EXCLUSIVE by executing the below command. 
SQL> show parameter REMOTE_LOGIN_PASSWORDFILE; 

5)-DBSNMP user must exist in the database and should be able to connect to the database. 
<ORACLE_HOME>/bin/sqlplus dbsnmp/<password> 


Files need to take backup:


1. Stop the database control: 
export ORACLE_HOSTNAME=10.2.0.xxxexport HOSTNAME=10.2.0.xxxemctl stop dbconsole. 
2. Move all files from /oracle/db/tech_st/11.1.0/10.2.0.xxx_OURPROD/sysman/log 
3. Keep backup of emd.properties and emoms.properties file in /oracle/db/tech_st/11.1.0/10.2.0.xxx_OURPROD/sysman/config folder. 
4. Do following modification: 
* Edit /oracle/db/tech_st/11.1.0/10.2.0.xxx_OURPROD/sysman/config/emagentlogging.properties and modify: 
log4j.rootCategory=WARN, emagentlogAppender, emagenttrcAppender to log4j.rootCategory=DEBUG, emagentlogAppender, emagenttrcAppender 
* Edit /oracle/db/tech_st/11.1.0/10.2.0.xxx_OURPROD/sysman/config/emomslogging.properties and modify: 
log4j.rootCategory=WARN, emlogAppender, emtrcAppender to log4j.rootCategory=DEBUG, emlogAppender, emtrcAppender 
5. Start database control. 
export ORACLE_HOSTNAME=10.2.0.xxxexport HOSTNAME=10.2.0.xxxemctl start dbconsole 


find . -exec grep -q "/oracle/db/tech_st" {} \; -print 



To secure the dbconsole, execute the following steps : 

1) Set the environment variable ORACLE_SID to TEST 
2) /data1/TESTDB/db/tech_st/11.1.0/bin/emctl stop dbconsole 
3) /data1/TESTDB/db/tech_st/11.1.0/bin/emctl config emkey -repos -sysman_pwd < Password for SYSMAN user > 
4) /data1/TESTDB/db/tech_st/11.1.0/bin/emctl secure dbconsole -sysman_pwd < Password for SYSMAN user > 
5) /data1/TESTDB/db/tech_st/11.1.0/bin/emctl start dbconsole 
6)Then check the status using : 
/data1/TESTDB/db/tech_st/11.1.0/bin/emctl status dbconsole 
7) Try to login using the URL shown in the output of command in step 6. 

start the dbconsole without secure:


[oracle@R12-test 11.1.0]$ emctl stop dbconsole
Oracle Enterprise Manager 11g Database Control Release 11.1.0.7.0
Copyright (c) 1996, 2008 Oracle Corporation.  All rights reserved.
https://R12-test.bilt.com:5500/em/console/aboutApplication
Stopping Oracle Enterprise Manager 11g Database Control ...
 ...  Stopped.
[oracle@R12-test 11.1.0]$


[oracle@R12-test 11.1.0]$ emctl unsecure dbconsole
Oracle Enterprise Manager 11g Database Control Release 11.1.0.7.0
Copyright (c) 1996, 2008 Oracle Corporation.  All rights reserved.
https://R12-test.bilt.com:5500/em/console/aboutApplication
Configuring DBConsole for HTTP...   Done.
DBCONSOLE already stopped...   Done.
Agent is already stopped...   Done.
Unsecuring dbconsole...   Started.
DBConsole is now unsecured...  Done.
Unsecuring dbconsole...  Sucessful.

[oracle@R12-test 11.1.0]$ emctl start dbconsole
Oracle Enterprise Manager 11g Database Control Release 11.1.0.7.0
Copyright (c) 1996, 2008 Oracle Corporation.  All rights reserved.
http://R12-test.bilt.com:5500/em/console/aboutApplication
Starting Oracle Enterprise Manager 11g Database Control ..... started.
------------------------------------------------------------------
Logs are generated in directory /data2/TESTDB/db/tech_st/11.1.0/R12-test.bilt.com_TEST/sysman/log
[oracle@R12-test 11.1.0]$



Metalink notes:
How to Enable Enterprise Manager on the Oracle E-Business Suite Release 12 (Doc ID 458533.1)
EMCA fails on Oracle Apps R12.1 Oracle Database 11.1.0.7 With "Failed to unlock all EM-related accounts" ( Doc ID 968054.1 ) 
Error copying b64InternetCertificate.txt When Attempting To CreateDBConsole for a Cloned EBS Database ( Doc ID 1290408.1 ) 
EMCA Release 10.1 to 11.1 Puts the Database in Quiesce And No New Connections or Operations Can Be Performed During the DB Control Repository Creation ( Doc ID 375946.1 )
How To Cleanup All DBConsole left-over Processes? ( Doc ID 1171814.1 ) 


Wednesday 18 July 2012

User Management

User Management 

Schema:-

Schema Objects
                 A schema is a collection of logical structures of data, or schema objects. A schema is owned by a database user and has the same name as that user. Each user owns a single schema. Schema objects can be created and manipulated with SQL and include the following types of objects:
Clusters
Constraints
Database links
Database triggers
Dimensions
External procedure libraries
Index-organized tables
Indexes
Indextypes
Java classes, Java resources, Java sources
Materialized views
Materialized view logs
Object tables
Object types
Object views
Operators
Packages
Sequences
Stored functions, stored procedures
Synonyms
Tables
Views

Nonschema Objects:

            Other types of objects are also stored in the database and can be created and manipulated with SQL but are not contained in a schema:

Contexts
Directories
Parameter files (PFILEs) and server parameter files (SPFILEs)
Profiles
Roles
Rollback segments
Tablespaces
users

Tuesday 17 July 2012

UNIX Basics for Oracle DBA

UNIX Basics for Oracle DBA

Introduction:

Linux is a flavor of UNIX and it is not user friendly and it is case sensitive. It was introduced in 1991 by "Linux Torald
Def:
Operating System:- An O.S is a software that manage computer hardware and provides a convenient and safe environment for running programs. It acts as an interpreter between program and the hardware resources (monitor, keyboard, etc).

LINUX Architecture:-

Kernal:- A set of functions that wake up's  the heart of an operating system. It is used to provided an application interface between programs and physical devices.
  1. Service provide by the kernal
  2. Controls execution of process
  3. Scheduling process fairly for execution on CPU
  4. Allocate memory for execution
Shell:- A Shell is the command interpreter to the kernal. It is the interface between user and kernal. The kernal after processing the commands gives backs to the shell.



File System:-  File System provides organized way of storing and retrieving the data. This is classified in  Four types. They are

  1. Physical File System
  2. Logical
  3. Swap in Linux (virtual in windows)
  4. Network File System
Network File System:- It supports files to be shared over Networks
Swap:- In the hard disk the space supports to the RAM for system performance. It acts as a temporary RAM. In windows it is called virtual file the system.



"/ ":- this is the root directory. It is a top of the file system structure all the other directories  are mounted under it.
"/boot":-  It contains the kernel the core of the operating system. It also contains the files relating to booting the system.                                        Such as boot loader and the initiate RAM Disk.
"/root" :- It is the default Home Directory for root (administrator).
                                             "cd /home" It contains all normal users Home Directory.
"/bin" (Binary's):-  It contains commands which are used by normal users and also administrators.
"/sbin" :- It contains administrator related commands. It is not used by normal users.
"/var":-  It contains variable information such as Locks, Print, Mail, FTP, Account, cache.
"/usr"(Unix System Resource):- It contains the program and application which are available for users.
"/etc":- It contains all configuration files.
"/dev":- It contains device loads through  which the operating system through the H/W & S/W device.
"/tmp":- It contains tempfile gives to the system.
"/proc":- It is a mount point for virtual information about the current running system process.
"/obd":- It contains the 3rd party S/W. Ex:- Media-player, Yahoomsg.
"/media":- It is the default location for Removable Devices such as DVD, pendrive,etc.
"/lib":- It contains library's need by no. of different applications as well as Link kernal.

hostname       - ip address will be shown 
Example: hostname -i

to set this ip address we give the command is


PWD                 Present Working/Current Directory
ls                       Listing the files & Directories.
ls -l                    Long List
ls -a                   It shows hidden files
ls -r                    Reverse order
ls -R                  To see the particular data of the nested files.
ls -d                   Directory name is shows
ls -l  -S               List the files along with size sorting
ls -l  -s                means Block Size
ls -ltr                  List the file along with Time & Date.
clear (ctl+l)       clear the screen. 



Valid card Character:-

*    means Multiple Character.
?    means Single Character.

Example:- ls r*     to shows list files start with r.


File Creation:
       File creation are 3 types. They are 
1.  cat
2.  touch
3.  vi editor
cat :- By using this  we can create  new files and also  adding new line to an existing file and also we can see file contents.

Example:-
                                cat  >  ravi                        to create the file
                                               xxx
                                               xxx
                                               xxx
                                               xxx
                                               zzz
                                               zzz
                                                                   ctrl + d    -->  to save the file.
                                   cat  ravi                          to display the file contents
                                  cat  >>  ravi                   Adding New Lines
                                                111
                                                111
                                                111
                                                111
                                                                        ctrl + d    
                                 cat  > dba
                                 cat  ravi  dba  >>  oracle
                                 cat oracle
 touch:- It will creates only n number of empty files but we cannot insert any single character or byte data and we can  change Date & Time stamp of File or Directory.

Example:- 
             
                   touch empty
                   touch  -t  11230832 ravi
                   ls -ltr


vi editor:-(Visual Interface Editor) It is use for supporting to insert or manage the data.


Editors at Different operating Systems:

For windows   Notepad
       Dos           Edit
       Linux         command mode  vi, ex, nani,etc,.
sysntax: 
                 vi  <file name>

In VI editors  there are 3 modes  available.

1. INSERT mode
2.  COMMAND mode
3.  EXECUTE mode

steps for  vi editor managing:

we open a file  with vi command, then  the files opened with  command mode
when will you go to save & exit that is execute mode

press i,I,a,A,o,O go to insert mode  for command.

press 'Esc'  key then we can do some actions like copy delete.
press 'Shift + : ' we enter  into execution mode from command mode  in that we can save/replace etc.
If you want to move from insert mode to execute mode and from execution mode  to insert mode 1st we move  into command mode.

how to enter into insert mode:

i           insert the data at current  cursor position
I          at the Beginning of the line cursor
a         append after cursor position
A        append at the end of line
o         Insert a line below & enter into insert mode
O        Insert a line above & enter into insert mode 
 r         Replace Single Character
R         Replace the word
s          Delete the current cursor position after insert
S/cc     Deletes the entire line & insert
C          Delete the after cursor position line

command mode options:-

dd           Delete a line
2dd         Delete 2 lines
ldw         Delete one word
d7w        Delete 7 words
x              Delete single character after cursor position
10x          Delete 10 character after cursor position
X             Delete single character before cursor position
10X         Delete 10 character before cursor or position
yy           copy a line
5yy         copy five lines
p              paste
u              undo
ctrl + R    Redo
gg            go to 1st line
G              go to last line
G99          go to 99th line
shift + zz       Save &Exit
h              move to left side
l                move to right side
j                move to next line
k               move to above line
n               go to the next searching word
/<find>     we can find a particular word

Execute mode commands:

:q                   quite
:q!                  quite with forcefully
:w                   save
:wq                 save & quite
:wq!                save  quite with forcefully
:x                    save and exit
:se nu            set number(col set number)
:se nonu        set no number removes line number

Replacing the words:-

:1,$s/existing word/new word/gc

              1  means replace starts from 1st line
              $  replace can do up to last time
              s  means substitute
              g  global
              c   conformation
Navigation commands:-

 cd       Change Directory or move into another directory

syntax:
              cd  <directory name>
cd   ..     move to one level back
             note: single dot it represents current working directory
                        double dot represents  parent working Directory
cd ../../        move to the 2nd level back
cd -              move to the last working directory
cd ~             move to the current user logging home directory

copy/move the file Directory:

syntax:  
1. only copy the files

                cp   < source path>    <destination path>

2. copy the directory
                cp  -r  <source path>  < destination path>


move the File or Directory:

                 mv  <source path>  <destination path>

Remove  File or Directory command:-

                          rm  <file name>                                      removing the file
                          rm -f <file name>                                  removing file forcefully
                          rm -rf  <directory name>                     remove the directory forcefully
                          rmdir  <directory name>                     remove the directory forcefully

Links:- There are 2 types of links.
1. Hard Link
2. Soft Link

def: gives a pointer to the particular file. The particular file is called link.


Hard Link Syntax:

                           ln <source >   <destination>

soft link Syntax:-  
                          ln   -s     source destination

Difference between Hard and Soft Links:



fdisk  -l            Hard disk  configuration
df                      Disk Free
df  -k                 It shows the mount points in kilobyte.
df  -h                It shows the mount points in GB
du  -h             du means disk use  file name/ directory name/mount point
                                          Example: du  -h  /d01
du  -sh  <file name>          shows the total size of file or directory
cat  /etc/passwd          to see how many users used.
cat  /etc/group             to see the group 
groupdel   <group name>      to delete groups
cal                               it shows calender
              Example:         cal         2012
date                    to see the Date & Time
date  +%b           It shows the 3 digits of the month
date  +%B          It shows the full name of the month
date  +%D          It shows the date in number
date  +%y           It shows the year in 2 digits
date  +%Y          It shows the year in full
gcalctool (or) gnome-calculator                    to open calculator window.
man (manuals)      to show the documentation of the commands
              Example: man    ls, man  df

swap addition:-

swapon  -s       it shows swap  memory size.
swapoff  /dev/sda9    those are used to show the details.
free                          it shows the RAM size and shows the swap size how much free or used













1) Type: It is a file. It has 3 options.
            d - means Directory
             l  -  linked
             - - file
2) Access permission.
         rwx   - user
         r- -    -  Groups
         r- -    -  others
3) 1 means link
4) A user/owner of the file
5) group
6) sizing bytes
7) Date & Time
8) File/Directory/linkname

In types are different options are there. They are
p - process file
s - socket file
B - Block Device
C - character device file
 Access Mode          Access Level
    Read (r)                   USER
    Write(w)                  GROUP
    Execute(x)                OTHERS

File permission mode:
There  are 2 types of file permissions.
1. Symbolic:- in t
2. Numerical / absolute
Symbolic mode:-  In this mode we use characters.

    Permission                Identification character
       Read                                 r
       write                                 w
       Execute                            x
       User                                 u
       Group                              g
       others                             o

controllers:-
                                   Add the permission use '+'
                                   Remove permission use '-'
                                   Equal permission use '='


Numerical or absolute:-
In this mode we will use numbers.
The Read permission for '4'
        Write permission for '2'
        Execute permission for '1'
   Permissions                   Number
     NILL                                 0
     Execute                            1
     Write                                2
     Write & Execute             3
     Read                                 4
     Read & Execute              5
     Read & Write                  6
     Read,Write & Execute   7

Default Directory Permission:-
 chmod  -R 777 ravi
                                            R means Recursively

top                  load average
     press 'u' and type user name
                 'q' means quit.

vmstat          Virtual Memory Statistics
iostat             input status of the CPU
To set this ip address we give the command is
                vi /etc/hosts
                 Example:
                             192.168.1.777    ravi.dba.com     ravi
to restart the Network Services without restart
                                     #  service network restart

Process Kill:

                kill -9 <process name/number>