A Oracle DBA's BLOG

Welcome to my ORACLE DBA blog. You will be Amazing!!!

Saturday, April 7, 2012

TNS Listener Configuration for Oracle

Today I will mention Oracle Listener and prepare for database.
Listener is provide connection between databases at different location.

Generally standard Listener port is 1521.
Scenario:
When Oracle installed Listener_name is Listener and port is 1521. If more databases are located on the same machine then using different listener and port more beneficial.
At this Scenario I’ll use Listener_name: My_Listener and port:1525

    1.   Preparation Database
At first we are going to look default configuration status when database is up.  For this we must create
init.ora from spfile (server parameter file or binary parameter
file)

SQL> create pfile='/tmp/test_pfile.ora' from spfile;

Open the “test_pfile” and save the following command
 *.local_listener='MY_LISTENER'
SHUTDOWN IMMEDIATE the database.

We have to make this test_pfile as Oracle Spfile in order to Up database.

SQL> create spfile from pfile='/tmp/test_pfile.ora';


   2.   Preparation LISTENER.ORA

Now we have to change listener.ora file.
When you open Listener.ora you will see the default setting change like following
MY_LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
(ADDRESS = (PROTOCOL = TCP)(HOST = machine_name)(PORT = 1525))
)
)

Here write the machine_name and change port number..

After the setting Listener would be changed like following.:

Thursday, April 5, 2012

Oracle Linux useful Command

Today i will show how to use Linux commands And Useful for Oracle DBA.

man
To show command knowledge

man(manual):

 To show contents
ls(list):
 To show hiding contents
ls -a :
 To show one under the other
ls -l :
 To show size and more information's
ls -lh :
 To show last update
ls -lrt : 
Cd
 To go other folder
cd :

/ : Linux above folder
To go above folder
Cd .. :

pwd
 To show own folder
pwd :

To create folder

mkdir

 To delete folder
rm

rm :
 to delete all
rm -R :


rmdir
 To delete empty folder
rmdir :

TO COPY FOLDER 
cp
 To move Folder 
mv
  
To show file or text 
cat | more
  
To Gzip Folder 
gzip
  
TO GUNZIP FOLDER 
gunzip

 To find folder
find

TO GIVE ALIAS 
Alias

 alias Nick_name=”<command >”  


mounting disk:

1- create a folder where to mounted.
mkdir /media/newdisk
mkdir /DATA


if we want to mount with FAT32:
mount -t vfat -o umask=ooo /dev/hdb1 /media/newdisk

if we want to mount with NTFS
mount -t ntfs -o umask=0222 /dev/hdb1 /media/newdisk

if we want to mount  CDROM:
mount -t iso_name -r /dev/cdrom /media/cdrom


if we want to mount with  OCFS2:
mount -t ocfs2 -o noatime,_netdev,datavolume,nointr /dev/emcpowera1 /DATA


if we want to mount with  EXT3:
mount -t ext3 /dev/sdb1 /software


unmounting disk:

umount -l /dev/sdb1
umount /DATA


Partitioning

fdisk /dev/sdb


Formatting


if we want to format with EXT3:
mkfs -t ext3 /dev/sdb1
if we want to format with  OCFS2:
mkfs.ocfs2 -b 4K -C 128K -N 5 -L /DATA /dev/emcpowera1

FILE SYSTEM CHECK

fsck.ocfs2 -n /dev/sdf2
fsck.ocfs2 -y /dev/sdf2 –>repair
List drives

df -h


tmpfs increase

mount -t tmpfs shmfs -o size=3g /dev/shm


Getting user id

id username
id oracle


Set user folder

chown -R oracle:dba /oracle

Change folder permission


chmod 775 file_name


Checking installed “rpm” packages

rpm -qa | grep “package name”


Rpm download 

rpm -ivh package

Rpm update


rpm -Uvh package


Rpm Delete

rpm -e package


Checking Oracle installing requires packages 
—————————————————————————————————————-

rpm -q binutils compat-db compat-libstdc++-33 libgcc glibc glibc-devel glibc-headers gcc gcc-c++ libgcc libstdc++ cpp make libaio ksh elfutils-libelf make sysstat libaio libaio-devel setarch libXp unixODBC –qf “%{NAME}-%{VERSION}-%{RELEASE} (%{ARCH})\n”|sort

Date of rpm

rpm -qa –last | more

CPIO extract


cat cpio_file | cpio -idmv

Create MD5 In order To copy or move validate folder


md5sum file > file.md5


Checking moved MD5 

md5sum -c file.md5

Folder transfer between servers


scp 192.168.192.168:oracle/veysi.pw /

 scp /oracle/full.dmp ora11g@192.168.192.166:/export #copy folder

Search folder

grep -ins 192.168.192.168(Text) -A2 -B1 list1.log


Get Process value

ps -ef |grep veysi|wc


Change Date

date -s “21 MAR 2010 02:04:00″


SEMAPHORE

ipcs -s
ipcrm

Trace OS process


strace -p pid


List Tar zip 

tar -tf java_patch.tar


Add a file or folder to Tar zip 

tar -rf java_patch.tar jre


Create Tar zip 

tar -cf java_patch.tar jdk


Change user ID 

usermod -u UID user


Delete folder after killed process 

echo “”>veysi_ora_7001.trc

Give easy path to folder


ln -s path kısayol_adı


Show status SELinux 

sestatus


To show version of download rmp package

echo ocfs2-`uname -r`


i/o static list

iostat 3


checking RAC node date: 

ssh rac1 date; ssh rac2 date; date


without using root password to get information

/etc/SUDOERS
ora11g localhost=NOPASSWD:/bin/mount,/bin/umount
ora11g talipdb=NOPASSWD:/bin/mount,/bin/umount


Last log in 

last | more


Send file to Via E-mail

mail -s “file_name” muh.veysi.47@hotmail.com < sqlnet.log


Finding word in folder

grep -ins word *

To kill more process using process_name


ps -ef |grep “process_name” |awk ‘{print ” kill -9 ” $2}’>/tmp/kill.sh


To watch process_name every 3 second

watch -n 2 “ps -ef | grep process_name | grep -v ps”


Open Log file
tail -f /var/log/messages