Oracle RAC維護命令

ljm0211發表於2012-06-13

1、檢視所有例項和服務的狀態

$ srvctl status database -d orcl

Instance orcl1 is running on node linux1

Instance orcl2 is running on node linux2

2、檢視單個例項的狀態

$ srvctl status instance -d orcl -i orcl2

Instance orcl2 is running on node linux2

3、檢視資料庫全域性命名服務的狀態

$ srvctl status service -d orcl -s orcltest

Service orcltest is running on instance(s) orcl2, orcl1

4、檢視特定節點上節點應用程式的狀態

$ srvctl status nodeapps -n linux1

VIP is running on node: linux1

GSD is running on node: linux1

Listener is running on node: linux1

ONS daemon is running on node: linux1

5、檢視ASM 例項的狀態

$ srvctl status asm -n linux1

ASM instance +ASM1 is running on node linux1.

6列出配置的所有資料庫

$ srvctl config database

orcl

7顯示 RAC 資料庫的配置

$ srvctl config database -d orcl

linux1 orcl1 /u01/app/oracle/product/10.2.0/db_1

linux2 orcl2 /u01/app/oracle/product/10.2.0/db_1

8顯示指定叢集資料庫的所有服務

$ srvctl config service -d orcl

orcltest PREF: orcl2 orcl1 AVAIL:

9顯示節點應用程式的配置 —(VIPGSDONS、監聽器)

$ srvctl config nodeapps -n linux1 -a -g -s -l

VIP exists.: /linux1-vip/192.168.1.200/255.255.255.0/eth0:eth1

GSD exists.

ONS daemon exists.

Listener exists.

10顯示 ASM 例項的配置

$ srvctl config asm -n linux1

+ASM1 /u01/app/oracle/product/10.2.0/db_1

11、檢視叢集中所有正在執行的例項

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;

 

INST_ID INST_NO INST_NAME PAR STATUS DB_STATUS STATE HOST

-------- -------- ---------- --- ------- ------------ --------- -------

1 1 orcl1 YES OPEN ACTIVE NORMAL rac1

2 2 orcl2 YES OPEN ACTIVE NORMAL rac2

 

12、檢視位於磁碟組中的所有資料檔案

select name from v$datafile

union

select member from v$logfile

union

select name from v$controlfile

union

select name from v$tempfile;

 

NAME

-------------------------------------------

+FLASH_RECOVERY_AREA/orcl/controlfile/current.258.570913191

+FLASH_RECOVERY_AREA/orcl/onlinelog/group_1.257.570913201

+FLASH_RECOVERY_AREA/orcl/onlinelog/group_2.256.570913211

+FLASH_RECOVERY_AREA/orcl/onlinelog/group_3.259.570918285

+FLASH_RECOVERY_AREA/orcl/onlinelog/group_4.260.570918295

+ORCL_DATA1/orcl/controlfile/current.259.570913189

+ORCL_DATA1/orcl/datafile/example.257.570913311

+ORCL_DATA1/orcl/datafile/indx.270.570920045

+ORCL_DATA1/orcl/datafile/sysaux.260.570913287

+ORCL_DATA1/orcl/datafile/system.262.570913215

+ORCL_DATA1/orcl/datafile/undotbs1.261.570913263

+ORCL_DATA1/orcl/datafile/undotbs1.271.570920865

+ORCL_DATA1/orcl/datafile/undotbs2.265.570913331

+ORCL_DATA1/orcl/datafile/undotbs2.272.570921065

+ORCL_DATA1/orcl/datafile/users.264.570913355

+ORCL_DATA1/orcl/datafile/users.269.570919829

+ORCL_DATA1/orcl/onlinelog/group_1.256.570913195

+ORCL_DATA1/orcl/onlinelog/group_2.263.570913205

+ORCL_DATA1/orcl/onlinelog/group_3.266.570918279

+ORCL_DATA1/orcl/onlinelog/group_4.267.570918289

+ORCL_DATA1/orcl/tempfile/temp.258.570913303

 

21 rows selected.

13、檢視屬於“ORCL_DATA1”磁碟組的所有 ASM 磁碟

SELECT path

FROM v$asm_disk

WHERE group_number IN (select group_number

from v$asm_diskgroup

where name = 'ORCL_DATA1');

 

PATH

----------------------------------

ORCL:VOL1

ORCL:VOL2

14啟動/停止RAC叢集

確保是以 oracle UNIX 使用者登入的。我們將從rac1節點執行所有命令:

# su – oracle

$ hostname

Rac1

15停止 Oracle RAC 10g 環境

第一步是停止 Oracle 例項。當此例項(和相關服務)關閉後,關閉 ASM 例項。最後,關閉節點應用程式(虛擬 IPGSDTNS 監聽器和 ONS)。

$ export ORACLE_SID=orcl1

$ emctl stop dbconsole

$ srvctl stop instance -d orcl -i orcl1

$ srvctl stop asm -n rac1

$ srvctl stop nodeapps –n rac1

16啟動 Oracle RAC 10g 環境

第一步是啟動節點應用程式(虛擬 IPGSDTNS 監聽器和 ONS)。當成功啟動節點應用程式後,啟動 ASM 例項。最後,啟動 Oracle 例項(和相關服務)以及企業管理器資料庫控制檯。

$ export ORACLE_SID=orcl1

$ srvctl start nodeapps -n rac1

$ srvctl start asm -n rac1

$ srvctl start instance -d orcl -i orcl1

$ emctl start dbconsole

17使用 SRVCTL 啟動/停止所有例項

啟動/停止所有例項及其啟用的服務。我只是覺得有意思就把此步驟作為關閉所有例項的一種方法加進來了!

$ srvctl start database -d orcl

$ srvctl stop database -d orcl

 

18RAC crs自動啟動指令碼

with /etc/init.d/init.crs disable/enable to disable or enable it next time reboot

/etc/init.d/init.crsd
/etc/init.d/init.evmd
/etc/init.d/init.cssd

19RAC 中資料庫啟動/關閉/檢視指令碼

啟動資料庫:srvctl start database -d RACDB

關閉資料庫:srvctl stop database -d RACDB

檢查資料啟動狀態:srvctl status database -d RACDB

 

檢視資料庫例項狀態:srvctl status instance -d RACDB -i RACDB1,RACDB2

 

20、單獨啟動節點的資源

srvctl start nodeapps -n gnd-rac01

srvctl start nodeapps -n ons-rac01

 

 

 

21RAC中客戶端TNSNAME.ORA配置

# TNSNAMES.ORA Network Configuration File: D:\oracle\ora92\NETWORK\ADMIN\tnsnames.ora

# Generated by Oracle configuration tools.

 

HIS =

  (DESCRIPTION =

    (ADDRESS_LIST =

      (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.5)(PORT = 1521))

      (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.7)(PORT = 1521))

      (LOAD_BALANCE = yes)

      (FAILOVER = on)

    )

    (CONNECT_DATA =

      (SERVICE_NAME = orcl)

      (FAILOVER_MODE =(TYPE = select)(METHOD = basic))

    )

  )

 

HIS2 =

  (DESCRIPTION =

    (ADDRESS_LIST =

      (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.7)(PORT = 1521))

    )

    (CONNECT_DATA =

      (SID = ORCL2)

    )

  )

 

HIS1 =

  (DESCRIPTION =

    (ADDRESS_LIST =

      (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.5)(PORT = 1521))

    )

    (CONNECT_DATA =

      (SID = ORCL1)

    )

  )

類別:Oracle Rac 檢視評論

Link URL: http://hi.baidu.com/ljm0211/blog/item/5f03e6115bcf78e7a6ef3f44.html

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/11411056/viewspace-732744/,如需轉載,請註明出處,否則將追究法律責任。

相關文章