2015年5月21日 星期四

vmware 提供 vmx 方式

在 VMX 中加上
vhv.enable = "TRUE"

然後
vim-cmd vmsvc/getallvms |grep -i "KVM"
37     KVM           [iSCSI] KVM/KVM.vmx                            ubuntu64Guest      vmx-08    kvm / kvm
然後
vim-cmd vmsvc/reload 37

egrep 'vmx' /proc/cpuinfo

2015年4月21日 星期二

AIX 解壓磁帶

找一個夠大的空間

然後

tar xvf /dev/rmt0 .

會把全部都解出來

http://www-01.ibm.com/support/knowledgecenter/ssw_aix_71/com.ibm.aix.cmds5/tar.htm?lang=en

不太確定怎麼指定單檔或當資料夾解


--
解指定檔案

cd  /temp
tar -xf /dev/rmt0 ./mgt
這樣會等到整捲轉完

--
列表
tar -t /dev/rmt0

2015年4月15日 星期三

v7000 中的三種 FlashCopy 方式

In the Actions menu, you will see options for creating three types of mappings: Snapshot, Clone, and Backup. 

A Snapshot mapping creates an auto-expand, thin-provisioned target volume. A Snapshot mapping has a background copy rate of zero. This means that you will normally not get 100% completion, or a full copy of the source. Instead, the target volume contains only copy-on-write data. 

A Clone mapping creates a target volume with the same properties as the source volume, including thin-provision settings. Clone mappings are deleted automatically when the background copy process completes, and are used as a one time only copy. If you want to refresh the Clone target, you have to create a new mapping. 

A Backup mapping also creates a target volume with the same properties as the source volume, including thin-provision settings, and incremental FlashCopy is also enabled. A Backup mapping remains in the system when the background copy completes and can be restarted, which causes an efficient refresh of the target because it is done as incremental FlashCopy. 

All three types of mappings create a target volume that is located in the same managed-disk group as the source volume.



http://www-01.ibm.com/support/knowledgecenter/ST3FR7_7.3.0/com.ibm.storwize.v7000.730.learning/fc_script.html?cp=ST3FR7&lang=en

在原本頁面最底下選 non-flash version 

2015年1月30日 星期五

oracle 大量佔用 undo

java.sql.SQLException - ORA-01562: failed to extend rollback segment number 83

早上接到同事通知有這個錯誤記錄

發現 UNDO 用的量比以前多很多

用
set pagesize 400
set linesize 200
col name for a25
col program for a50
col username for a12
col osuser for a12
SELECT a.inst_id, a.sid, c.username, c.osuser, c.program, b.name,
a.value, d.used_urec, d.used_ublk
FROM gv$sesstat a, v$statname b, gv$session c, gv$transaction d
WHERE a.statistic# = b.statistic#
AND a.inst_id = c.inst_id
AND a.sid = c.sid
AND c.inst_id = d.inst_id
AND c.saddr = d.ses_addr
AND a.statistic# = 176
AND a.value > 0
ORDER BY a.value DESC

找出佔用的 SID  再從 session 裡找出來源 關閉程式.



---------
There are some views that show information related to undo activity:

* V$UNDOSTAT: histogram-like view that shows statistics for 10-minute intervals.
* V$TRANSACTION: present time view providing information on current transactions.
* V$SESSTAT: individual session statistics, which includes one for undo usage.

V$UNDOSTAT will provide a who did hint, recording the longest running query for that 10-interval, through the MAXQUERYID column which may be linked to V$SQL and use columns PARSING_USER_ID or PARSING_SCHEMA_NAME the get a grip on the suspect.

V$TRANSACTION linked with V$SESSION will show current used undo blocks for ongoing transactions. This query may help:
SELECT  a.sid, a.username, b.used_urec, b.used_ublk
FROM v$session a, v$transaction b
WHERE a.saddr = b.ses_addr
ORDER BY b.used_ublk DESC


V$SESSTAT provides another view, a who uses the undo kind of view, but we must avoid to get lost in the maze of Oracle statistics and focus on just one: Undo change vector size, which will accumulate the bytes of undo used during the session lifetime. Following query is designed to pinpoint who is having a high undo activity.
SELECT a.sid, b.name, a.value
FROM v$sesstat a, v$statname b
WHERE a.statistic# = b.statistic#
AND a.statistic# = 176    <-- Which stands for undo change vector size
ORDER BY a.value DESC 



Then the script for Oracle 11g is as follows:
set pagesize 400
set linesize 140
col name for a25
col program for a50
col username for a12
col osuser for a12
SELECT a.inst_id, a.sid, c.username, c.osuser, c.program, b.name,
a.value, d.used_urec, d.used_ublk
FROM gv$sesstat a, v$statname b, gv$session c, gv$transaction d
WHERE a.statistic# = b.statistic#
AND a.inst_id = c.inst_id
AND a.sid = c.sid
AND c.inst_id = d.inst_id
AND c.saddr = d.ses_addr
AND a.statistic# = 284
AND a.value > 0
ORDER BY a.value DESC

If you want to run this script on versions 10g1 and 10g2, just replace the statistic# with 176; 216 if your database is 11gR1... or use the following version independent script!!! (Hope we don't change the statistic name).

set pagesize 400
set linesize 140
col name for a25
col program for a50
col username for a12
col osuser for a12
SELECT a.inst_id, a.sid, c.username, c.osuser, c.program, b.name,
a.value, d.used_urec, d.used_ublk
FROM gv$sesstat a, v$statname b, gv$session c, gv$transaction d
WHERE a.statistic# = b.statistic#
AND a.inst_id = c.inst_id
AND a.sid = c.sid
AND c.inst_id = d.inst_id
AND c.saddr = d.ses_addr
AND b.name = 'undo change vector size'
AND a.value > 0
ORDER BY a.value DESC

---------
REF:
https://community.oracle.com/message/4281280

http://oracledisect.blogspot.tw/2008/05/who-is-using-your-undo-space.html

http://dba.stackexchange.com/questions/39466/oracle-undo-tablespace-users

http://oracledisect.blogspot.tw/2011/11/who-is-using-your-undo-space-improved.html

oracle 大量 recovery



https://srakwal.wordpress.com/2008/03/09/wait-for-stopper-event-to-be-increased/

https://magnusjohanssontuning.wordpress.com/2012/08/22/fast-parallel-transaction-recovery/

先下了一個大量的 DELETE 之後,過一段時間發現做不完 所以下了

alter session killed / disconnected

然後發現 session 處於 Marked for kill 狀態一直不動
再隔了一天發現 session 還在 所以透過 

 SELECT inst_id, status, event, state, blocking_session, sid, serial#, program FROM gv$session WHERE status = 'KILLED';
找到 spid 然後 kill -9

接下來冒出一堆 P000 - P129 的 process 

透過 

select qcsid "Query Coordinator", count(*) as "Slaves Count" from v$px_session group by qcsid; 

找出來開 parallel slave process 的頭是 SMON

然後 SMON 在 wait for stopper event to be increased / 等 undo / 等原本table所在的DBF

根據 http://www.eygle.com/archives/2008/05/oracle_smon_process.html

SMON 應該是在清 undo

然後找到

https://srakwal.wordpress.com/2008/03/09/wait-for-stopper-event-to-be-increased/

https://magnusjohanssontuning.wordpress.com/2012/08/22/fast-parallel-transaction-recovery/

If we have long running transactions (insert,delete,update) aborted by killing the session or aborting the instance,we must clean up the aborted transaction.
We can expect the clean up to take a long time. SMON is handling the roll back and will use parallel roll back when appropriate.
(when recovery work reaches a certain limit)
When the limit is reached smon will start parallel processes handling the roll back.Forsome transactions PQ slaves can start competing with each other about resources,
when that happens parallel transaction recovery can be slower then serial transaction recovery. At times the database appear to hang when doing parallel transaction recovery.
可以調 fast_start_parallel_rollback 
False Parallel rollback is disabled
Low (default) DOP can be maximum 2 * CPU_COUNT
High DOP can be maximum 4 * CPU_COUNT
Note Do not change the parameter dynamically on a system with many active transaction, it can cause severe problems.
Rollback strategy for active transactions may change. Do this change with a restart of the database.

可以從 v$fast_start_transactions. 看現在進行的事 但不曉得要做多少

重點是不可以砍掉 SMON 跟 PXXX . 

因為
1. SMON 是重要的 background process . 砍掉它可能會把 instance 拉下來
2. UNDO 裡面 還是有記錄 . 就算 shutdown abort . 開機做 recovery 的時候還是會再出現.

最後等了六個多小時讓它做完.



REF
https://docs.oracle.com/cd/E18283_01/server.112/e16541/parallel006.htm

http://www.oracle.com/technetwork/articles/database-performance/geist-parallel-execution-1-1872400.html

https://docs.oracle.com/cd/E18283_01/server.112/e16541/parallel005.htm

http://os2ora.com/monitor-parallel-execution/

http://www.remote-dba.net/t_op_sql_use_of_parallel.htm

http://www.dbaqhs.com/archives/category/oracle