Oracle环境变量、监听listener.ora、tnsnames.ora、sqlnet.ora配置

2021/4/10 2:25:24

本文主要是介绍Oracle环境变量、监听listener.ora、tnsnames.ora、sqlnet.ora配置,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!

Oracle环境变量、监听listener.ora、tnsnames.ora、sqlnet.ora配置


点击(此处)折叠或打开

  1. NLS_DATE_FORMAT=YYYY-MM-DD HH24:mi:ss
  2. NLS_LANG=AMERICAN_CHINA.ZHS16GBK
  3. ORACLE10G=D:\Program files\app\oracle\product\10.2.0\db_1
  4. ORACLE11G=D:\Program files\app\oracle\product\11.2.0.1\dbhome_1
  5. ORACLE8I=D:\Program files\app\oracle\product\ora8i
  6. ORACLE9I=D:\Program files\app\oracle\product\ora92
  7. ORACLE_HOME=D:\Program files\app\oracle\product\11.2.0.1\dbhome_1
  8. PATH=%ORACLE_HOME%\bin
  9. TNS_ADMIN=%ORACLE_HOME%\NETWORK\ADMIN




  10. ---------cmd下设置用户环境变量
  11. SETX "NLS_DATE_FORMAT" "YYYY-MM-DD HH24:MI:SS"
  12. SETX "NLS_LANG" "AMERICAN_CHINA.ZHS16GBK"
  13. SETX "ORACLE10G" "D:\Program files\app\oracle\product\10.2.0\db_1"
  14. SETX "ORACLE11G" "D:\Program files\app\oracle\product\11.2.0.1\dbhome_1"
  15. SETX "ORACLE8I" "D:\Program files\app\oracle\product\ora8i"
  16. SETX "ORACLE9I" "D:\Program files\app\oracle\product\ora92"
  17. SETX "ORACLE_HOME" "D:\Program files\app\oracle\product\11.2.0.1\dbhome_1"
  18. SETX "TNS_ADMIN" "%ORACLE_HOME%\NETWORK\ADMIN"
  19. SETX "Path" "%ORACLE_HOME%\bin"
  20. SETX "VBOX_MSI_INSTALL_PATH" "D:\Program Files\Oracle\VirtualBox"



  21. alter session set nls_language='SIMPLIFIED CHINESE';
  22. alter system set nls_language='AMERICAN' scope=spfile;




  23. ------------------------------------ sqlnet.ora----------------------------------------------
  24. ---------- windows
  25. SQLNET.AUTHENTICATION_SERVICES= (NTS)
  26. NAMES.DIRECTORY_PATH= (TNSNAMES, EZCONNECT)

  27. ---------- linux
  28. SQLNET.AUTHENTICATION_SERVICES= (ALL)
  29. NAMES.DIRECTORY_PATH= (TNSNAMES, EZCONNECT)



  30. --------------------------------------------------------------------- oracle
  31. # .bash_profile

  32. # Get the aliases and functions
  33. if [ -f ~/.bashrc ]; then
  34.     . ~/.bashrc
  35. fi

  36. # User specific environment and startup programs

  37. export PATH=$PATH:/sbin/:$HOME/bin

  38.   
  39. # for oracle user

  40. unset USERNAME

  41. export GLOBAL_DB_UNIQUE_NAME=orclasm
  42. export ORACLE_HOSTNAME=192.168.128.134
  43. export ORACLE_UNQNAME=orclasm

  44. export EDITOR=vi
  45. export ORACLE_SID=orclasm
  46. export ORACLE_BASE=/u01/app/oracle
  47. export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome_1
  48. export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
  49. export ORACLE_ALERT=$ORACLE_BASE/diag/rdbms/$ORACLE_SID/$ORACLE_SID/trace
  50. export PATH=$ORACLE_HOME/bin:$PATH
  51. export TNS_ADMIN=$ORACLE_HOME/network/admin
  52. export ORACLE_PATH=.:$ORACLE_BASE/dba_scripts/sql:$ORACLE_HOME/rdbms/admin
  53. umask 022

  54. #export NLS_LANG="SIMPLIFIED CHINESE_CHINA.ZHS16GBK"    SELECT userenv('LANGUAGE') db_NLS_LANG FROM DUAL;
  55. export NLS_LANG="SIMPLIFIED CHINESE_CHINA.AL32UTF8"
  56. export SQLPATH=$ORACLE_HOME/sqlplus/admin
  57. export NLS_DATE_FORMAT='YYYY-MM-DD HH24:mi:ss';

  58. alias sqlplus='rlwrap sqlplus'
  59. alias rman='rlwrap rman'
  60. alias asmcmd='rlwrap asmcmd'
  61. alias alert_log='tail -200f $ORACLE_ALERT/alert_$ORACLE_SID.log'
  62. alias alert_xml='tail -200f $ORACLE_BASE/diag/rdbms/$ORACLE_SID/$ORACLE_SID/alert/log.xml'
  63. alias alert_listener='tail -200f $ORACLE_BASE/diag/tnslsnr/rhel6/listener/trace/listener.log'


  64.  



  65. stty erase ^h
  66. ORACLE_HOME=D:\Program files\app\oracle\product\11.2.0.1\dbhome_1
  67. PATH=%ORACLE_HOME%\bin
  68. TNS_ADMIN=%ORACLE_HOME%\NETWORK\ADMIN
  69. ##NLS_LANG=AMERICAN_AMERICA.ZHS16GBK
  70. NLS_LANG=SIMPLIFIED CHINESE_CHINA.ZHS16GBK
  71. #ORACLE_SCRIPT=%ORACLE_HOME%\RDBMS\ADMIN
  72. SQLPATH=.;%ORACLE_BASE%\dba_scripts\sql;%ORACLE_HOME%\rdbms\admin


  73. NLS_LANG="SIMPLIFIED CHINESE_CHINA.ZHS16CGB231280"
  74. NLS_LANG="SIMPLIFIED CHINESE_CHINA.ZHS16GBK"
  75. NLS_LANG="SIMPLIFIED CHINESE_CHINA.AL32UTF8"
  76. NLS_LANG=AMERICAN_AMERICA.UTF8
  77. NLS_LANG=AMERICAN_AMERICA.AL32UTF8
  78. NLS_LANG=AMERICAN_AMERICA.ZHS16GBK
  79. NLS_LANG=AMERICAN_CHINA.ZHS16GBK


  80. NLS_DATE_FORMAT='YYYY-MM-DD HH24:mi:ss'




  81. --------------------------------------------------------------------- grid

  82. # .bash_profile

  83. # Get the aliases and functions
  84. if [ -f ~/.bashrc ]; then
  85.         . ~/.bashrc
  86. fi

  87. # User specific environment and startup programs

  88. export PATH=$PATH:$HOME/bin


  89. # for grid user
  90. export ORACLE_SID=+ASM
  91. export ORACLE_BASE=/u01/app/grid
  92. export ORACLE_HOME=/u01/app/grid/11.2.0
  93. export LD_LIBRARY_PATH=$ORACLE_HOME/lib
  94. export PATH=$ORACLE_HOME/bin:$PATH
  95. umask 022


  96. alias sqlplus='rlwrap sqlplus'
  97. alias asmcmd='rlwrap asmcmd'
  98. alias alert_log='tail -200f $ORACLE_BASE/diag/asm/+asm/$ORACLE_SID/trace/alert_$ORACLE_SID.log'
  99. alias crsd_log='tail -200f $ORACLE_HOME/log/$HOSTNAME/crsd/crsd.log'



  100. 在linux和unix上有时不知道该使用LD_LIBRARY_PATH还是LIBPATH,经过搜索和实际使用,实际的情况如下

  101. OS Environment Variable                Name
  102. Linux                        LD_LIBRARY_PATH
  103. Solaris 32-bit ruby                LD_LIBRARY_PATH_32 or LD_LIBRARY_PATH
  104. Solaris 64-bit ruby                LD_LIBRARY_PATH_64 or LD_LIBRARY_PATH
  105. HP-UX PA-RISC 32-bit ruby            SHLIB_PATH
  106. HP-UX PA-RISC 64-bit ruby            LD_LIBRARY_PATH
  107. HP-UX IA64                    LD_LIBRARY_PATH
  108. Mac OS X                    DYLD_LIBRARY_PATH
  109. AIX                        LIBPATH



  110. -----------------------------------------------------------------------------------------------
  111. ------------------------------------listener.ora--------------------------------------------
  112. --动态监听: alter system set LOCAL_LISTENER='(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.59.157)(PORT = 1521))';
  113. -----------------------------------------------------------------------------------------------
  114. # listener.ora Network Configuration File: /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora
  115. # Generated by Oracle configuration tools.

  116. LISTENER =
  117.   (DESCRIPTION_LIST =
  118.     (DESCRIPTION =
  119.       (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.59.129)(PORT = 1521))
  120.     )
  121.   )
  122. SID_LIST_LISTENER =
  123.   (SID_LIST =
  124.    (SID_DESC =
  125.       (SID_NAME = PLSExtProc)
  126.       (ORACLE_HOME = /u01/app/oracle/product/11.2.0/dbhome_1)
  127.       (PROGRAM = extproc)
  128.     )
  129.    (SID_DESC =
  130.      (GLOBAL_DBNAME = orcl.lhr.com)
  131.      (SID_NAME = orcl)
  132.      (ORACLE_HOME = /u01/app/oracle/product/11.2.0/dbhome_1)
  133.    )
  134.    (SID_DESC =
  135.      (GLOBAL_DBNAME = rman.lhr.com)
  136.      (SID_NAME = rman)
  137.      (ORACLE_HOME = /u01/app/oracle/product/11.2.0/dbhome_1)
  138.    )
  139.   )

  140. LSNR2 =
  141.   (DESCRIPTION_LIST =
  142.     (DESCRIPTION =
  143.       (ADDRESS_LIST =
  144.         (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.59.129)(PORT = 1526))
  145.       )
  146.     )
  147.   )
  148. SID_LIST_LSNR2 =
  149.   (SID_LIST =
  150.     (SID_DESC =
  151.       (SID_NAME = PLSExtProc)
  152.       (ORACLE_HOME = /u01/app/oracle/product/11.2.0/dbhome_1)
  153.       (PROGRAM = extproc)
  154.     )
  155.   )

  156. ADR_BASE_LISTENER = /u01/app/oracle


  157. ------------windows 下
  158. SID_LIST_LISTENER =
  159.   (SID_LIST =
  160.     (SID_DESC =
  161.       (SID_NAME = CLRExtProc)
  162.       (ORACLE_HOME = D:\app\oracle\product\11.2.0.1)
  163.       (PROGRAM = extproc)
  164.       (ENVS = "EXTPROC_DLLS=ONLY:D:\app\oracle\product\11.2.0.1\bin\oraclr11.dll")
  165.     )
  166.     (SID_DESC =
  167.      (GLOBAL_DBNAME = orcl.lhr.com)
  168.      (SID_NAME = orcl)
  169.      (ORACLE_HOME = D:\app\oracle\product\11.2.0.1)
  170.    )
  171.   )


  172. -----------------------/u01/app/oracle/product/11.2.0/dbhome_1/network/admin/tnsnames.ora
  173. # tnsnames.ora Network Configuration File: /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/tnsnames.ora
  174. # Generated by Oracle configuration tools.

  175. orcl =
  176.   (DESCRIPTION =
  177.     (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.59.133)(PORT = 1521))
  178.     (CONNECT_DATA =
  179.       (SERVER = DEDICATED)
  180.       (SERVICE_NAME = orcl.lhr.com)
  181.     )
  182.   )

  183. #### 动态监听非默认端口
  184. LSNR_ORCL =
  185.   (DESCRIPTION =
  186.     (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.59.129)(PORT = 1526))
  187.     (CONNECT_DATA =
  188.       (SERVICE_NAME = orcl)
  189.     )
  190.   )


  191. -------------------------------------------------------------------- rac
  192. --- TAF BASIC方式
  193. racdb_vip =
  194.   (DESCRIPTION =
  195.     (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.132)(PORT = 1521))
  196.     (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.131)(PORT = 1521))
  197.     (LOAD_BALANCE = on)
  198.     (CONNECT_DATA =
  199.       (SERVER = DEDICATED)
  200.       (SERVICE_NAME = jmrac)
  201.       (FAILOVER_MODE =
  202.          (TYPE = SELECT)
  203.          (METHOD = BASIC)
  204.          (RETRIES = 180)
  205.          (DELAY = 5)
  206.       )
  207.     )
  208.   )

  209. --- TAF preconnect方式
  210. racdb_vip1 =
  211.   (DESCRIPTION =
  212.     (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.131)(PORT = 1521))
  213.     (CONNECT_DATA =
  214.       (SERVER = DEDICATED)
  215.       (SERVICE_NAME = jmrac)
  216.       (FAILOVER_MODE =
  217.          (TYPE = SELECT)
  218.          (METHOD = BASIC)
  219.          (BACKUP = preconnect)
  220.       )
  221.     )
  222.   )

  223. racdb_vip2 =
  224.   (DESCRIPTION =
  225.     (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.132)(PORT = 1521))
  226.     (CONNECT_DATA =
  227.       (SERVER = DEDICATED)
  228.       (SERVICE_NAME = jmrac)
  229.       (FAILOVER_MODE =
  230.          (TYPE = SELECT)
  231.          (METHOD = BASIC)
  232.          (BACKUP = preconnect)
  233.       )
  234.     )
  235.   )




这篇关于Oracle环境变量、监听listener.ora、tnsnames.ora、sqlnet.ora配置的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!


扫一扫关注最新编程教程