ITPub博客

首页 > Linux操作系统 > Linux操作系统 > Oracle中使用unix命令

Oracle中使用unix命令

原创 Linux操作系统 作者:tolywang 时间:2005-01-19 00:00:00 0 删除 编辑

(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/,如需转载,请注明出处,否则将追究法律责任。

下一篇: 给有福气的人看
请登录后发表评论 登录
全部评论
Oracle , MySQL, SAP IQ, SAP HANA, PostgreSQL, Tableau 技术讨论,希望在这里一起分享知识,讨论技术,畅谈人生 。

注册时间:2007-12-10

  • 博文量
    5595
  • 访问量
    14355244