Oracle环境变量、监听listener.ora、tnsnames.ora、sqlnet.ora配置
点击(此处)折叠或打开
- NLS_DATE_FORMAT=YYYY-MM-DD HH24:mi:ss
- NLS_LANG=AMERICAN_CHINA.ZHS16GBK
- ORACLE10G=D:\Program files\app\oracle\product\10.2.0\db_1
- ORACLE11G=D:\Program files\app\oracle\product\11.2.0.1\dbhome_1
- ORACLE8I=D:\Program files\app\oracle\product\ora8i
- ORACLE9I=D:\Program files\app\oracle\product\ora92
- ORACLE_HOME=D:\Program files\app\oracle\product\11.2.0.1\dbhome_1
- PATH=%ORACLE_HOME%\bin
- TNS_ADMIN=%ORACLE_HOME%\NETWORK\ADMIN
- ---------cmd下设置用户环境变量
- SETX "NLS_DATE_FORMAT" "YYYY-MM-DD HH24:MI:SS"
- SETX "NLS_LANG" "AMERICAN_CHINA.ZHS16GBK"
- SETX "ORACLE10G" "D:\Program files\app\oracle\product\10.2.0\db_1"
- SETX "ORACLE11G" "D:\Program files\app\oracle\product\11.2.0.1\dbhome_1"
- SETX "ORACLE8I" "D:\Program files\app\oracle\product\ora8i"
- SETX "ORACLE9I" "D:\Program files\app\oracle\product\ora92"
- SETX "ORACLE_HOME" "D:\Program files\app\oracle\product\11.2.0.1\dbhome_1"
- SETX "TNS_ADMIN" "%ORACLE_HOME%\NETWORK\ADMIN"
- SETX "Path" "%ORACLE_HOME%\bin"
- SETX "VBOX_MSI_INSTALL_PATH" "D:\Program Files\Oracle\VirtualBox"
- alter session set nls_language='SIMPLIFIED CHINESE';
- alter system set nls_language='AMERICAN' scope=spfile;
- ------------------------------------ sqlnet.ora----------------------------------------------
- ---------- windows
- SQLNET.AUTHENTICATION_SERVICES= (NTS)
- NAMES.DIRECTORY_PATH= (TNSNAMES, EZCONNECT)
- ---------- linux
- SQLNET.AUTHENTICATION_SERVICES= (ALL)
- NAMES.DIRECTORY_PATH= (TNSNAMES, EZCONNECT)
- --------------------------------------------------------------------- oracle
- # .bash_profile
- # Get the aliases and functions
- if [ -f ~/.bashrc ]; then
- . ~/.bashrc
- fi
- # User specific environment and startup programs
- export PATH=$PATH:/sbin/:$HOME/bin
-
- # for oracle user
- unset USERNAME
- export GLOBAL_DB_UNIQUE_NAME=orclasm
- export ORACLE_HOSTNAME=192.168.128.134
- export ORACLE_UNQNAME=orclasm
- export EDITOR=vi
- export ORACLE_SID=orclasm
- export ORACLE_BASE=/u01/app/oracle
- export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome_1
- export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
- export ORACLE_ALERT=$ORACLE_BASE/diag/rdbms/$ORACLE_SID/$ORACLE_SID/trace
- export PATH=$ORACLE_HOME/bin:$PATH
- export TNS_ADMIN=$ORACLE_HOME/network/admin
- export ORACLE_PATH=.:$ORACLE_BASE/dba_scripts/sql:$ORACLE_HOME/rdbms/admin
- umask 022
- #export NLS_LANG="SIMPLIFIED CHINESE_CHINA.ZHS16GBK" SELECT userenv('LANGUAGE') db_NLS_LANG FROM DUAL;
- export NLS_LANG="SIMPLIFIED CHINESE_CHINA.AL32UTF8"
- export SQLPATH=$ORACLE_HOME/sqlplus/admin
- export NLS_DATE_FORMAT='YYYY-MM-DD HH24:mi:ss';
- alias sqlplus='rlwrap sqlplus'
- alias rman='rlwrap rman'
- alias asmcmd='rlwrap asmcmd'
- alias alert_log='tail -200f $ORACLE_ALERT/alert_$ORACLE_SID.log'
- alias alert_xml='tail -200f $ORACLE_BASE/diag/rdbms/$ORACLE_SID/$ORACLE_SID/alert/log.xml'
- alias alert_listener='tail -200f $ORACLE_BASE/diag/tnslsnr/rhel6/listener/trace/listener.log'
-
- stty erase ^h
- ORACLE_HOME=D:\Program files\app\oracle\product\11.2.0.1\dbhome_1
- PATH=%ORACLE_HOME%\bin
- TNS_ADMIN=%ORACLE_HOME%\NETWORK\ADMIN
- ##NLS_LANG=AMERICAN_AMERICA.ZHS16GBK
- NLS_LANG=SIMPLIFIED CHINESE_CHINA.ZHS16GBK
- #ORACLE_SCRIPT=%ORACLE_HOME%\RDBMS\ADMIN
- SQLPATH=.;%ORACLE_BASE%\dba_scripts\sql;%ORACLE_HOME%\rdbms\admin
- NLS_LANG="SIMPLIFIED CHINESE_CHINA.ZHS16CGB231280"
- NLS_LANG="SIMPLIFIED CHINESE_CHINA.ZHS16GBK"
- NLS_LANG="SIMPLIFIED CHINESE_CHINA.AL32UTF8"
- NLS_LANG=AMERICAN_AMERICA.UTF8
- NLS_LANG=AMERICAN_AMERICA.AL32UTF8
- NLS_LANG=AMERICAN_AMERICA.ZHS16GBK
- NLS_LANG=AMERICAN_CHINA.ZHS16GBK
- NLS_DATE_FORMAT='YYYY-MM-DD HH24:mi:ss'
- --------------------------------------------------------------------- grid
- # .bash_profile
- # Get the aliases and functions
- if [ -f ~/.bashrc ]; then
- . ~/.bashrc
- fi
- # User specific environment and startup programs
- export PATH=$PATH:$HOME/bin
- # for grid user
- export ORACLE_SID=+ASM
- export ORACLE_BASE=/u01/app/grid
- export ORACLE_HOME=/u01/app/grid/11.2.0
- export LD_LIBRARY_PATH=$ORACLE_HOME/lib
- export PATH=$ORACLE_HOME/bin:$PATH
- umask 022
- alias sqlplus='rlwrap sqlplus'
- alias asmcmd='rlwrap asmcmd'
- alias alert_log='tail -200f $ORACLE_BASE/diag/asm/+asm/$ORACLE_SID/trace/alert_$ORACLE_SID.log'
- alias crsd_log='tail -200f $ORACLE_HOME/log/$HOSTNAME/crsd/crsd.log'
- 在linux和unix上有时不知道该使用LD_LIBRARY_PATH还是LIBPATH,经过搜索和实际使用,实际的情况如下
- OS Environment Variable Name
- Linux LD_LIBRARY_PATH
- Solaris 32-bit ruby LD_LIBRARY_PATH_32 or LD_LIBRARY_PATH
- Solaris 64-bit ruby LD_LIBRARY_PATH_64 or LD_LIBRARY_PATH
- HP-UX PA-RISC 32-bit ruby SHLIB_PATH
- HP-UX PA-RISC 64-bit ruby LD_LIBRARY_PATH
- HP-UX IA64 LD_LIBRARY_PATH
- Mac OS X DYLD_LIBRARY_PATH
- AIX LIBPATH
- -----------------------------------------------------------------------------------------------
- ------------------------------------listener.ora--------------------------------------------
- --动态监听: alter system set LOCAL_LISTENER='(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.59.157)(PORT = 1521))';
- -----------------------------------------------------------------------------------------------
- # listener.ora Network Configuration File: /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora
- # Generated by Oracle configuration tools.
- LISTENER =
- (DESCRIPTION_LIST =
- (DESCRIPTION =
- (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.59.129)(PORT = 1521))
- )
- )
- SID_LIST_LISTENER =
- (SID_LIST =
- (SID_DESC =
- (SID_NAME = PLSExtProc)
- (ORACLE_HOME = /u01/app/oracle/product/11.2.0/dbhome_1)
- (PROGRAM = extproc)
- )
- (SID_DESC =
- (GLOBAL_DBNAME = orcl.lhr.com)
- (SID_NAME = orcl)
- (ORACLE_HOME = /u01/app/oracle/product/11.2.0/dbhome_1)
- )
- (SID_DESC =
- (GLOBAL_DBNAME = rman.lhr.com)
- (SID_NAME = rman)
- (ORACLE_HOME = /u01/app/oracle/product/11.2.0/dbhome_1)
- )
- )
- LSNR2 =
- (DESCRIPTION_LIST =
- (DESCRIPTION =
- (ADDRESS_LIST =
- (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.59.129)(PORT = 1526))
- )
- )
- )
- SID_LIST_LSNR2 =
- (SID_LIST =
- (SID_DESC =
- (SID_NAME = PLSExtProc)
- (ORACLE_HOME = /u01/app/oracle/product/11.2.0/dbhome_1)
- (PROGRAM = extproc)
- )
- )
- ADR_BASE_LISTENER = /u01/app/oracle
- ------------windows 下
- SID_LIST_LISTENER =
- (SID_LIST =
- (SID_DESC =
- (SID_NAME = CLRExtProc)
- (ORACLE_HOME = D:\app\oracle\product\11.2.0.1)
- (PROGRAM = extproc)
- (ENVS = "EXTPROC_DLLS=ONLY:D:\app\oracle\product\11.2.0.1\bin\oraclr11.dll")
- )
- (SID_DESC =
- (GLOBAL_DBNAME = orcl.lhr.com)
- (SID_NAME = orcl)
- (ORACLE_HOME = D:\app\oracle\product\11.2.0.1)
- )
- )
- -----------------------/u01/app/oracle/product/11.2.0/dbhome_1/network/admin/tnsnames.ora
- # tnsnames.ora Network Configuration File: /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/tnsnames.ora
- # Generated by Oracle configuration tools.
- orcl =
- (DESCRIPTION =
- (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.59.133)(PORT = 1521))
- (CONNECT_DATA =
- (SERVER = DEDICATED)
- (SERVICE_NAME = orcl.lhr.com)
- )
- )
- #### 动态监听非默认端口
- LSNR_ORCL =
- (DESCRIPTION =
- (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.59.129)(PORT = 1526))
- (CONNECT_DATA =
- (SERVICE_NAME = orcl)
- )
- )
- -------------------------------------------------------------------- rac
- --- TAF BASIC方式
- racdb_vip =
- (DESCRIPTION =
- (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.132)(PORT = 1521))
- (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.131)(PORT = 1521))
- (LOAD_BALANCE = on)
- (CONNECT_DATA =
- (SERVER = DEDICATED)
- (SERVICE_NAME = jmrac)
- (FAILOVER_MODE =
- (TYPE = SELECT)
- (METHOD = BASIC)
- (RETRIES = 180)
- (DELAY = 5)
- )
- )
- )
- --- TAF preconnect方式
- racdb_vip1 =
- (DESCRIPTION =
- (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.131)(PORT = 1521))
- (CONNECT_DATA =
- (SERVER = DEDICATED)
- (SERVICE_NAME = jmrac)
- (FAILOVER_MODE =
- (TYPE = SELECT)
- (METHOD = BASIC)
- (BACKUP = preconnect)
- )
- )
- )
- racdb_vip2 =
- (DESCRIPTION =
- (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.132)(PORT = 1521))
- (CONNECT_DATA =
- (SERVER = DEDICATED)
- (SERVICE_NAME = jmrac)
- (FAILOVER_MODE =
- (TYPE = SELECT)
- (METHOD = BASIC)
- (BACKUP = preconnect)
- )
- )
- )