数据库

位置:IT落伍者 >> 数据库 >> 浏览文章

OracleRAC日常基本维护命令


发布日期:2021年01月08日
 
OracleRAC日常基本维护命令

所有实例和服务的状态

$ srvctl status database d orcl

Instance orcl is running on node linux

Instance orcl is running on node linux

单个实例的状态

$ srvctl status instance d orcl i orcl

Instance orcl is running on node linux

在数据库全局命名服务的状态

$ srvctl status service d orcl s orcltest

Service orcltest is running on instance(s) orcl orcl

特定节点上节点应用程序的状态

$ srvctl status nodeapps n linux

VIP is running on node: linux

GSD is running on node: linux

Listener is running on node: linux

ONS daemon is running on node: linux

ASM 实例的状态

$ srvctl status asm n linux

ASM instance +ASM is running on node linux

列出配置的所有数据库

$ srvctl config database

orcl

显示 RAC 数据库的配置

$ srvctl config database d orcl

linux orcl /u/app/oracle/product//db_

linux orcl /u/app/oracle/product//db_

显示指定集群数据库的所有服务

$ srvctl config service d orcl

orcltest PREF: orcl orcl AVAIL:

显示节点应用程序的配置 —(VIPGSDONS监听器)

$ srvctl config nodeapps n linux a g s l

VIP exists: /linuxvip///eth:eth

GSD exists

ONS daemon exists

Listener exists

显示 ASM 实例的配置

$ srvctl config asm n linux

+ASM /u/app/oracle/product//db_

集群中所有正在运行的实例

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

orcl YES OPEN ACTIVE NORMAL rac

orcl YES OPEN ACTIVE NORMAL rac

位于磁盘组中的所有数据文件

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

+FLASH_RECOVERY_AREA/orcl/onlinelog/group_

+FLASH_RECOVERY_AREA/orcl/onlinelog/group_

+FLASH_RECOVERY_AREA/orcl/onlinelog/group_

+FLASH_RECOVERY_AREA/orcl/onlinelog/group_

+ORCL_DATA/orcl/controlfile/current

+ORCL_DATA/orcl/datafile/example

+ORCL_DATA/orcl/datafile/indx

+ORCL_DATA/orcl/datafile/sysaux

+ORCL_DATA/orcl/datafile/system

+ORCL_DATA/orcl/datafile/undotbs

+ORCL_DATA/orcl/datafile/undotbs

+ORCL_DATA/orcl/datafile/undotbs

+ORCL_DATA/orcl/datafile/undotbs

+ORCL_DATA/orcl/datafile/users

+ORCL_DATA/orcl/datafile/users

+ORCL_DATA/orcl/onlinelog/group_

+ORCL_DATA/orcl/onlinelog/group_

+ORCL_DATA/orcl/onlinelog/group_

+ORCL_DATA/orcl/onlinelog/group_

+ORCL_DATA/orcl/tempfile/temp

rows selected

属于ORCL_DATA磁盘组的所有 ASM 磁盘

SELECT path

FROM v$asm_disk

WHERE group_number IN (select group_number

from v$asm_diskgroup

where name = ORCL_DATA);

PATH

ORCL:VOL

ORCL:VOL

启动/停止RAC集群

确保是以 oracle UNIX 用户登录的我们将从rac节点运行所有命令

# su – oracle

$ hostname

Rac

停止 Oracle RAC g 环境

第一步是停止 Oracle 实例当此实例(和相关服务)关闭后关闭 ASM 实例最后关闭节点应用程序(虚拟IPGSDTNS 监听器和 ONS)

$ export ORACLE_SID=orcl

$ emctl stop dbconsole

$ srvctl stop instance d orcl i orcl

$ srvctl stop asm n rac

$ srvctl stop nodeapps –n rac

启动 Oracle RAC g 环境

第一步是启动节点应用程序(虚拟 IPGSDTNS 监听器和 ONS)当成功启动节点应用程序后启动 ASM 实例最后启动 Oracle 实例(和相关服务)以及企业管理器数据库控制台

$ export ORACLE_SID=orcl

$ srvctl start nodeapps n rac

$ srvctl start asm n rac

$ srvctl start instance d orcl i orcl

$ emctl start dbconsole

使用 SRVCTL 启动/停止所有实例

启动/停止所有实例及其启用的服务我只是觉得有意思就把此步骤作为关闭所有实例的一种方法加进来了!

$ srvctl start database d orcl

$ srvctl stop database d orcl

上一篇:Oracle 8.0.4 for Windows NT的安装

下一篇:重新编译PLSQL中无效对象或指定对象