Monday, May 2, 2011

Connecting JAZN


Cd /u00/app/oracle10g/product/10.2.0/oc4j/j2ee/isqlplus/application-deployments/isqlplus

/u00/app/oracle10g/product/10.2.0/jdk/bin/java -Djava.security.properties=/u00/app/oracle10g/product/10.2.0/sqlplus/admin/iplus/provider -jar /u00/app/oracle10g/product/10.2.0/oc4j/j2ee/home/jazn.jar -user "iSQL*Plus DBA/admin" -password welcome –shell

[oracle10g@hdbs isqlplus]$ pwd

/u00/app/oracle10g/product/10.2.0/oc4j/j2ee/isqlplus/application-deployments/isqlplus

[oracle10g@hdbs isqlplus]$

[oracle10g@hdbs isqlplus]$ /u00/app/oracle10g/product/10.2.0/jdk/bin/java -Djava.security.properties=/u00/app/oracle10g/product/10.2.0/sqlplus/admin/iplus/provider -jar /u00/app/oracle10g/product/10.2.0/oc4j/j2ee/home/jazn.jar -user "iSQL*Plus DBA/admin" -password welcome -shell

JAZN:>

JAZN:> adduser "iSQL*Plus DBA" adeel naveed

JAZN:> listusers "iSQL*Plus DBA"

adeel

admin

umer

sys

system

JAZN:> grantrole webDba "iSQL*Plus DBA" adeel

JAZN:> exit

JAZN:>

[oracle10g@hdbs isqlplus]$

Frequently used OS commands for DBA


As DBA you need to use frequent OS command, here I would like to share you some of the important day to day commands:


1. To delete files older than N number of days ? (Useful in delete log, trace, tmp file )
find . -name ‘*.*’ -mtime +[N in days] -exec rm {} \;
Example : find . -mtime +5 -exec rm {} \;
(This command will delete files older then N days in that directory


2. To list files modified in last N days
find . -mtime - -exec ls -lt {} \;
Example: find . -mtime +3 -exec ls -lt {} \;1
So to find files modified in last 3 days

3. To sort files based on Size of file ?
ls -l | sort -nk 5 | more
useful to find large files in log directory to delete in case disk is full

4. To find files changed in last N days
find -mtime -N –print
Example: find -mtime -2 -print

5. To extract cpio file
cpio -idmv < file_name
(Don’t forget to use sign < before file name)

6. To find CPU & Memory detail of linux
cat /proc/cpuinfo (CPU)
cat /proc/meminfo (Memory)

7. To find if Operating system in 32 bit or 64 bit ?
For solaris use command
isainfo -v
If you see out put like
32-bit sparc applications
That means your O.S. is only 32 bit
but if you see output like
64-bit sparcv9 applications
32-bit sparc applications
above means your o.s. is 64 bit & can support both 32 & 64 bit applications

8. To find if any service is listening on particular port or not ?
netstat -an | grep {port no}
Example: netstat -an | grep 1523

9. To find Process ID (PID) associated with any port ?
This command is useful if any service is running on a particular port (389, 1521..) and that is run away process which you wish to terminate using kill command

lsof | grep {port no.} (lsof should be installed and in path)

9. To change a particular pattern in a file ?
Open file using vi or any other editor, go in escape mode (by pressing escape) and use
:1,$s/old_pattern/new_parameter/gc ( g will change globally, c will ask for confirmation before changing )

10. To find a pattern in some file in a directory ?
grep pattern file_name
( to find pattern in particular file )
grep pattern * ( in all files in that directory )
If you know how to find a pattern in files in that directory recursively please answer that as comment

11. To create symbolic link to a file ?
ln -s pointing_to symbolic_name
Example : ln -s b a
If you want to create symbolic link from a -> b
(Condition:you should have file b in that directory & there should not be any file with name a)

12. To setup cronjob (cronjob is used to schedule job in Unix at O.s. Level )
crontab -l( list current jobs in cron)
crontab -e ( edit current jobs in cron)
_1_ _2_ _3_ _4_ _5_ executable_or_job
Where
1 – Minutes (0-59)
2 – Hours ( 0-24)
3 – day of month ( 1- 31 )
4 – Month ( 1-12)
5 – A day of week ( 0- 6 ) 0 -> sunday 1-> monday
e.g. 0 3 * * 6 Means run job at 3AM every saturday
This is useful for scheduling tablespace threshold, ftp, rman backup or removed old log files, or other scripts regularly.
Sample Scheduled backup:
$ crontab –l
Rman Database:
00
20
*
*
1,4
/u07/rman/scripts/call_dbbkup_cm0.scp
00
15
*
*
6
/u07/rman/scripts/offbkup_rman.sh
00
20
*
*
0,2,3,6
/u07/rman/scripts/call_arch_bkup.scp
OTA Database:
50
23
*
*
0,2,3,6
/u01/ota/dailyexp_ota.sh
50
23
*
*
1,4
/u01/ota/offbkup_ota.sh
15
14
*
*
0,1,2,3,4,6
/u01/ota/morning_arch.sh



How to kill all similar processes with single command (in this case opmn)
ps -ef | grep opmn |grep -v grep | awk ‘{print $2}’ |xargs -i kill -9 {}

Locating Files under a particular directory
find . -print |grep -i test.sql

Using AWK in UNIX
To remove a specific column of output from a UNIX command – for example to determine the UNIX process Ids for all Oracle processes on server (second column)
ps -ef |grep -i oracle |awk '{ print $2 }'

Changing the standard prompt for Oracle Users
Edit the .profile for the oracle user
PS1="`hostname`*$ORACLE_SID:$PWD>"

Display top 10 CPU consumers using the ps command
/usr/ucb/ps auxgw | head -11

Show number of active Oracle dedicated connection users for a particular ORACLE_SID
ps -ef | grep $ORACLE_SID|grep -v grep|grep -v ora_|wc -l

Display the number of CPU’s in Solaris
psrinfo -v | grep "Status of processor"|wc -l

Display the number of CPU’s in AIX
lsdev -C | grep Process|wc -l

Display RAM Memory size on Solaris
prtconf |grep -i mem

Display RAM memory size on AIX
First determine name of memory device
lsdev -C |grep mem
then assuming the name of the memory device is ‘mem0’
lsattr -El mem0

Swap space allocation and usage
Solaris : swap -s or swap -l
Aix : lsps -a

Total number of semaphores held by all instances on server
ipcs -as | awk '{sum += $9} END {print sum}'

View allocated RAM memory segments
ipcs -pmb

Manually deallocate shared memeory segments
ipcrm -m ''

Show mount points for a disk in AIX
lspv -l hdisk13

Display amount of occupied space (in KB) for a file or collection of files in a directory or sub-directory
du -ks * | sort -n| tail

Display total file space in a directory
du -ks .

Cleanup any unwanted trace files more than seven days old
find . *.trc -mtime +7 -exec rm {} \;

Locate Oracle files that contain certain strings
find . -print | xargs grep rollback

Locate recently created UNIX files (in the past one day)
find . -mtime -1 -print

Finding large files on the server (more than 100MB in size)
find . -size +102400 -print

Crontab :
To submit a task every Tuesday (day 2) at 2:45PM
45 14 2 * * /opt/oracle/scripts/tr_listener.sh > /dev/null 2>&1

To submit a task to run every 15 minutes on weekdays (days 1-5)
15,30,45 * 1-5 * * /opt/oracle/scripts/tr_listener.sh > /dev/null 2>&1

To submit a task to run every hour at 15 minutes past the hour on weekends (days 6 and 0)
15 * 0,6 * * opt/oracle/scripts/tr_listener.sh > /dev/null 2>&1

Sunday, April 17, 2011

Enabling archivelog in oracle10g


Using Spfile:

1. Cold backup must be performed before enabling archivelog.

2. Take spfile backup

3. Enable archvielog destination

a. Alter system set log_archive_dest_1=’LOCATION=\path’ scope =both

b. alter system set log_archive_format='arch_%t_%s_%r.arc' scope=both;

c. shutdown immediate;

4. connect as sysdba

5. startup mount;

6. alter database archivelog;

7. alter database open;

8. archive log list;

9. SQL> archive log list;

Database log mode Archive Mode

Automatic archival Enabled

Archive destination /u06/csr/oradata/arch

Oldest online log sequence 8

Next log sequence to archive 12

Current log sequence 12

SQL>

10. Perform cold backup after enabling archivelog

Using pfile:

1. Create pfile from spfile;

2. Shutdown database

3. Edit pfile n add

a. *.log_archive_dest_1='LOCATION=/u06/arch'

b. *.log_archive_format='arch_%t_%s_%r.arc'

4. Startup mount pfile=\pfilepath

5. Alter database archivelog

6. alter database open;

7. archive log list;

8. SQL> archive log list;

Database log mode Archive Mode

Automatic archival Enabled

Archive destination /u06/csr/oradata/arch

Oldest online log sequence 8

Next log sequence to archive 12

Current log sequence 12

SQL>

9. Create spfile from pfile;

Wednesday, February 9, 2011

Telnet / FTP access

[root@dell ~]# chkconfig telnet on

[root@dell ~]# service xinetd reload

Reloading configuration: [ OK ]

[root@dell ~]# /etc/init.d/vsftpd start

Starting vsftpd for vsftpd: [ OK ]

[root@dell ~]# vi /etc/securetty

Simply edit the file /etc/securetty and add the following to the end of the file:

pts/0
pts/1
pts/2
pts/3
pts/4
pts/5
pts/6
pts/7
pts/8
pts/9

[root@dell ~]# vi /etc/vsftpd.ftpusers

[root@dell ~]# vi /etc/vsftpd.user_list

Edit the files /etc/vsftpd.ftpusers and /etc/vsftpd.user_list and remove the 'root' line from each file.

[root@dell ~]# ln -s /etc/init.d/vsftpd /etc/rc3.d/S56vsftpd

[root@dell ~]# ln -s /etc/init.d/vsftpd /etc/rc4.d/S56vsftpd

[root@dell ~]# ln -s /etc/init.d/vsftpd /etc/rc5.d/S56vsftpd

Tuesday, December 29, 2009

BeSt Of LuCk

Dear Friends

Plssssss go thruuuuu,please do it... jst follow the rules

Copy this onto notepad, press cntrl + H, press 6 in find box and
underscore(_) in replace box and click replace all button. U will get
thrilled

666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666
666996666699669966999999996699666669966666669966666699669999999966996666996666666666666696666666666666666666666
666996666699669966999999996699666669966666666996666996669999999966996666996666666666666999666666666666666666666

666996666699669966996666666699666669966666666699669966669966669966996666996666666666669969966666666666666666666
666996696699669966999999996699999999966666666669999666669966669966996666996666666666699666996666666666666666666
666996999699669966999999996699999999966666666666996666669966669966996666996666666666999999999666666666666666666

666999969999669966666666996699666669966666666666996666669966669966996666996666666669999999999966666666666666666
666999666999669966999999996699666669966666666666996666669999999966996666996666666699666666666996666666666666666
666996666699669966999999996699666669966666666666996666669999999966999999996666666996666666666699666666666666666

666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666
666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666
666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666
669966666996666666669666666666999999996699999999669966666699666666669966666996699999999669966666996666666666666
669966666996666666699966666666999999996699999999666996666996666666669996666996699999999669966666996666666666666

669966666996666666996996666666996666996699666699666699669966666666669999666996699666666669966666996666666666666
669999999996666669966699666666999999996699999999666669999666666666669969966996699999999669966966996666666666666
669999999996666699999999966666999999996699999999666666996666666666669966996996699999999669969996996666666666666
669966666996666999999999996666999666666699666666666666996666666666669966699996699666666669999699996666666666666

669966666996669966666666699666996666666699666666666666996666666666669966669996699999999669996669996666666666666
669966666996699666666666669966996666666699666666666666996666666666669966666996699999999669966666996666666666666
666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666
666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666
666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666
666996666669966999999996666666669666666666999999996666666699999996699999999666999666699999999666666666666666666
666699666699666999999996666666699966666666999999996666666699999999699666699666699666699666699666666666666666666
666669966996666996666666666666996996666666996666996666666666666699699966699666699666699966699666666666666666666
666666999966666999999996666669966699666666999999996666666666666996699696699666699666699696699666666666666666666

666666699666666999999996666699999999966666999999996666666666669966699669699666699666699669699666666666666666666
666666699666666996666666666999999999996666996996666666666666996666699666999666699666699666999666666666666666666
666666699666666999999996669966666666699666996699666666666699999999699666699666699666699666699666666666666666666
666666699666666999999996699666666666669966996666996666666699999999699999999666999966699999999666666666666666666
666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666

BEST OF LUCK