数据库

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

管理oracle11gRAC


发布日期:2019年06月17日
 
管理oracle11gRAC

检查集群状态

[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

               

上一篇:在oracle中限制返回结果集的大小

下一篇:Oracle10g第N条记录取得