oracle幾個有用的命令

regonly1發表於2009-01-07

1.tnsping:這個命令用於驗證在tnsnames.ora檔案中配置的資料庫主機資訊是否有效,如配置了這樣一段:
DBS =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 10.0.0.23)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SID = dbs)
      (SERVER = DEDICATED)
    )
  )
為了檢測該配置是否生效,就可以用:tnsping dbs
bash[dvbtrain@dvb1:/traindvb/dvbtrain/tomcat/webapps/backup]=>tnsping dbs TNS Ping Utility for Solaris: Version 9.2.0.1.0 - Production on 07-1月 -2009 15:19:07

Copyright (c) 1997 Oracle Corporation.  All rights reserved.

Used parameter files:
/oracle/ora92/product/9.2.0/network/admin/sqlnet.ora


Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 10.0.0.23)(PORT = 1521))) (CONNECT_DATA = (SID = train) (SERVER = DEDICATED)))
OK (10 msec)
2.oerr
這個命令用於檢視oracle的報錯編號的含義,使用方式: oerr ora 00600
如:
bash[dvbtrain@dvb1:/traindvb/dvbtrain/tomcat/webapps/backup]=>oerr ora 00600
00600, 00000, "internal error code, arguments: [%s], [%s], [%s], [%s], [%s], [%s], [%s], [%s]"
// *Cause:  This is the generic internal error number for Oracle program
//         exceptions.  This indicates that a process has encountered an
//         exceptional condition.
// *Action: Report as a bug - the first argument is the internal error number
非常使用,對日常的一些簡單的錯誤可首先查這個。
3.tkprof
這個命令用於對Oracle的trace file進行分析(SQL語句效能分析),使用方式:
tkprof tracefile.trc aa

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/12932950/viewspace-531643/,如需轉載,請註明出處,否則將追究法律責任。

相關文章