Oracle

Oracle DBA Unix commands-02

Advertisements

DBA Unix commands

| symbol is for combine and filter the results like we use in Power Shell pipe out.

R is for recursive & grep command is used to search text

ps -ef |grep pmon – Get the running user process.

ps -ef |grep smon – Get the running user process.

Disk related commands:

# df -h {-m,-k} -- Disk free

# du -h /opt -- Disk usage for Particular mount point disk

# pwd -present working directory

# cd /opt - change directory

# ls - list the files and folders

-l -long list like a windows properties

-lt - long list with time

-ltr - long list in reverse time

-ltra - it will show the hidden files (. files are hidden)

Security related commands

#chmod 776 abc.txts- Change permission

# chown oracle:Oinstall /opt/abc.txt - Change ownership

# chown -R oracle:Oinstall /opt/folder - Change ownership for all files by recursive -Rs

# cat /etc/group - to find the group names

# groupadd Oinstall - to create a group

# groupdel Oinstall - to delete a group

# cat /etc/passwd - to  find a user

# useradd -g Oinstall -G oinstall Oracle - To add a user (It's primary & secondary group)

# userdel Oracle - to delete a user

# passwd oracle - to change password

 

Copy and cut related commands

# cat >abc.txt - file creation

# cat >> abc.txt - Append a file (ctrl+ d is for save & c is without save)

# cat abc.txt - read a file

# vi abc.txt - to read and modify file (It's a virtual editor)

press i for insert and esc :wq for save & esc :q for without save & ! is for forcing (esc :wq!)

backspace  is one word delete and esc+dd is for enter line delete.

# head -3 abc.txt - To read first top 3

# tail -3 abc.txt - To read last top 3

# head -6 abc.txt | tail -3 - to read intermediate

# cp /opt/abc.txt  /data/xyz.txt - To copy a files

# cp -r /opt/*.txt  /data/ - To copy multiple a files -r

# mv /opt/abc.txt  /data/ - To cut and paste a files

# rm /opt/abc.txt - to remove the file

# rm -fr /opt/*.txt - to remove multiple files

# ln /opt/abc.txt  /data/xyz.txt - to link a file (It will automatically reflect the changes )

# mkdir /Oracle - create a folder

# mkdir -p /Oracle/product/11.2.0 - create a folder with subfolders -p

 

Search related commands

# find /opt -name ''abc.txt'' - it will search the name

# find . -name ''abc.txt'' - it will search all the file system (.)

# ps -ef - it will show all process (ef is for all)

# ps -ef |grep ora

# ps  -ef |grep pmon - it will show the running DBs

# cat /etc/oratab - will show al the  DBs including stopped one.

 

General commands

# mount /dev/cdrom  /mnt - to mount the CD

# umount  /mnt - to un mount

# eject - to come out of it

# id - will show the user info

# su -oracle - Switch user

# top - to get the system resource info (CPU, RAM and user process)

#kill -9 1491 - to kill the user session (or press k)

# init 0 - to shutdown server

# init 5 - to logout server

# init 6 - to reboot server

# unmae -a - it will show the system info

# cat /etc/redhat - release - will show red hat version


 

Two servers related commands

 

How to copy files between Linux servers

#ifconfig - to find the ip address

#scp -r  /opt/abc.txt root@192.9.200.10:/data

How to take a remote terminal from the local terminal

# sshroot@192.9.100.10 (enter password)

#ifconfig

How to copy a files from windows to Linux

GUI, best use WinSCP.

cmd -->ipconfig

c:\> ftp 192.9.100.10 (Enter user & pass)

ftp>pwd

/root

ftp> cd s /opt

ftp> lcd D:\ - to change local directory

ftp> bin - for copy a file in binary mode for safer side

ftp> put abc.txt

ftp> mput *.txt




How to copy a files from remote to Local

ftp> get xyz.txt

ftp>mget *.txt

ftp> bye

Note: FTP needs a RPM package.

mount the CD

# ls vsftpd * -- install all packages

#service vsftpd start/statuss

How to take a remote terminal from windows to Linux

Putty.exe

C:\> telnet 192.9.200.10 (Enter login & pass)

#ifconfig

Note: # ls chkconfig telnet on -- install all packages

#service xinetd start/statusss


###How to take a remote desktop from windows to Linux

VNC server

Xmanager

Humming bird


 

 

I’m currently working as a SQL server DBA in one of the top MNC. I’m passionate about SQL Server And I’m specialized in Administration and Performance tuning. I’m an active member of SQL server Central and MSDN forum. I also write articles in SQL server Central. For more Click here

Leave a Reply

Your email address will not be published. Required fields are marked *

5 + 1 =