Saturday, September 21, 2013

how to do linux partitions

how to do linux partitions  

Linux Partitions

Step 1 ) To Create the partitions

[root@client1 ~]# fdisk -l

[root@client1 ~]# fdisk /dev/hda

Command (m for help): m
d   delete a partition
      m   print this menu
    n   add a new partition
p   print the partition table
    q   quit without saving changes
    w   write table to disk and exit

Command (m for help):

Command (m for help): n
First cylinder (1098-2434, default 1098):
Using default value 1098
Last cylinder or +size or +sizeM or +sizeK (1098-2434, default 2434): +100M
Command (m for help): p
Command (m for help): n
Command (m for help): p
Command (m for help): n
Command (m for help): p
Command (m for help): d
Command (m for help): 10 #write the number of partition
Command (m for help): w

[root@client1 ~]#

To update the kernel without restarting

[root@client1 ~]# partprobe /dev/hda

[root@client1 ~]# fdisk -l


Step 2 ) Make the filesystem ( i.e format the partition) ext2, ext3, vfat

[root@client1 ~]# mkfs.ext2 /dev/hda8

[root@client1 ~]# mkfs.ext3 /dev/hda9

[root@client1 ~]# mkfs.vfat /dev/hda10









Step 3 ) Create a folder & Mount the partition to use

[root@client1 ~]# mkdir /mnt/song /mnt/video /mnt/music

[root@client1 ~]# mount /dev/hda8 /mnt/song

[root@client1 ~]# mount /dev/hda9 /mnt/video
[root@client1 ~]# mount /dev/hda10 /mnt/music

[root@client1 ~]# mount

Step 4 ) Write the data inside the partition

[root@client1 ~]# cd /mnt/song

[root@client1 song]#

[root@client1 song]# touch myfile1 myfile2 myfile3

[root@client1 song]# mkdir hyd sec bhills ameerpet

[root@client1 song]# ls

*****************  This is the output  ********************

ameerpet  bhills  hyd  lost+found  myfile1  myfile2  myfile3  sec
[root@client1 myfolder]#

Converting from ext3 to ext2

[root@client1 ~]# umount /dev/hda8

[root@client1 ~]# tune2fs -O ^has_journal /dev/hda8

[root@client1 ~]# mount /dev/hda8 /myfolder/

[root@client1 ~]# mount

Convert from ext2 to ext3

[root@client1 ~]# umount /dev/hda8

[root@client1 ~]# tune2fs -j /dev/hda8

[root@client1 ~]# mount /dev/hda8 /myfolder

[root@client1 ~]# mount



Looking forward for your suggestions.. please feel free to write to me.. Your help would definitely help to improve our blog. Chetan Yadav

Thursday, September 19, 2013

Basic Linux Command


Basic Linux  Commands


1. To check the present working directory

 [root@database ~]# pwd
/root

2. To show the contents of a directory (folder)

[root@database ~]# ls
3145.zip  args1    database_notes  Documents   ifcfg-eth1_March25  linux_image.iso  names         phonenubers  uln_migrate             uln_register.tar
args      BegPerl  Desktop         hello2.plx  index.html.1        mbox             oradiag_root  scripts    

3. To see more details including the permission regarding the contents of a
directory (folder)

[[root@database ~]# ls -l
total 3511620
-rw-r--r--  1 root   root       422670 Dec 30 10:29 3145.zip
-rwxr--r--  1 root   root          105 Apr  8 21:45 args
-rwxr--r--  1 root   root           32 Apr  8 21:51 args1
drwxr-xr-x 17 root   root         4096 Dec 30 10:31 BegPerl
-rw-r--r--  1 root   root         5022 Jan  5 09:55 database_notes
drwxr-xr-x  3 root   root         4096 Mar 25 04:45 Desktop
drwx------  3 root   root         4096 Mar 30 21:33 Documents

3. To see all contents including hidden files of a directory (folder)

[root@database ~]# ls -a
.              .bashrc         .eggcups         .gstreamer-0.10     mbox                 scripts                 uln_register.tar             .xauthgXJKsS
..             BegPerl         .elinks          .gtkrc-1.2-gnome2   .metacity            .sqldeveloper           .vboxclient-clipboard.pid    .xauthixsRh6




4. To see tree structure of nested directories

[root@database ~]# ls -R /opt
/opt:
ORCLfmap
sqldeveloper
sun
VBoxGuestAdditions-4.2.6

/opt/ORCLfmap:
prot1_32

/opt/ORCLfmap/prot1_32:
bin
etc
log

/opt/ORCLfmap/prot1_32/bin:
Fmputl

To see a file starting from f

[root@database ~]# ls f*

To see a file have a middle string as disk

[root@database ~]# ls /bin/*disk*

To see a file whose length is 3 charaters

[root@database ~]# ls ???

To see a file which starts with single char & ends up with any number of character

[root@database ~]# ls ?edh*

5. To create a file
[root@database ~]# cat > file1
hi how are you

6. To see file content
[root@database ~]# cat file1

hi how are you


7. To append a file

[root@database ~]  cat >> file1
iam fine, it is very nice

[root@database ~] cat file1 file2 >> file3 #redirecting output to file3

[root@database ~] cat file3

8. To create a file using touch command

[root@database ~]# touch f1 f2 f3 f4

[root@database ~]# ls

9. Creating a single directory

[root@database ~]# mkdir dir

10. Creating multiple directories

[root@database ~]# mkdir dir1 dir2 dir3 dir4

[root@database ~]# ls

anaconda-ks.cfg  dir   dir2  dir4  f2  f4     file2  install.log      
labmanual
Desktop          dir1  dir3  f1    f3  file1  file3  install.log.syslog

11. To create nested directories

[root@database ~]# mkdir -p d1/d2/d3/d4

To see the tree structure

[root@database ~]# ls -R d1
d1:
d2

d1/d2:
d3

d1/d2/d3:
d4

d1/d2/d3/d4:




12. To change a directory

[root@database ~]# cd dir1

[root@database ~]# cd ..

[root@database ~]# cd ../..

[root@database ~]# cd -
/root

[root@database ~]# pwd
/root

[root@database ~]# cd

[root@database ~]# pwd
/root

[root@database ~]#

13. To remove files

[root@database ~]# rm file1

rm: remove regular file `file1'? y

14. To remove an empty directory

[root@database ~]# rmdir dir1

[root@database ~]# ls
anaconda-ks.cfg  Desktop  dir2  dir4  f2  f4     file3        install.log.syslog
d1               dir      dir3  f1    f3  file2  install.log  labmanual

15. To remove a directory
[root@database ~]# rm -rf dir

[root@database ~]# ls
anaconda-ks.cfg  Desktop  dir3  f1  f3  file2  install.log         labmanual
d1               dir2     dir4  f2  f4  file3  install.log.syslog

To copy files

[root@database ~]# cp anaconda-ks.cfg file1

To copy folders

[root@database ~]# cp -r dir2 Desktop

To rename  directories and files

[root@database ~]# mv dir3 d4


[root@database ~]# ls
anaconda-ks.cfg  d4       dir2  f1  f3  file1  file3        install.log.syslog
d1               Desktop  dir4  f2  f4  file2  install.log  labmanual

To move directories and files

[root@database ~]# mv dir2 /opt

[root@database ~]# ls
anaconda-ks.cfg  d4       dir4  f2  f4     file2  install.log         labmanual
d1               Desktop  f1    f3  file1  file3  install.log.syslog


[root@database ~]# cd /opt

[root@database ~]#  ls
dir2

To search a word from single or multiple file’s

[root@database ~]# grep tom  /etc/passwd /etc/group /etc/gshadow

/etc/passwd:tom:x:500:500::/home/tom:/bin/bash
/etc/group:tom:x:500:
/etc/gshadow:tom:!::

[root@database ~]# cat /etc/passwd | grep tom

To see the type of file

[root@database ~]# file *

To view the date

[root@database ~]# date

[root@database ~]# date -s "07/15/2008 00:06:00 "
 mm/dd/yyyy hh:mm:ss
Tue Jul 15 00:06:00 EDT 2008

[root@database ~]# cal

[root@database ~]# cal 12 2008

[root@database ~]# man mkdir

[root@database ~]# man cal

To see the content screen wise

[root@database ~]# ls -l /bin  | less


Visual Interface (VI)


Commands to Go into Insert mode

To open a file use vi

e.g.
# vi test.txt

i   -  inserts the text at current cursor position
I   -  inserts the text at  beginning of line
a   -  appends the text after current cursor position
A   -  appends the text at end of line
o   -  inserts a line below current cursor position
O   -  inserts a line above current cursor position
r   -  replace a single char at current cursor position

Commands at execute mode

:q -  quit without saving
:q!   -  quit forcefully without saving
:w   -  save
:wq   -  save & quit
:wq! -  save & quit  forcefully
:x -  save & quit
:sh -  Provides temporary shell
:se nu -  Setting line numbers
:se nonu -  Removing line numbers
:84   -  Press enter goes to line 84

To move the cursor, press the h,j,k,l keys as indicated.    
             ^
             k              Hint:  The h key is at the left and moves left.
       < h       l >               The l key is at the right and moves right.
             j                     The j key looks like a down arrow
             v

w forward   word to word
b     back side word to word

Command's at command mode

dd   -  Deletes a line
2dd   -  Deletes 2 lines
yy   -  Copy a line
2yy   -  Copies 2 lines
p -  put  (deleted or copied text)
u -  Undo (can undo 1000 times)
Ctrl+r -  Redo
G - Moves cursor to last line of file
5G - Moves cursor to 5th line of file
Shift+ZZ -  save & quit
/ -  locate word


To find and replace words
:1,$s///gc

e.g.
:1,$s/world/universe/gc
 
1-- To start the search at from 1st line
$ -> End of File
s -> substitute
g -> global
c -> confirmation

To power off machine

# poweroff


Looking forward for your suggestions.. please feel free to write to me.. Your help would definitely help to improve our blog. Chetan Yadav

Wednesday, September 18, 2013

11g background Process

11g background Process


New background processes in 11g. As per Oracle documentation there are 56 new background processes added in 11g release 1

Some Important background Process

MMAN - this process is responsible for ASMM in 10g and AMM in 11g  which manages memory allocation to SGA and PGA

RCBG - this background process is responsible for processing data into server result cache

DIAG - In 11g we have a single location for all the trace files, alert log and other diagnostic files. DIAG is the process which performs  diagnostic dumps and executes oradebug commands

DIA0 – responsible for hang detection and deadlock resoultion

DBRM – Database resource manager is responsible for setting plans to users and all other database resource management activities

EMNC – Event Monitor Coordinator will coordinate with event management and notification activity

FBDA – Flashback Data Archiver process is responsible for all flashback related actions in 11g database

GEN0 - General task execution process which performs required tasks

SMCo – Space management coordinator executes various space management tasks like space reclaiming, allocation etc. It uses slave processes Wnnn whenever required

VKTM – Virtual keeper of time is  responsible for keeping track of the wall-clock time and used as a reference-time counter







Looking forward for your suggestions.. please feel free to write to me.. Your help would definitely help to improve our blog.  Chetan Yadav 

Monday, September 2, 2013


SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Date date = sdf.parse(“2013-08-05 17:41:37”);
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
calendar.add(Calendar.HOUR,2);
String finaldate = sdf.format(calendar.getTime());

Looking forward for your suggestions.. please feel free to write to me.. Your help would definitely help to improve our blog. Chetan Yadav

Friday, August 23, 2013

Oracle Webinars Coming Up In August 2013

Oracle Webinars Coming Up
Syed Jaffar Hussain (Oracle ACE Director) explains how to upgrade a 2 node 11gR2 clusterware and database to Oracle 12c. Register now (Limited spaces).
Kyle Hailey (Oracle ACE, OakTable) looks at different types of cloning technology and demonstrates how to setup risk-free database experiments. Register now(Limited spaces).
Cary Millsap (Oracle ACE Director, OakTable) explains why great performance at scale doesn't happen by accident and how performance should be measured.Watch video.






Looking forward for your suggestions.. please feel free to write to me.. Your help would definitely help to improve our blog. Chetan Yadav

Tuesday, August 6, 2013

How to unlock the user oracle (ORA-28000)

How to unlock the user
How to unlock the user in oracle, or how to solve ORA-28000



SQL> conn sqlplus AS sysdba
Enter password:
Connected.



SQL> ALTER USER username   2    ACCOUNT UNLOCK;

example:

SQL> conn sqlplus as sysdba
Enter password:
Connected.
SQL> alter user scott
  2  account unlock;

User altered.

SQL> conn  scott/tiger
ERROR:
ORA-28001: the password has expired


Changing password for scott
New password:
Retype new password:
Password changed
Connected.





Looking forward for your suggestions.. please feel free to write to me.. Your help would definitely help to improve our blog. Chetan Yadav