顯示具有 11g 標籤的文章。 顯示所有文章
顯示具有 11g 標籤的文章。 顯示所有文章

星期五, 12月 04, 2015

關於Oracle 11g RAC , 使用normal redundancy Voting disk 的理解

關於Oracle 11g RAC , 使用normal redundancy Voting disk 的理解

    1.   如果有三個voting disk , offline disk的數量大於online 數量, 節點會自動被重啟。


2.放在NFSvoting disk並不會存放任何資料,只是拿來當仲裁使用

     3.11g ASM DiskGroup在設定成normal redunancy的時候,votingdisk1, votingdisk2可以是SAN的環境、votingdisk3可以在NAS上透過linux  DD指令的方式建出此檔案,再利用asmca的GUI, 把NFS上的voting file加進去到disk group

星期四, 11月 19, 2015

[轉寄]11g RAC回復OCR/ Voting的方法

P.S. 如果是12c RAC, 除了修回OCR/ Voting以外, 要再修一個MGMTDB,
詳細修復步驟如下:

http://jaychu649.blogspot.tw/2015/12/12c-rac-mgmtdb.html


參考連結:

Ref: http://oracledbabhuvan.blogspot.tw/2011/11/restoring-ocr-disk-voting-disk-on-asm.html

RECOVERING OCR DISK & VOTING DISK ON ASM DISK GROUP FROM CORRUPTION OR LOSS

When we have lost or having a corruption issue on the OCR & VOTING Disk, we have follow the below procedure to bring it back.

When using an ASM disk group for CRS there are typically 3 different types of files located in the disk group that potentially need to be restored/recreated for function of the cluster.
    Oracle Cluster Registry file (OCR)
    Voting files
    Shared SPFILE for the ASM instances
In this scenario, we are trying to restore the corrupted OCR Disk & Voting Disk from the backup.


Step #1 Stop cluster on each node(Root user).

# crsctl stop crs -f

Step #2 we are starting the cluster in the excusive mode(Root user)

As root start GI in exclusive mode on one node only:
In 11201 RAC, we have to use below option to start the cluster in the exclusive mode.
# crsctl start crs -excl

In 11202 RAC, we have to use below option to start the cluster in the exclusive mode.
# crsctl start crs -excl -nocrs   =>這邊講的是, 如果OCRvoting掛了, 可以透過此方式強制把clusterware開至單機模式(先不啟動CRS  daemon)

crsctl start crs -h
Usage:
 crsctl start crs[-excl [-nocrs]|-nowait]
    Start OHAS onthis server
where
    -excl     Start Oracle Clusterware in exclusivemode
    -nocrs      Start Oracle Clusterware in exclusivemode without starting CRS

     -nowait    Do not wait for OHAS to start

Note: A new option '-nocrs' has been introduced with  11.2.0.2, which prevents the start of the ora.crsd resource. It is vital that this option is specified; otherwise the failure to start the ora.crsd resource will tear down ora.cluster_interconnect.haip, which in turn will cause ASM to crash.


If you don't have the OCR DISK GROUP, then create it else move to restoring OCR DISK


Step #3 OCR RESTORE

To Know the OCR Location on the cluster environment
$ cat /etc/oracle/ocr.loc  -- In Linux

To Check whether ocrcheck is corrupted or not

# ocrcheck

Check whether ocrcheck is able to complete it successfully

OCR CHECK Ex
# ocrcheck
Status of Oracle Cluster Registry is as follows :
         Version                  :          3
         Total space (kbytes)     :     262120
         Used space (kbytes)      :       4404
         Available space (kbytes) :     257716
         ID                       : 1306201859
         Device/File Name         :  +OCR_VOTE
                                    Device/File integrity check succeeded
                                    Device/File not configured
                                    Device/File not configured
                                    Device/File not configured
                                    Device/File not configured
         Cluster registry integrity check succeeded

         Logical corruption check succeeded
       

Note:
1) Check whether cluster registry integrity check is successful.
         
2) When you run as oracle user, logical corruption check will be bypassed. You can see this line end of the "ocrcheck" output.
"Logical corruption check bypassed due to non-privileged user"


To Know the OCR Location on the cluster environment
$ cat /etc/oracle/ocr.loc  -- In Linux
If the OCR DISK corrupted, then perform the below steps

Locate OCR LOG file location
$GRID_HOME /log/<hostname>/client/ocrcheck_<pid>.log
Locate the latest automatic OCR backup
$GRID_HOME\bin\ocrconfig –showbackup

Restore the latest OCR backup(root user)
# ocrconfig -restore $GRID_HOME/cdata/racsapie1/backup00.ocr  => 必須是OCR/ Voring 所屬的ASM DiskGroup被重新建出來並已經被掛載的狀況下. 指定才會成功

racsapie1 SCAN NAME for the cluster

Step #4 VOTING DISK RECREATE
          
Recreate the Voting file (root user)
The Voting file needs to be initialized in the CRS disk group
# crsctl replace votedisk +OCR_DISK   => 必須是OCR/ Voring 所屬的ASM DiskGroup被重新建出來並已經被掛載的狀況下. 指定才會成功

Note:
1) Above command will Re-create/move your voting disk in the specified ASM Disk Group, if you query the voting disk it will display your voting disk location in the DISK Group which has been specified above.
2)  Voting File is that it is no longer supported to take a manual backup of it with dd.  Instead, the Voting File gets backed up automatically into the OCR.

Query Voting Disk location

# $GRID_HOME/bin/crsctl query css votedisk

Note: You cannot create more than 1 voting disk in the same or on another/different Disk group disk when using External Redundancy in 11.2. The rules are as follows:
External = 1 voting disk
Normal= 3 voting disk
High= 5 voting disk

Step #5 Stop & start the cluster

Shutdown CRS : CRS is running in exclusive mode, it needs to be shutdown (Root User).

# crsctl stop crs -f

Start CRS : Start the CRS in one node, if everything is ok then start the CRS in other nodes (root user).

# crsctl start crs

CRS Status : Once it is start, you can check the status of the CRS(Root / Oracle user)

# crsctl stat res -t -init      : if you are checking for one node
# crsctl check cluster -all  : if you are checking for entire cluster.



Important Tips

Oracle Clusterware 11g Release 2 backs up the OCR automatically every four hours on a schedule that is dependent on when the node started
    4-hour backups (3 max) –backup00.ocr, backup01.ocr, and backup02.ocr.
    Daily backups (2 max) – day.ocr and day_.ocr
    Weekly backups (2 max) – week.ocr and week_.ocr
You can use the ocrconfig command to view the current OCR backups as seen in this

Ocrconfig -showbackup auto
Note: automatic backups will not occur, when the cluster is down
Verifying OCR integrity of all of the cluster nodes by running the following CVU command:

$ cluvfy comp ocr -n all -verbose

星期四, 9月 19, 2013

[11g RAC] Rellocate scan listener still failed : TNS-12541

Ref:
http://heliosguneserol.wordpress.com/2012/10/19/how-to-relocate-scan_listener-from-one-node-to-another-node-on-rac-system/

透過host-vip,1521 port可以連至DB,
但透過scan-ip, 1521 port就連接失敗, 感覺跟上面連結的文章描述有點像, 於是想到有幾個方法
1.stop listener, start listener
==>無效
2.stop listener, stop scan vip, start scan vip, start listener
==>無效
3.relocate three scan listener (考量有可能scan ip 從node1 transfer到node2, 但listener 於各nodes運作正常)
  As grid:
  srvctl relocate scan -i 1
  srvctl relocate scan -i 2
  srvctl relocate scan -i 3

大概觀察了一分鐘, 再用rac-scan 去連接, 結果還是不行

最後才發現, 是scan listener log 達到4gb 大小, 真是傻眼...

看來越簡單的細節, 我們越容易忽略...Sigh.....

==============================================

[grid@rac2 ~]$ps -ef|grep tnsl
oracle    5830     1  0 12:38 ?        00:00:00 /u01/app//grid/grid112/bin/tnslsnr LISTENER_SCAN3 -inherit
oracle    5833     1  0 12:38 ?        00:00:00 /u01/app//grid/grid112/bin/tnslsnr LISTENER_SCAN2 -inherit
oracle    5836     1  0 12:38 ?        00:00:00 /u01/app//grid/grid112/bin/tnslsnr LISTENER -inherit
oracle    7423  7372  0 15:14 pts/1    00:00:00 grep tnsl
[grid@rac2 ~]$

[grid@rac2 ~]$lsnrctl status LISTENER_SCAN2

LSNRCTL for Linux: Version 11.2.0.2.0 - Production on 15-DEC-2011 15:14:04

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

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER_SCAN2)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER_SCAN2
Version                   TNSLSNR for Linux: Version 11.2.0.3.0 - Production
Start Date                15-DEC-2011 12:38:45
Uptime                    0 days 2 hr. 35 min. 19 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /u01/app/grid/grid112/network/admin/listener.ora
Listener Log File         /u01/app/grid/grid112/log/diag/tnslsnr/rac2/listener_scan2/alert/log.xml


ls -lh /u01/app//grid/grid112/log/diag/tnslsnr/rac2/listener_scan2/trace/*.log   ==> 4GB

=============================================

星期一, 9月 02, 2013

SSD/Flashcard 研究心得

看了以下這篇,
一般文件探討理論的部分, 都提到expectancy 讀取快, 但寫入速度不如一般H.D.
但以下數據, 就連SSD寫入數據都比H.D.來的快很多

所以排除效能問題之外, 通常會考慮到SSD的壽命,
不管是SLC eMLC來說, SSD寫入機制都是erase—before—write, 所以如果redo logs 放在SSD上面, 會降低SSD的壽命,
以下這篇文章有提到, 後來有個技術叫做 wear-leveling, 自動將block的記憶單元搬家, 平均了所有記憶單元的使用次數, 並且驗證失敗的區塊就加以剔除, 缺點就是...空間會越來越小...
wear-leveling的機制增加了SSD壽命~
http://www.fruittea.net/~hanky/blog/archives/76-SLC-MLC.html

如果客戶真的不放心, 就只能用作Oracle DataGuard Standby DB, 僅讓AP 對做讀取或撈取報表用途,
或放在local site, 設定 ASM diskgroupASM_PREFERRED_READ_FAILURE_GROUPS , 提升讀取速度

可參考下篇Oracle 11g RAC + fusion io card的應用

星期六, 7月 20, 2013

Oracle 11g RAC + fusion io card的應用

Oracle 11g RAC + fusion io card的應用
可先建立oracle disk group , normal redunancy
在normal redunancy的定義下~ A loss of one ASM disk is tolerated
如下:

CREATE DISKGROUP disk_group_1 NORMAL REDUNDANCY
  FAILGROUP DATA_0001 DISK
    '/devices/diska1' NAME diska1,  --suppose diska1 is lun of fusion io
    '/devices/diska2' NAME diska2
  FAILGROUP DATA_0002 DISK
    '/devices/diskb1' NAME diskb1,  --suppose diskb1 is lun of fusion io
    '/devices/diskb2' NAME diskb2;

也就是說 最多容許一個failgroup offline的狀況...例如diska1 或diska2 或 diska1 + diska2可允許他不見, 服務還是正常進行~

相關的測試可以參照這裡

之後設定參數 : ASM_PREFERRED_READ_FAILURE_GROUPS 讓Oracle ASM group 預設先讀取fusion io card 的disk group...

Preferred Read Failure Groups


SELECT name, failgroup FROM v$asm_disk; NAME FAILGROUP ------------------------------ ------------------------------
diska1 DATA_0001
diska2 DATA_0001 diskb1 DATA_0002
diskb2 DATA_0002 4 rows selected. SQL> ALTER SYSTEM SET ASM_PREFERRED_READ_FAILURE_GROUPS = 'disk_group_1.diska1', 'disk_group_2.diskb1';


在使用Swingbench 壓測工具 對資料庫做壓測後~ 

速度在90% 的read 底下 , 快了1.2倍 (等於是原本的2.2倍)
速度在65% 的read 底下 , 快了1.12倍 (等於是原本的2.12倍)

相當的厲害了....

以上架構屬於手動設定優先讓ASM 的讀取在fusion io card上面, 事實上很多storage也都有auto-tiering的功能, 但反應時間可能會稍慢一點, 要等到hot block都被讀取到fusion io card上面之後, 才能反映出disk I/O速度.

星期一, 6月 17, 2013

如何檢查Oracle資料庫PSU版本 (Patch set update)

指令如下...以下範例為已經升版到11.2.0.2.9 database PSU
SQL>
select substr(action_time,1,30) action_time,
substr(id,1,10) id,
substr(action,1,10) action,
substr(version,1,8) version,
substr(BUNDLE_SERIES,1,6) bundle,
substr(comments,1,20) comments  from registry$history;

以上僅限於正常升版完成的資料庫
安裝完patch...若沒有下cpu_bundlexxx.sql 的話 是不會看到此版本資訊的....

星期二, 5月 07, 2013

Oracle 各帳號用途清查 for 9i/10g/11g


以下為Oracle原廠文件所提到的帳號清單, locked 代表一般安裝好的資料庫中,是停用的。

account
Usage
Account Status
ANONYMOUS
Oracle XML DB
Expired and locked
CTXSYS
Oracle Text
Expired and locked
DBSNMP
Oracle Enterprise Manager
Open
EXFSYS
Rules Manager and Expression Filter
Expired and locked
LBACSYS
Oracle Label Security
Expired and locked
MDSYS
Oracle Spatial and Oracle Multimedia Locator administrator account
Expired and locked
MGMT_VIEW
Oracle Enterprise Manager 
Open
OLAPSYS
OLAP Catalog 
Expired and locked
ORDDATA
Oracle Multimedia DICOM data model
Expired and locked
OWBSYS
Oracle Warehouse Builder repository
Expired and locked
ORDPLUGINS
Oracle Multimedia
Expired and locked
ORDSYS
Oracle Multimedia administrator
Expired and locked
OUTLN
Plan stability account
Expired and locked
SI_INFORMTN_SCHEMA
Views for the SQL/MM Still Image Standard
Expired and locked
SYSMAN
Oracle Enterprise Manager
Open
TSMSYS
transparent session migration (TSM)
Expired and locked
WK_TEST
Oracle Ultra Search
Expired and locked
WKSYS
Ultra Search database super-user
Expired and locked
WKPROXY
Oracle9i Application Server Ultra Search
Expired and locked
WMSYS
Oracle XML DB data and metadata
Expired and locked
BI
Default Sample Schema
Expired and locked
HR
Default Sample Schema
Expired and locked
OE
Default Sample Schema
Expired and locked
PM
Default Sample Schema
Expired and locked
IX
Default Sample Schema
Expired and locked
SH
Default Sample Schema
Expired and locked
SYSTEM
資料庫管理帳號SYSPOER
Open
SYS
資料庫管理帳號SYSDBA
Open


查詢Oracle帳號方法如下:
As Oracle User
sqlplus "/ as sysdba"

SQL>

col username for a25
col account_status for a8
col default_tablespace for a10
select username , account_status , created , default_tablespace from dba_users where account_status not like '%LOCKED%' order by username;


USERNAME                  ACCOUNT_ CREATED            DEFAULT_TA
------------------------- -------- ------------------ ----------
DBSNMP                    OPEN     04-FEB-10          SYSAUX  => 資料庫Oracle OEM (內部使用)
HR                        OPEN     22-APR-11          USERS
RPT                       OPEN     25-JUL-12          USERS
SYS                       OPEN     04-FEB-10          SYSTEM    => 資料庫管理帳號 SYSDBA
SYSMAN                    OPEN     04-FEB-10          SYSAUX   => 資料庫管理帳號 SYSOPER
SYSTEM                    OPEN     04-FEB-10          SYSTEM
TEST                      OPEN     20-JUL-11          USERS

7 rows selected.

排除預設帳號, 黃字部分為有使用的三個Oracle帳號:

HR, RPT, TEST

若確定TEST帳號沒在使用, 可以將其LOCKED
SQL>  
alter user test account lock;

User altered.

查詢TEST帳號, 可以發現TEST帳號已經停止使用(LOCKED)
col username for a25
col account_status for a8
col default_tablespace for a10
select username , account_status , created , default_tablespace from dba_users where username='TEST';


LinkWithin-相關文件

Related Posts Plugin for WordPress, Blogger...