熱點推薦:
您现在的位置: 電腦知識網 >> 編程 >> Oracle >> 正文

管理oracle11gRAC

2022-06-13   來源: Oracle 

  檢查集群狀態

  [grid@rac ~]$ crsctl check cluster

  CRS: Cluster Ready Services is online

  CRS: Cluster Synchronization Services is online

  CRS: Event Manager is online

  所有 Oracle 實例 —(數據庫狀態):

  [grid@rac ~]$ srvctl status database d racdb

  Instance racdb is running on node rac

  Instance racdb is running on node rac

  檢查單個實例狀態

  [grid@rac ~]$ srvctl status instance d racdb i racdb

  Instance racdb is running on node rac

  節點應用程序狀態

  [grid@rac ~]$  srvctl status nodeapps

  VIP racvip is enabled

  VIP racvip is running on node: rac

  VIP racvip is enabled

  VIP racvip is running on node: rac

  Network is enabled

  Network is running on node: rac

  Network is running on node: rac

  GSD is disabled

  GSD is not running on node: rac

  GSD is not running on node: rac

  ONS is enabled

  ONS daemon is running on node: rac

  ONS daemon is running on node: rac

  eONS is enabled

  eONS daemon is running on node: rac

  eONS daemon is running on node: rac

  列出所有的配置數據庫

  [grid@rac ~]$ srvctl config database

  racdb

  數據庫配置

  [grid@rac ~]$ srvctl config database d racdb a

  Database unique name: racdb

  Database name: racdb

  Oracle home: /u/app/oracle/product//dbhome_

  Oracle user: oracle

  Spfile: +RACDB_DATA/racdb/spfileracdbora

  Domain:

  Start options: open

  Stop options: immediate

  Database role: PRIMARY

  Management policy: AUTOMATIC

  Server pools: racdb

  Database instances: racdbracdb

  Disk Groups: RACDB_DATAFRA

  Services:

  Database is enabled

  Database is administrator managed

  ASM狀態以及ASM配置

  [grid@rac ~]$ srvctl status asm

  ASM is running on racrac

  [grid@rac ~]$ srvctl config asm a

  ASM home: /u/app//grid

  ASM listener: LISTENER

  ASM is enabled

  TNS監聽器狀態以及配置

  [grid@rac ~]$ srvctl status listener

  Listener LISTENER is enabled

  Listener LISTENER is running on node(s): racrac

  [grid@rac ~]$ srvctl config listener a

  Name: LISTENER

  Network: Owner: grid

  Home: <CRS home>

  /u/app//grid on node(s) racrac

  End points: TCP:

  SCAN狀態以及配置

  [grid@rac ~]$ srvctl status scan

  SCAN VIP scan is enabled

  SCAN VIP scan is running on node rac

  [grid@rac ~]$ srvctl config scan

  SCAN name: r Network: ///eth

  SCAN VIP name: scan IP: /r/

  VIP各個節點的狀態以及配置

  [grid@rac ~]$ srvctl status vip n rac

  VIP racvip is enabled

  VIP racvip is running on node: rac

  [grid@rac ~]$ srvctl status vip n rac

  VIP racvip is enabled

  VIP racvip is running on node: rac

  [grid@rac ~]$  srvctl config vip n rac

  VIP exists:rac

  VIP exists: /racvip///eth

  [grid@rac ~]$  srvctl config vip n rac

  VIP exists:rac

  VIP exists: /racvip///eth

  節點應用程序配置 —(VIPGSDONS監聽器)

  [grid@rac ~]$ srvctl config nodeapps a g s l

  l option has been deprecated and will be ignored

  VIP exists:rac

  VIP exists: /racvip///eth

  VIP exists:rac

  VIP exists: /racvip///eth

  GSD exists

  ONS daemon exists Local port remote port

  Name: LISTENER

  Network: Owner: grid

  Home: <CRS home>

  /u/app//grid on node(s) racrac

  End points: TCP:

  驗證所有集群節點間的時鐘同步:

  [grid@rac ~]$ cluvfy comp clocksync verbose

  Verifying Clock Synchronization across the cluster nodes

  Checking if Clusterware is installed on all nodes

  Check of Clusterware install passed

  Checking if CTSS Resource is running on all nodes

  Check: CTSS Resource running on all nodes

  Node Name                             Status

   

  rac                                 passed

  Result: CTSS resource check passed

  Querying CTSS for time offset on all nodes

  Result: Query of CTSS for time offset passed

  Check CTSS state started

  Check: CTSS state

  Node Name                             State

   

  rac                                 Active

  CTSS is in Active state Proceeding with check of clock time offsets on all nodes

  Reference Time Offset Limit: msecs

  Check: Reference Time Offset

  Node Name     Time Offset               Status

     

  rac                                passed

  Time offset is within the specified limits on the following set of nodes:

  [rac]

  Result: Check of clock time offsets passed

  Oracle Cluster Time Synchronization Services check passed

  Verification of Clock Synchronization across the cluster nodes was successful

  集群中所有正在運行的實例 — (SQL):

  SELECT inst_id instance_number inst_no instance_name inst_name parallel status database_status db_status active_state state host_name host FROM gv$instance ORDER BY inst_id;

  所有數據庫文件及它們所在的 ASM 磁盤組 — (SQL):

  ASM 磁盤卷:

  啟動和停止集群

  以下操作需用root用戶執行

  ()在本地服務器上停止Oracle Clusterware 系統

  [root@rac ~]# /u/app//grid/bin/crsctl stop cluster

  CRS: Attempting to stop oracrsd on rac

  CRS: Starting shutdown of Cluster Ready Servicesmanaged resources on rac

  CRS: Attempting to stop oraLISTENERlsnr on rac

  CRS: Attempting to stop oraCRSdg on rac

  CRS: Attempting to stop oraracdbdb on rac

  CRS: Attempting to stop oraregistryacfs on rac

  CRS: Stop of oraLISTENERlsnr on rac succeeded

  CRS: Attempting to stop oraracvip on rac

  CRS: Stop of oraracvip on rac succeeded

  CRS: Attempting to start oraracvip on rac

  CRS: Stop of oraregistryacfs on rac succeeded

  CRS: Start of oraracvip on rac succeeded

  CRS: Stop of oraCRSdg on rac succeeded

  CRS: Stop of oraracdbdb on rac succeeded

  CRS: Attempting to stop oraFRAdg on rac

  CRS: Attempting to stop oraRACDB_DATAdg on rac

  CRS: Stop of oraFRAdg on rac succeeded

  CRS: Stop of oraRACDB_DATAdg on rac succeeded

  CRS: Attempting to stop oraasm on rac

  CRS: Stop of oraasm on rac succeeded

  CRS: Attempting to stop oraons on rac

  CRS: Attempting to stop oraeons on rac

  CRS: Stop of oraons on rac succeeded

  CRS: Attempting to stop work on rac

  CRS: Stop of work on rac succeeded

  CRS: Stop of oraeons on rac succeeded

  CRS: Shutdown of Cluster Ready Servicesmanaged resources on rac has completed

  CRS: Stop of oracrsd on rac succeeded

  CRS: Attempting to stop oracssdmonitor on rac

  CRS: Attempting to stop oractssd on rac

  CRS: Attempting to stop oraevmd on rac

  CRS: Attempting to stop oraasm on rac

  CRS: Stop of oracssdmonitor on rac succeeded

  CRS: Stop of oraevmd on rac succeeded

  CRS: Stop of oractssd on rac succeeded

  CRS: Stop of oraasm on rac succeeded

  CRS: Attempting to stop oracssd on rac

  CRS: Stop of oracssd on rac succeeded

  CRS: Attempting to stop oradiskmon on rac

  CRS: Stop of oradiskmon on rac succeeded

  注在運行crsctl stop cluster命令之後如果 Oracle Clusterware 管理的資源中有任何一個還在運行則整個命令失敗使用 f 選項無條件地停止所有資源並停止 Oracle Clusterware 系統

  另請注意可通過指定 all 選項在集群中所有服務器上停止 Oracle Clusterware 系統如下所示在rac和rac上停止oracle clusterware系統

  [root@rac ~]# /u/app//grid/bin/crsctl stop cluster –all

  在本地服務器上啟動oralce clusterware系統

  [root@rac ~]# /u/app//grid/bin/crsctl start cluster

  注可通過指定 all 選項在集群中所有服務器上啟動 Oracle Clusterware 系統

  [root@rac ~]# /u/app//grid/bin/crsctl start cluster –all

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

  [root@rac ~]# /u/app//grid/bin/crsctl start cluster n rac rac

  使用 SRVCTL 啟動/停止所有實例:

  [oracle@rac ~]#srvctl stop database d racdb

  [oracle@rac ~]#srvctl start database d racdb

  安裝的後置任務

  .官方建議的兩個安裝後置任務

  () 備份 rootsh 腳本

  官方建議在完成安裝後要備份rootsh腳本文件如果在Oracle Home目錄中又安裝其它的產品安裝時OUI會升級已存在的rootsh文件如果需要rootsh內的原始信息就可以在備份中找到

  cd $ORACLE_HOME;cp rootsh rootshbak

  ()重新編譯無效對象

  運行 utlrpsql 腳本立即重新編譯所有無效的 PL/SQL 程序包而不是在首次訪問它們時再重新編譯這是個可選步驟但建議您選擇該步驟

  [oracle@racnode ~]$ sqlplus / as sysdba

  SQL&gt; @?/rdbms/admin/utlrpsql

  在 RAC 環境中啟用存檔日志

  ()以 oracle 用戶身份登錄到一個節點(即 racnode通過在當前實例中將 cluster_database 設置為 FALSE 來禁用集群實例參數

  [oracle@rac ~]$ sqlplus / as sysdba

  SQL&gt; alter system set cluster_database=false scope=spfile sid=racdb;

  System altered

  ()以 oracle 用戶身份關閉所有 訪問集群化數據庫的實例

  [oracle@rac ~]$ srvctl stop database d racdb

  ()使用本地實例掛載數據庫

  [oracle@rac ~]$ sqlplus / as sysdba

  SQL*Plus: Release Production on Sat Nov :: Copyright (c) Oracle All rights reserved Connected to an idle instance

  SQL&gt; startup mount

  ORACLE instance started

  Total System Global Area bytes

  Fixed Size bytes

  Variable Size bytes

  Database Buffers bytes

  Redo Buffers bytes

  ()啟用存檔功能

  SQL&gt; alter database archivelog;

  Database altered

  ()通過在當前實例中將實例參數 cluster_database 修改為 TRUE重新啟用對集群的支持

  SQL&gt; alter system set cluster_database=true scope=spfile sid=racdb;

  System altered

  ()關閉本地實例

  SQL&gt; shutdown immediate

  ORA: database not open

  Database dismounted

  ORACLE instance shut down

  ()以 oracle 帳戶身份使用 srvctl 命令重啟所有實例

  [oracle@rac ~]$ srvctl start database d racdb

  ()登錄到本地實例驗證存檔日志模式已啟用

  [oracle@rac ~]$ sqlplus / as sysdba

  SQL*Plus: Release Production on Sat Nov :: Copyright (c) Oracle All rights reserved Connected to: Oracle Database g Enterprise Edition Release bit Production With the Partitioning Real Application Clusters Automatic Storage Management OLAP Data Mining and Real Application Testing options

  SQL&gt; archive log list

  Database log mode Archive Mode

  Automatic archival Enabled

  Archive destination USE_DB_RECOVERY_FILE_DEST

  Oldest online log sequence

  Next log sequence to archive

  Current log sequence

  在兩個RAC節點都備份spfile初始化參數文件:創建一個備份目錄

  [oracle@rac ~]$ mkdir $ORACLE_HOME/spfile_bak

  [oracle@rac ~]$ sqlplus /as sysdba


From:http://tw.wingwit.com/Article/program/Oracle/201311/17619.html
    推薦文章
    Copyright © 2005-2022 電腦知識網 Computer Knowledge   All rights reserved.