2014年4月28日 星期一

IBM Tivoli Directory Server , LDAP

db2diag -A 把舊的 db2diag 變成另一個檔案  (as ldapdb2)

db2 snapshot for db


----------------------
定期要監看的部分
---------------------
db2 connect to ldapdb2  (as ldapdb2)

db2 GET SNAPSHOT for ALL ON LDAPDB2 >> file

/home/ldapdb2/ldapdb2/NODE0000/SQL00001/db2event/db2detaildeadlock
db2evmon -path . > DIAG.LOG

/home/ldapdb2/sqllib/db2dump
 ldapdb2.nfy
db2diag.log

ibmslapd.log

-----------------------
遇到問題時的收集資訊程序
-----------------------
db2 connect to ldapdb2  
db2 GET SNAPSHOT for ALL ON LDAPDB2 >> file
db2diag -A


db2stop force   強制停止 DB2


-----------------------------------
DB2 的鎖
-----------------------------------
db2 get db cfg for ldapdb2 | grep -i 'lock'

Lock timeout (sec)                        (LOCKTIMEOUT) = 300


----------------------
問題處理  
----------------------
2014-04-28-07.34.59.194198+480 I283690137A336     LEVEL: Warning
PID     : 295014               TID  : 1           PROC : db2event (DB2DETAILDEADLOCK) 0
INSTANCE: ldapdb2              NODE : 000
FUNCTION: DB2 UDB, database monitor, sqm___sqlmeiot, probe:7
MESSAGE : target type 0 failed to open DB2DETAILDEADLOCK    with rc -2146631637

ADM2001W  The Event Monitor "DB2DETAILDEADLOCK" was deactivated because the 
MAXFILES and MAXFILESIZE CREATE EVENT MONITOR parameters' limits have been 
reached.
------------------------
處理 : as ldapdb2
db2 connect to ldapdb2
db2 set event monitor db2detaildeadlock state 0
cd /home/ldapdb2/ldapdb2/NODE0000/SQL00001/db2event/db2detaildeadlock
mv * ../  (或移去其他地方)
db2 set event monitor db2detaildeadlock state 1

---------------------------
其他
--------------------------

 sysdumpdev -e  試算建議值 

這個值會隨著記憶體使用的現況而變-> 記憶體吃越大這個值就會越大

會先寫到 dumplv 再copy到file system 所以兩邊都要有足夠空間
lg_dumplv           sysdump    12    12    1    open/syncd    N/A


ibmldap-online:/> sysdumpdev -l
primary              /dev/lg_dumplv
secondary            /dev/sysdumpnull
copy directory       /var/adm/ras     <-------
forced copy flag     TRUE
always allow dump    FALSE
dump compression     ON
ibmldap-online:/> 


----------------------------------
vmstat 2

2014年1月21日 星期二

AIX 安裝 SSH

參考 http://blogsendak.pixnet.net/blog/post/91171536-install-ssh-in-aix-5.3

到 這裡 https://www14.software.ibm.com/webapp/iwm/web/reg/pick.do?source=aixbp 下載

要下載 openSSH 跟 openSSL

下載的時候要注意 版本的搭配問題. (openSSH 與 openSSL 的版本搭配 還有各自對 AIX 版本的搭配) 

下載的檔案會是 tar.Z 檔 

用 uncompress 解開變成 .tar 檔

再各自建一個資料夾把 tar 檔丟進去 用 tar xvf 解

查看目前版本用 lslpp -l | grep ssl

先裝 OPENSSL 再裝 OPENSSH


smit install_latest
ACCEPT new license agreements "yes" 

安裝完看看服務在不在
lssrc -a | grep ssh
startsrc -s sshd 
stopsrc -s sshd

2013年12月24日 星期二

oracle latch: cache buffers chains


特徵 :
CPU 吃很高 . 但沒有特別長的長運算。

AWR/ADDM 可以看到  latch: cache buffers chains 的值異常高 . ASH  裡可能也會顯示

https://sites.google.com/site/embtdbo/wait-event-documentation/oracle-latch-cache-buffers-chains


http://www.toadworld.com/platforms/oracle/w/wiki/1302.how-to-identify-a-buffer-cache-chain-latch-problem.aspx

http://alexzeng.wordpress.com/2013/03/02/expert-oracle-practices-troubleshooting-latch-contention/

http://docs.oracle.com/cd/B19306_01/server.102/b14237/waitevents003.htm#BGGIBDJI

透過 V_$SESSION , V_$SESSION_WAIT  可以看到 session id 與 SQLID.
如果等的是 FILE IO , 可能可以透過 FILENO 找出是哪塊在讀

SELECT b.username, a.sid, b.sql_id,a.event, a.seq#,
       a.seconds_in_wait, a.wait_time, a.p1 , a.p2, a.p3,
       a.state, a.p1text,a.p1raw, a.p2text,a.p2raw, a.p3text,a.p3raw
   FROM sys.V_$SESSION_WAIT a, sys.V_$SESSION b
WHERE a.SID = b.SID
  AND NOT(a.event like 'SQL%')
  AND NOT(a.event like '%message%')
  AND NOT(a.event like '%timer%')
  AND NOT(a.event like '%pipe get%')
  AND NOT(a.event like '%jobq slave wait%')
  AND NOT(a.event like '%null event%')
  AND NOT(a.event like '%wakeup time%')
  ORDER BY a.wait_time desc, a.event

2013年11月19日 星期二

oracle em console 無法開啟


http://hi.baidu.com/jiubobo_net/item/021a87026627d63ae9fe3892

今天一台AIX 64上的10.2.0.4的dbconsole启动不了了。
对于这种dbconsole不能启动的问题,549079.1中有很详细的描述。

如下是我今天解决上述问题的全过程:

我首先执行了emctl start dbconsole,屏幕中报错:
ps: 0509-048 Flag -o was used with invalid list. ps: Not a recognized flag: - Usage: ps [-ANPaedfklmMZ] [-n namelist] [-F Format] [-o specifier[=header],...] [-p proclist][-G|-g grouplist] [-t termlist] [-U|-u userlist] [-c classlist] [ -T pid] [ -L pidlist] Usage: ps [aceglnsuvwxU] [t tty] [processnumber]

这个在758568.1有相应的解决方法:
将$ORACLE_HOME/bin/emctl.pl中的第1314行和第1605行的
my $ps=`ps -p $PID -o cmd --cols 1000 |grep DEMDROOT`;
修改为
my $ps=`ps -p $PID -o args | grep DEMDROOT`;

修改完后保存并重启dbconsole,但这时候dbconsole依然起不来,同时emdb.nohup中记录的错误信息为:
09/07/20 11:30:06 Error starting ORMI-Server.  Unable to bind socket: The socket name is already in use.

这个时候尝试停止dbconsole,会报如下错误:
$ emctl stop dbconsole
Oracle Enterprise Manager 10g Database Control Release 10.2.0.4.0 
Copyright (c) 1996, 2007 Oracle Corporation.  All rights reserved.
https://p690ca:1158/em/console/aboutApplication
Stopping Oracle Enterprise Manager 10g Database Control ...
--- Failed to shutdown DBConsole Gracefully ---
 failed.
这种错误很容易解决,在OS上把带关键字\"oc4j\"和\"dbconsole\"的进程都杀掉,然后重新依次执行emctl stop agent,emctl stop dbconsole就可以了。

按上述做法做完后dbconsole还是起不来,同时emagent.trc中记录的错误信息为:
2009-07-20 13:28:27 Thread-1839 ERROR ssl: nzos_Handshake failed, ret=29024
2009-07-20 13:28:27 Thread-1839 ERROR http: 9: Unable to initialize ssl connection with server, aborting connection attempt
2009-07-20 13:28:27 Thread-1839 ERROR pingManager: nmepm_pingReposURL: Cannot connect to https://p690ca:1158/em/upload/: retStatus=-1

这个在749243.1中有相应的解决方法:
首先执行下述命令:
$ emctl unsecure dbconsole
Oracle Enterprise Manager 10g Database Control Release 10.2.0.4.0 
Copyright (c) 1996, 2007 Oracle Corporation.  All rights reserved.
http://p690ca:1158/em/console/aboutApplication
Configuring DBConsole for HTTP...   Done.
DBConsole is already unsecured.

然后执行:
$ emctl secure dbconsole
Oracle Enterprise Manager 10g Database Control Release 10.2.0.4.0 
Copyright (c) 1996, 2007 Oracle Corporation.  All rights reserved.
http://p690ca:1158/em/console/aboutApplication
Enter Enterprise Manager Root password :
Enter a Hostname for this OMS : p690ca

DBCONSOLE already stopped...   Done.
Agent successfully stopped...   Done.
Securing dbconsole...   Started.
Checking Repository...   Invalid Password.
这里oracle提示让我输入Enterprise Manager Root用户的密码,其实就是让我输入sysman的密码,我记得这个库的sysman的密码就是oracle,但当我输入oracle后这里提示我密码不对。

这种问题的解决方法很简单,只需要去改如下两个地方就可以了:
1、以sys用户登陆后把sysman用户的密码改为oracle
2、执行emctl setpasswd dbconsole将sysman用户的密码oracle登记到emoms.properties中去,如下所示:
$ emctl setpasswd dbconsole
Oracle Enterprise Manager 10g Database Control Release 10.2.0.4.0 
Copyright (c) 1996, 2007 Oracle Corporation.  All rights reserved.
http://p690ca:1158/em/console/aboutApplication
Please enter new repository password:
Repository password successfully updated.

执行完上述两步后,现在可以执行emctl secure dbconsole了:
$ emctl secure dbconsole
Oracle Enterprise Manager 10g Database Control Release 10.2.0.4.0 
Copyright (c) 1996, 2007 Oracle Corporation.  All rights reserved.
http://p690ca:1158/em/console/aboutApplication
Enter Enterprise Manager Root password :
Enter a Hostname for this OMS : p690ca

DBCONSOLE already stopped...   Done.
Agent is already stopped...   Done.
Securing dbconsole...   Started.
Checking Repository...   Done.
Checking Em Key...   Done.
Checking Repository for an existing Enterprise Manager Root Key...   Done.
Fetching Root Certificate from the Repository...   Done.
Updating HTTPS port in emoms.properties file...   Done.
Generating Java Keystore...   Done.
Securing OMS ...   Done.
Generating Oracle Wallet Password for Agent....   Done.
Generating wallet for Agent ...    Done.
Copying the wallet for agent use...    Done.
Storing agent key in repository...   Done.
Storing agent key for agent ...   Done.
Configuring Agent...
Configuring Agent for HTTPS in DBCONSOLE mode...   Done.
EMD_URL set in /u01/app/oracle/product/10.2.0/p690ca_ipratest/sysman/config/emd.properties
   Done.
Configuring Key store..   Done.
Securing dbconsole...   Sucessful.

执行完上述步骤后,dbconsole现在终于可以起来了:
$ emctl start dbconsole
Oracle Enterprise Manager 10g Database Control Release 10.2.0.4.0 
Copyright (c) 1996, 2007 Oracle Corporation.  All rights reserved.
https://p690ca:1158/em/console/aboutApplication
Starting Oracle Enterprise Manager 10g Database Control .............. started.
------------------------------------------------------------------
Logs are generated in directory /u01/app/oracle/product/10.2.0/p690ca_ipratest/sysman/log

2013年10月2日 星期三

Oracle 疑難雜症

-----------------------------------------------------------------------------------
LRM-00109:could not open parameter file 

SQL> connect sys/mzl as sysdba
已连接。
SQL> startup
ora-01078failure in processing system parameters
LRM-00109:could not open parameter file ’/opt/oracle/app/oracle/product/10.1.0/Db_1/dbs/initoracle.ora’

这是因为在oracle9i和oracle10g中,数据库默认将使用spfile启动数据库,如果spfile不存在,则就会出现上述错误。
解决方法:
将$ORACLE_BASE/admin/数据库名称/pfile目录下的init.ora.012009233838形式的文件copy到$ORACLE_HOME/dbs目录下initoracle.ora即可。(注:initoracle.ora中的oracle为你的实例名 ORACLE_SID)
SQL> startup
ORACLE instance started.
-----------------------------------------------------------------------------------