您的位置:首页 > 数据库 > Oracle

oracle RAC管理命令一

2017-09-19 17:17 134 查看
以下命令是针对oracle 11g r2 (版本是11.2.0.4)

[grid@racdb01 ~]$ 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


当然实验否定了这一点,说明了什么? 实践是检验真理的唯一标准啊!

[grid@racdb01 ~]$ crsctl start   cluster -all
CRS-4563: Insufficient user privileges.

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


看来程序里面对执行的用户做了预判断啊~哈哈哈

rac部署完了之后,需要开启归档,其实也不复杂

和单实例一样,在mount模式下修改即可

[oracle@racdb01 ~]$ srvctl stop database -d orcl
[oracle@racdb01 ~]$ srvctl start  database -d orcl -o mount
[oracle@racdb01 ~]$ 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


然后重启数据库,使配置生效

[oracle@racdb01 ~]$ srvctl stop database -d orcl
[oracle@racdb01 ~]$ 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

服务管理程序集

如果我的文章对您有帮助,您可以选择打赏!

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: