Oracle中使用unix命令

(Unix) To see errors from Alert log file

cd alertlogdirectory;
grep ORA- alertSID.log

To see the name of a user from his unix id (Provided your UNIX admin keeps them!)

grep userid /etc/passwd


To see if port number 1521 is reserved for Oracle

grep 1521 /etc/services

To see the latest 20 lines in the Alert log file:

tail -20 alertSID.log

To see the first 20 lines in the Alert log file:

head -20 alertSID.log

To find a file named "whereare.you" under all sub-directories of /usr/oracle

find /usr/oracle -name whereare.you -print

To remove all the files under /usr/oracle which end with .tmp

find /usr/oracle -name "*.tmp" -print -exec rm -f {} ;

To list all files under /usr/oracle which are older than a week.

find /usr/oracle -mtime +7 -print

To list all files under /usr/oracle which are modified within a week.

find /usr/oracle -mtime -7 -print

To compress all files which end with .dmp and are more than 1 MB.

find /usr/oracle -size +1048576c -name "*.dmp" -print -exec compress {} ;

To see the shared memory segment sizes

ipcs -mb

To see the space used and available on /oracle mount point

df -k /oracle

To see the users logged in to the server and their IP address

who -T

To change passwd of oracle user

passwd oracle

To convert the contents of a text file to UPPERCASE

tr "[a-z]" "[A-Z]" < filename > newfilename

To convert the contents of a text file to lowercase.

tr "[A-Z]" "[a-z]" < filename > newfilename

To kill a process from Unix.

kill unixid
OR
kill -9 unixid

To see the oracle processes

ps -ef | grep SIDNAME

To see the number of lines in a text file (can be used to find the number of records while loading data from text file).

wc -l filename

To change all occurrences of SCOTT with TIGER in a file

sed 's/SCOTT/TIGER/g' filename > newfilename

To see lines 100 to 120 of a file

head -120 filename | tail -20

To truncate a file (for example listener.log file)

rm filename; touch filename

To see if SQL*Net connection is OK.

tnsping SIDNAME

To see if the server is up.

ping servername
OR
ping IPADDRESS

To see the versions of all Oracle products installed on the server.

$ORACLE_HOME/orainst/inspdver

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/35489/viewspace-84243/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/35489/viewspace-84243/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值