真实的国产乱ⅩXXX66竹夫人,五月香六月婷婷激情综合,亚洲日本VA一区二区三区,亚洲精品一区二区三区麻豆

成都創(chuàng)新互聯(lián)網(wǎng)站制作重慶分公司

Oracle11gRAC維護(hù)及管理的常用操作都有哪些

本篇文章給大家分享的是有關(guān)Oracle11g RAC維護(hù)及管理的常用操作都有哪些,小編覺(jué)得挺實(shí)用的,因此分享給大家學(xué)習(xí),希望大家閱讀完這篇文章后可以有所收獲,話不多說(shuō),跟著小編一起來(lái)看看吧。

目前成都創(chuàng)新互聯(lián)公司已為近1000家的企業(yè)提供了網(wǎng)站建設(shè)、域名、虛擬主機(jī)、網(wǎng)站改版維護(hù)、企業(yè)網(wǎng)站設(shè)計(jì)、簡(jiǎn)陽(yáng)網(wǎng)站維護(hù)等服務(wù),公司將堅(jiān)持客戶導(dǎo)向、應(yīng)用為本的策略,正道將秉承"和諧、參與、激情"的文化,與客戶和合作伙伴齊心協(xié)力一起成長(zhǎng),共同發(fā)展。


1. 查看各資源狀態(tài)(nodeapps節(jié)點(diǎn)應(yīng)用程序,ASM實(shí)例,數(shù)據(jù)庫(kù)實(shí)例等):

[root@rac01 u01]# su - grid 
[grid@rac01 ~]$ crs_stat -t   (命令兼容10g)
Name           Type           Target    State     Host       
------------------------------------------------------------
ora....ER.lsnr ora....er.type ONLINE    ONLINE    rac01      
ora....N1.lsnr ora....er.type ONLINE    ONLINE    rac01      
ora....VOTE.dg ora....up.type ONLINE    ONLINE    rac01      
ora.ORADATA.dg ora....up.type ONLINE    ONLINE    rac01      
ora....LASH.dg ora....up.type ONLINE    ONLINE    rac01      
ora.asm        ora.asm.type   ONLINE    ONLINE    rac01      
ora.eons       ora.eons.type  ONLINE    ONLINE    rac01      
ora.gsd        ora.gsd.type   OFFLINE   OFFLINE              
ora....network ora....rk.type ONLINE    ONLINE    rac01      
ora.oc4j       ora.oc4j.type  OFFLINE   OFFLINE              
ora.ons        ora.ons.type   ONLINE    ONLINE    rac01      
ora....SM1.asm application    ONLINE    ONLINE    rac01      
ora....01.lsnr application    ONLINE    ONLINE    rac01      
ora.rac01.gsd  application    OFFLINE   OFFLINE              
ora.rac01.ons  application    ONLINE    ONLINE    rac01      
ora.rac01.vip  ora....t1.type ONLINE    ONLINE    rac01      
ora....SM2.asm application    ONLINE    ONLINE    rac02      
ora....02.lsnr application    ONLINE    ONLINE    rac02      
ora.rac02.gsd  application    OFFLINE   OFFLINE              
ora.rac02.ons  application    ONLINE    ONLINE    rac02      
ora.rac02.vip  ora....t1.type ONLINE    ONLINE    rac02      
ora.racdb.db   ora....se.type ONLINE    ONLINE    rac01      
ora....ry.acfs ora....fs.type ONLINE    ONLINE    rac01      
ora.scan1.vip  ora....ip.type ONLINE    ONLINE    rac01      


在11g R2中,默認(rèn) oc4j和gsd資源是 disable 的;oc4j  是用于WLM 的一個(gè)
資源, WLM在 11.2.0.2 才可用;gsd 是 CRS 用于跟 9i RAC 進(jìn)行通信的一
個(gè)模塊,是為了向后兼容才保留的,不影響性能;建議不要?jiǎng)h除, 也不要嘗試開(kāi)
啟他們,  忽略即可。   

11g RAC 常用的是下面的命令:crsctl stat  resource -t .

[root@rac01 u01]# su - grid 
[grid@rac01 ~]$ crsctl stat  resource -t

如果后面不帶 -t , 那么可以看到相對(duì)詳細(xì)的資源信息 。
[grid@rac01 ~]$ crsctl stat  resource

2. 常用開(kāi)關(guān)機(jī)命令

注意, 11g RAC 開(kāi)啟資源相對(duì)比較慢(即使命令后面顯示的資源都start succeeded,
通過(guò)crs_stat -t查看都不一定online), 請(qǐng)注意命令操作后觀察crs log變化,以免出
現(xiàn)還沒(méi)有開(kāi)啟就懷疑啟動(dòng)有異常而采取重復(fù)動(dòng)作 。  


以下命令供參考:
---------------------------------------------------
在本地服務(wù)器上停止Oracle Clusterware 系統(tǒng):

[root@rac01 ~]# /u01/grid/11.2.0/bin/crsctl   stop  cluster
注:在運(yùn)行“crsctl stop cluster”命令之后,如果 Oracle Clusterware 管理的
資源中有任何一個(gè)還在運(yùn)行,則整個(gè)命令失敗。使用 -f 選項(xiàng)無(wú)條件地停止所有資源
并停止 Oracle Clusterware 系統(tǒng)。

[root@rac02 ~]# /u01/grid/11.2.0/bin/crsctl  stop  cluster  -all
停止所有節(jié)點(diǎn)上的clusterware系統(tǒng)。

在本地服務(wù)器上啟動(dòng)oralce clusterware系統(tǒng):
[root@rac01 ~]# /u01/grid/11.2.0/bin/crsctl start cluster

注:可通過(guò)指定 -all 選項(xiàng)在集群中所有服務(wù)器上啟動(dòng) Oracle Clusterware 系統(tǒng)。
[root@rac02 ~]# /u01/grid/11.2.0/bin/crsctl start cluster –all

還可以通過(guò)列出服務(wù)器(各服務(wù)器之間以空格分隔)在集群中一個(gè)或多個(gè)指定的服務(wù)器上啟動(dòng) Oracle Clusterware 系

統(tǒng):
[root@rac01 ~]# /u01/grid/11.2.0/bin/crsctl start cluster -n rac01 rac02

使用 SRVCTL 啟動(dòng)/停止所有實(shí)例:

[oracle@rac01 ~]# srvctl stop database -d racdb
[oracle@rac01 ~]# srvctl start database -d racdb


參考順序

關(guān)機(jī)順序: 先關(guān)閉Oracle實(shí)例(或數(shù)據(jù)庫(kù)),然后關(guān)閉ASM實(shí)例,最后關(guān)閉節(jié)點(diǎn)應(yīng)用
程序(虛擬 IP、GSD、TNS 監(jiān)聽(tīng)器和 ONS) .

手工開(kāi)機(jī)順序: 先啟動(dòng)節(jié)點(diǎn)應(yīng)用程序(虛擬 IP、GSD、TNS 監(jiān)聽(tīng)器和 ONS)。當(dāng)成功
啟動(dòng)節(jié)點(diǎn)應(yīng)用程序后,啟動(dòng) ASM 實(shí)例。最后,啟動(dòng) Oracle 實(shí)例(相關(guān)服務(wù))以及
企業(yè)管理器數(shù)據(jù)庫(kù)控制臺(tái)。

例子:

關(guān)閉:

在節(jié)點(diǎn)1上關(guān)閉所有節(jié)點(diǎn)的clusterware(如果有資源不能被關(guān)閉,使用-f).
[root@rac01 bin]# /u01/grid/11.2.0/bin/crsctl  stop cluster  -all

節(jié)點(diǎn)1,2上都關(guān)閉后我們查看
[grid@rac02 rac02]$ crsctl stat resource -t 
CRS-4535: Cannot communicate with Cluster Ready Services
CRS-4000: Command Status failed, or completed with errors.

開(kāi)啟:
[root@rac01 bin]# /u01/grid/11.2.0/bin/crsctl  start  cluster  -all


一般來(lái)說(shuō),開(kāi)啟上面一個(gè)命令就夠用了,但是如果發(fā)現(xiàn)有異常,比如db等很長(zhǎng)
時(shí)間都沒(méi)有onine, 我們也可以手工開(kāi)啟數(shù)據(jù)庫(kù)(任何一個(gè)節(jié)點(diǎn)執(zhí)行):
[root@rac02 ~]# /u01/grid/11.2.0/bin/srvctl  start  database  -d  racdb  

備注:
如果有需要也可以一個(gè)一個(gè)實(shí)例開(kāi)啟。
[root@rac02 ~]# /u01/grid/11.2.0/bin/srvctl start instance -d racdb -i racdb1
[root@rac02 ~]# /u01/grid/11.2.0/bin/srvctl start instance -d racdb -i racdb2

3.  常用建立表空間及加入數(shù)據(jù)文件 


參考 : http://space.itpub.net/?uid-7607759-action-viewspace-itemid-670722  

[root@rac01 bin]# su - oracle  
[oracle@rac01 ~]$ sqlplus / as sysdba 
SQL> create tablespace test  datafile '+oradata/racdb/datafile/test01.dbf'  size 50m ;
Tablespace created.

[root@rac02 ~]# su - grid
[grid@rac02 ~]$ asmcmd
ASMCMD>
ASMCMD> pwd
+oradata/racdb/datafile
ASMCMD>
ASMCMD> ls
SYSAUX.261.739387301
SYSTEM.260.739387283
TEST.340.740166807
UNDOTBS1.262.739387315
UNDOTBS2.264.739387351
USERS.265.739387361
test01.dbf

SQL> alter tablespace test add datafile  '+oradata/racdb/datafile/test02.dbf' size 50m ; 
Tablespace altered.

SQL>

ASMCMD> ls
SYSAUX.261.739387301
SYSTEM.260.739387283
TEST.340.740166807
TEST.341.740166937
UNDOTBS1.262.739387315
UNDOTBS2.264.739387351
USERS.265.739387361
test01.dbf
test02.dbf
ASMCMD>


ASMCMD> ls  -al
Type      Redund  Striped  Time             Sys  Name
DATAFILE  UNPROT  COARSE   JAN 11 17:00:00  Y    none => SYSAUX.261.739387301
DATAFILE  UNPROT  COARSE   JAN 11 17:00:00  Y    none => SYSTEM.260.739387283
DATAFILE  UNPROT  COARSE   JAN 11 17:00:00  Y    +ORADATA/RACDB/DATAFILE/test01.dbf =>

TEST.340.740166807
DATAFILE  UNPROT  COARSE   JAN 11 17:00:00  Y    +ORADATA/RACDB/DATAFILE/test02.dbf =>

TEST.341.740166937
DATAFILE  UNPROT  COARSE   JAN 11 17:00:00  Y    none => UNDOTBS1.262.739387315
DATAFILE  UNPROT  COARSE   JAN 11 17:00:00  Y    none => UNDOTBS2.264.739387351
DATAFILE  UNPROT  COARSE   JAN 11 17:00:00  Y    none => USERS.265.739387361
                                            N    test01.dbf =>

+ORADATA/RACDB/DATAFILE/TEST.340.740166807
                                            N    test02.dbf =>

+ORADATA/RACDB/DATAFILE/TEST.341.740166937
ASMCMD>

4. 查看ASM實(shí)例及用戶數(shù)據(jù)庫(kù)實(shí)例(注意分別是grid及oracle用戶):


查看ASM實(shí)例(以grid用戶登入,通過(guò)查看初始參數(shù)可以看到instance_name=+ASM1):

[grid@rac01 ~]$ id
uid=501(grid) gid=501(oinstall) groups=501(oinstall),504(asmadmin),506(asmdba),507(asmoper)
[grid@rac01 ~]$ sqlplus "/as sysdba"

SQL*Plus: Release 11.2.0.1.0 Production on Tue Jan 4 00:58:52 2011
Copyright (c) 1982, 2009, Oracle.  All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Real Application Clusters and Automatic Storage Management options

SQL> show parameter

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
asm_diskgroups                       string      ORADATA, ORAFLASH
asm_diskstring                       string
asm_power_limit                      integer     1
asm_preferred_read_failure_groups    string
audit_file_dest                      string      /u01/grid/11.2.0/rdbms/audit
.....

查看用戶數(shù)據(jù)庫(kù)實(shí)例(以oracle用戶登入,查看instance_name=racdb2,顯然是用戶實(shí)例): 

[root@rac02 u01]# su - oracle
[oracle@rac02 ~]$
[oracle@rac02 ~]$ sqlplus "/as sysdba"

SQL*Plus: Release 11.2.0.1.0 Production on Tue Jan 4 01:01:04 2011

Copyright (c) 1982, 2009, Oracle.  All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options

SQL> show parameter

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
O7_DICTIONARY_ACCESSIBILITY          boolean     FALSE
active_instance_count                integer
aq_tm_processes                      integer     0
archive_lag_target                   integer     0
asm_diskgroups                       string
asm_diskstring                       string
asm_power_limit                      integer     1
.......

5. 查看11g 數(shù)據(jù)庫(kù)實(shí)例的alert log及trace : 

[oracle@rac01 trace]$ pwd
/u01/product/oracle/diag/rdbms/racdb/racdb1/trace
[oracle@rac01 trace]$
[oracle@rac01 trace]$ vi  alert_racdb1.log

6. 查看11g RAC Clusterware的log :

[root@rac01 sbin]# su - grid
[grid@rac01 ~]$
[grid@rac01 rac01]$ pwd
/u01/grid/11.2.0/log/rac01


[grid@rac01 trace]$ pwd
/u01/grid/11.2.0/log/diag/tnslsnr/rac01/listener_scan1/trace
[grid@rac01 trace]$ ls
listener_scan1.log


[grid@rac01 rac01]$ pwd
/u01/grid/11.2.0/log/rac01
[grid@rac01 rac01]$ ls
admin/  alertrac01.log  crsd/  ctssd/    evmd/   gnsd/   mDNSd/  racg/
agent/  client/         cssd/  diskmon/  gipcd/  gpnpd/  ohasd/  srvm/

7. 常用集群命令


[grid@rac02 ~]$ crs_stat -t 


檢查Oracle Clusterware 是否在線

[grid@rac02 ~]$ crsctl check crs
CRS-4638: Oracle High Availability Services is online
CRS-4537: Cluster Ready Services is online
CRS-4529: Cluster Synchronization Services is online
CRS-4533: Event Manager is online


檢查cssd (Cluster Synchronization Services) 是否在線

[grid@rac02 ~]$ crsctl check cssd
CRS-272: This command remains for backward compatibility only
Cluster Synchronization Services is online


檢查crsd (Cluster Ready Services) 是否在線

[grid@rac02 ~]$ crsctl check crsd  
CRS-272: This command remains for backward compatibility only
Cluster Ready Services is online


檢查evmd (Event Mananger)是否在線

[grid@rac02 ~]$ crsctl check evmd
CRS-272: This command remains for backward compatibility only
Event Manager is online


在節(jié)點(diǎn)間檢查CSS的存活

[grid@rac02 ~]$ crsctl check cluster -n  rac01
**************************************************************
rac01:
CRS-4537: Cluster Ready Services is online
CRS-4529: Cluster Synchronization Services is online
CRS-4533: Event Manager is online
**************************************************************

[grid@rac02 ~]$ crsctl check cluster -n  rac02
**************************************************************
rac02:
CRS-4537: Cluster Ready Services is online
CRS-4529: Cluster Synchronization Services is online
CRS-4533: Event Manager is online
**************************************************************


開(kāi)啟數(shù)據(jù)庫(kù)

[grid@rac02 ~]$ srvctl start database -d racdb

開(kāi)啟oc4j :

[grid@rac02 ~]$ ./srvctl enable oc4j
[grid@rac02 ~]$ ./srvctl start oc4j
[grid@rac02 ~]$ ./crs_stat -t


8.  vote disk 管理 

[grid@rac01 ~]$ ocrcheck    
Status of Oracle Cluster Registry is as follows :
         Version                  :          3
         Total space (kbytes)     :     262120
         Used space (kbytes)      :       2720
         Available space (kbytes) :     259400
         ID                       :  132900461
         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 bypassed due to non-privileged user


在Oracle11g R2中,不必備份voting disk, 當(dāng)任何配置發(fā)生改變,voting disk
數(shù)據(jù)會(huì)自動(dòng)備份在OCR中,并自動(dòng)恢復(fù)到任何加入的voting disk中。 從下面可以看
到OCR和VotingDisk是一個(gè)文件。


[grid@rac01 ~]$ crsctl  query css votedisk
##  STATE    File Universal Id                File Name Disk group
--  -----    -----------------                --------- ---------
 1. ONLINE   095112005ec24f57bf98f6148818cc53 (ORCL:OCR_VOTE01) [OCR_VOTE]
Located 1 voting disk(s).
[grid@rac01 ~]$


[grid@rac01 ~]$ asmcmd
ASMCMD> ls
OCR_VOTE/
ORADATA/
ORAFLASH/
ASMCMD> cd ocr_vote
ASMCMD> cd rac
ASMCMD> ls
ASMPARAMETERFILE/
OCRFILE/
ASMCMD> cd ocrfile
ASMCMD> ls
REGISTRY.255.739337635


OCR 管理

[grid@rac01 ~]$ crsctl query crs activeversion
Oracle Clusterware active version on the cluster is [11.2.0.1.0]


[grid@rac01 ~]$ ocrcheck
Status of Oracle Cluster Registry is as follows :
         Version                  :          3
         Total space (kbytes)     :     262120
         Used space (kbytes)      :       2720
         Available space (kbytes) :     259400
         ID                       :  132900461
         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 bypassed due to non-privileged user


使用下面命令(root登陸)使用 destination_file 或者 +ASM_disk_group取代現(xiàn)在的OCR Location:

# ocrconfig -replace current_OCR_location -replacement new_OCR_location

如果只有一個(gè)OCR Location, 那么使用下面的命令:
# ocrconfig -add  +new_storage_disk_group
# ocrconfig -delete  +current_disk_group


運(yùn)行下面的命令顯示備份:

[grid@rac01 ~]$ ocrconfig   -showbackup 
rac01     2011/01/08 17:54:51     /u01/grid/11.2.0/cdata/rac/backup00.ocr
rac01     2011/01/08 13:54:49     /u01/grid/11.2.0/cdata/rac/backup01.ocr
rac02     2011/01/08 06:34:46     /u01/grid/11.2.0/cdata/rac/backup02.ocr
rac01     2011/01/07 02:15:37     /u01/grid/11.2.0/cdata/rac/day.ocr
rac01     2011/01/02 07:51:43     /u01/grid/11.2.0/cdata/rac/week.ocr
PROT-25: Manual backups for the Oracle Cluster Registry are not available

當(dāng)Oracle Clusterware起來(lái)的時(shí)候,在一個(gè)節(jié)點(diǎn)上運(yùn)行ocrconfig -manualbackup命令

[grid@rac01 ~]$ ocrconfig   -manualbackup
在 /u01/grid/11.2.0/cdata/rac/day.ocr下生成備份文件 backup_20100112_141900.ocr

然后使用 $ ocrconfig -showbackup 可以查看到備份信息。

運(yùn)行下面的命令檢驗(yàn)備份文件內(nèi)容及完整性。
$ ocrdump -backupfile backup_file_name   

以上就是Oracle11g RAC維護(hù)及管理的常用操作都有哪些,小編相信有部分知識(shí)點(diǎn)可能是我們?nèi)粘9ぷ鲿?huì)見(jiàn)到或用到的。希望你能通過(guò)這篇文章學(xué)到更多知識(shí)。更多詳情敬請(qǐng)關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道。


網(wǎng)站標(biāo)題:Oracle11gRAC維護(hù)及管理的常用操作都有哪些
分享地址:http://weahome.cn/article/ghpsho.html

其他資訊

在線咨詢

微信咨詢

電話咨詢

028-86922220(工作日)

18980820575(7×24)

提交需求

返回頂部