1. 程式人生 > >oracle RAC管理命令一

oracle RAC管理命令一

以下命令是針對oracle 11g r2 (版本是11.2.0.4)

[[email protected] ~]$ crsctl check cluster -all
**************************************************************
racdb01:
CRS-4537: Cluster Ready Services is online
CRS-4529: Cluster Synchronization Services is online
CRS-4533: Event Manager is online
**********
**************************************************** racdb02: CRS-4537: Cluster Ready Services is online CRS-4529: Cluster Synchronization Services is online CRS-4533: Event Manager is online ************************************************************** racdb03: CRS-4537: Cluster Ready Services is online CRS-4529: Cluster Synchronization Services is online CRS-4533: Event Manager is online *****
*********************************************************

這個命令是root使用者的,但是看許可權 oinstall 組的使用者也可以執行。

[grid@racdb01 ~]$ which crsctl 
/u01/app/11.2.0/grid/bin/crsctl

[grid@racdb01 ~]$ ll /u01/app/11.2.0/grid/bin/crsctl
-rwxr-xr-x 1 root oinstall 8575 Sep 15 17:30 /u01/app/11.2.0/grid/bin/crsctl

當然實驗否定了這一點,說明了什麼? 實踐是檢驗真理的唯一標準啊!

[[email protected] ~]$ crsctl start   cluster -all
CRS-4563: Insufficient user privileges.

CRS-4000: Command Start failed, or completed with errors.
[[email protected] ~]$ id grid
uid=54321(grid) gid=54321(oinstall) groups=54321(oinstall),54322(dba),54327(asmdba),54328(asmoper),54329(asmadmin)

看來程式裡面對執行的使用者做了預判斷啊~哈哈哈

rac部署完了之後,需要開啟歸檔,其實也不復雜
和單例項一樣,在mount模式下修改即可

[[email protected] ~]$ srvctl stop database -d orcl
[[email protected] ~]$ srvctl start  database -d orcl -o mount
[[email protected] ~]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.4.0 Production on Tue Sep 19 17:01:17 2017

Copyright (c) 1982, 2013, Oracle.  All rights reserved.


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options

SQL> alter database archivelog
  2  /

Database altered.

SQL> archive log list 
Database log mode          Archive Mode
Automatic archival         Enabled
Archive destination        /u01/app/oracle/product/11.2.0/dbhome_1/dbs/arch
Oldest online log sequence     10
Next log sequence to archive   11
Current log sequence           11



alter system set log_archive_dest_1='location=+DATA' scope=spfile

然後重啟資料庫,使配置生效

[[email protected] ~]$ srvctl stop database -d orcl 
[[email protected] ~]$ srvctl start  database -d orcl 


SQL> archive log list 
Database log mode          Archive Mode
Automatic archival         Enabled
Archive destination        +DATA
Oldest online log sequence     11
Next log sequence to archive   12
Current log sequence           12

進入asm磁碟檢視,oracle自動為我們建立了歸檔日誌的路徑

ASMCMD> pwd
+data/orcl/ARCHIVELOG/2017_09_19
ASMCMD> ls
thread_3_seq_12.271.955127247
thread_3_seq_13.272.955127249
ASMCMD> 

上文中我們用到的命令是
srvctl 這是rac管理的一個重要的命令,接下來幾天我們會濃墨重彩的介紹

A Server Control Utility
服務管理程式集

如果我的文章對您有幫助,您可以選擇打賞!

這裡寫圖片描述