Oracle笔记(3)——Net Listener进程

Oracle Net Listener是一个独立的进程,负责处理client的请求,并把这些请求分发给相应的database instance。配置文件是listener.ora,位于$ORACLE_HOME/network/admin目录下。修改这个文件必须重启listener进程。

listener.ora如下所示:

# listener.ora Network Configuration File: /u01/app/oracle/product/12.1.0/dbhome_1/network/admin/lis
tener.ora
# Generated by Oracle configuration tools.
SID_LIST_LISTENER =
 (SID_LIST =
  (SID_DESC =
   (GLOBAL_DBNAME = db01)
   (ORACLE_HOME = /u01/app/oracle/product/11.1.0/db_1)
   (SID_NAME = db01)
  )
  (SID_DESC =
   (GLOBAL_DBNAME = dev12c)
   (ORACLE_HOME = /u01/app/oracle/product/12.1.0/dbhome_1)
   (SID_NAME = dev12c)
  )
 )
LISTENER =
 (DESCRIPTION_LIST =
  (DESCRIPTION =
   (ADDRESS = (PROTOCOL = TCP)(HOST = orasvr01)(PORT = 1521))
  )
  (DESCRIPTION =
   (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
  )
 )

SID_LIST_LISTENER部分指定listener进程需要处理的数据库连接;而LISTENER部分指定这些数据库所在的主机,以及listener进程需要监听的端口。

在数据库能够服务客户端请求之前,必须要启动listener进程。使用lsnrctl命令可以启动和停止listener进程:

$ lsnrctl start
$ lsnrctl stop

lsnrctl status命令可以用来检查listener的状态。

$ lsnrctl status

LSNRCTL for Linux: Version 12.1.0.2.0 - Production on 16-FEB-2016 04:55:25

Copyright (c) 1991, 2014, Oracle.  All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=npar1.atc-hp.com)(PORT=9012)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 12.1.0.2.0 - Production
Start Date                04-FEB-2016 01:01:06
Uptime                    12 days 3 hr. 54 min. 18 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /app/oracle/product/12.1.0/dbhome_1/network/admin/listener.ora
Listener Log File         /app/oracle/diag/tnslsnr/npar1/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=npar1.atc-hp.com)(PORT=9012)))
Services Summary...
Service "ORCL2" has 1 instance(s).
  Instance "ORCL2", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully

参考资料:
Configuring and Administering Oracle Net Listener
How to Configure the Database Listener with Listener.ora in Oracle 12c

 

Oracle笔记(2)——Oracle相关的环境变量

安装和使用Oracle时相关的环境变量:

(1)ORACLE_BASE
安装Oracle时的根目录,默认值为/u01/app/oracle

(2)ORACLE_HOME
安装特定版本Oracle时的目录,例如$ORACLE_BASE/product/11.2.0/dbhome_1

(3)ORACLE_SID
标明数据库的System Identifier(SID)SID用来代表某个数据库实例(instance),用来同其它instance相区分。

参考资料:
Administering Oracle Database
http://www.orafaq.com/wiki/ORACLE_SID
Oracle Database – Environment Variables / Registry Values

 

Sysdig笔记(3)——chisel

Sysdig中的chisel是用Lua语言编写的脚本,用来分析和处理sysdig产生的eventSysidg会在下列目录中查找chisel., ./chisels, ~/chisels和/usr/share/sysdig/chisels

列出sysdig所有的chisel

# sysdig -cl

Category: Application
---------------------
httplog         HTTP requests log
httptop         Top HTTP requests
memcachelog     memcached requests log

Category: CPU Usage
-------------------
spectrogram     Visualize OS latency in real time.
......

如果想查看关于某个chisel的详细信息,可以使用-i选项:

# sysdig -itopfiles_bytes

Category: I/O
-------------
topfiles_bytes  Top files by R+W bytes

Shows the top files in terms of disk usage. This chisel is compatable with cont
ainers using the sysdig -pc or -pcontainer argument, otherwise no container inf
ormation will be shown.
Args:
(None)

执行chisel使用-c选项:

# sysdig -c topfiles_bytes
Bytes               Filename
--------------------------------------------------------------------------------
Bytes               Filename
--------------------------------------------------------------------------------
144B                /dev/ptmx
Bytes               Filename
--------------------------------------------------------------------------------
165B                /dev/ptmx

也可以为chisel指定参数:

# sysdig -c topfiles_bytes "not fd.name contains /dev"
Bytes               Filename
--------------------------------------------------------------------------------
Bytes               Filename
--------------------------------------------------------------------------------
Bytes               Filename
--------------------------------------------------------------------------------
7.47KB              /proc/cpuinfo
1024B               /proc/meminfo

参考资料:

Sysdig Quick Reference Guide

Chisels User Guide