oracle-srvctl-output

时间:2022-10-17 21:30:39

##############################

[grid@rac01 ~]$ crsctl query crs administrator
CRS Administrator List: *
[grid@rac01 ~]$ crsctl query crs activeversion
Oracle Clusterware active version on the cluster is [11.2.0.4.0]
[grid@rac01 ~]$ crsctl query crs releaseversion
Oracle High Availability Services release version on the local node is [11.2.0.4.0]
[grid@rac01 ~]$ crsctl query crs softwareversion
Oracle Clusterware version on node [rac01] is [11.2.0.4.0]

[grid@rac02 ~]$ crsctl query css votedisk
##  STATE    File Universal Id                File Name Disk group
--  -----    -----------------                --------- ---------
 1. ONLINE   7bf2c81459334ffebf01c410d096a047 (ORCL:CRSVOL1) [CRS]
Located 1 voting disk(s).

[grid@rac01 ~]$ crsctl check crs
CRS-4638: Oracle High Availability Services is online
CRS-4537: Cluster Ready Services is online
CRS-4529: Cluster Synchronization Services is online
CRS-4533: Event Manager is online
[grid@rac01 ~]$ crsctl check css
CRS-4529: Cluster Synchronization Services is online
[grid@rac01 ~]$ crsctl check ctss
CRS-4700: The Cluster Time Synchronization Service is in Observer mode.
[grid@rac01 ~]$ crsctl check cluster
CRS-4537: Cluster Ready Services is online
CRS-4529: Cluster Synchronization Services is online
CRS-4533: Event Manager is online
[grid@rac01 ~]$ crsctl check cluster -all
**************************************************************
rac01:
CRS-4537: Cluster Ready Services is online
CRS-4529: Cluster Synchronization Services is online
CRS-4533: Event Manager is online
**************************************************************
rac02:
CRS-4537: Cluster Ready Services is online
CRS-4529: Cluster Synchronization Services is online
CRS-4533: Event Manager is online
**************************************************************

[root@rac02 bin]# /u01/app/11.2.0/grid/bin/crsctl config crs
CRS-4622: Oracle High Availability Services autostart is enabled.

##############################

[grid@cu-kvm1 trace]$ cluvfy comp ssa

Verifying shared storage accessibility

Checking shared storage accessibility...

Disk                                  Sharing Nodes (1 in count)
  ------------------------------------  ------------------------
  /dev/sda                              cu-kvm1

Disk                                  Sharing Nodes (1 in count)
  ------------------------------------  ------------------------
  /dev/sdb                              cu-kvm1
  /dev/sdc                              cu-kvm1
  /dev/sdd                              cu-kvm1
  /dev/sde                              cu-kvm1
  /dev/sdf                              cu-kvm1
  /dev/sdg                              cu-kvm1

Shared storage check was successful on nodes "cu-kvm1"

Verification of shared storage accessibility was successful.

#########################################
[grid@cu-kvm1 trace]$ cluvfy comp asm -n all

Verifying ASM Integrity

Task ASM Integrity check started...

Starting check to see if ASM is running on all cluster nodes...

ASM Running check passed. ASM is running on all specified nodes

Starting Disk Groups check to see if at least one Disk Group configured...
Disk Group Check passed. At least one Disk Group configured

Task ASM Integrity check passed...

Verification of ASM Integrity was successful.

############################

[oracle@oracle-test OPatch]$ ./opatch lsinventory
Oracle Interim Patch Installer version 11.2.0.3.4
Copyright (c) 2012, Oracle Corporation.  All rights reserved.

Oracle Home       : /u01/app/oracle/product/11.2/db_1
Central Inventory : /u01/app/oraInventory
   from           : /u01/app/oracle/product/11.2/db_1//oraInst.loc
OPatch version    : 11.2.0.3.4
OUI version       : 11.2.0.4.0
Log file location : /u01/app/oracle/product/11.2/db_1/cfgtoollogs/opatch/opatch2017-01-21_15-03-01PM_1.log

Lsinventory Output file location : /u01/app/oracle/product/11.2/db_1/cfgtoollogs/opatch/lsinv/lsinventory2017-01-21_15-03-01PM.txt

--------------------------------------------------------------------------------
Installed Top-level Products (1):

Oracle Database 11g                                                  11.2.0.4.0
There are 1 products installed in this Oracle Home.

There are no Interim patches installed in this Oracle Home.

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

OPatch succeeded.
[oracle@oracle-test OPatch]$ pwd
/u01/app/oracle/product/11.2/db_1/OPatch

############################

[oracle@allinone ~]$ lcsscan help=y

Language and Character Set File Scanner v2.1

(c) Copyright 2003, 2004 Oracle Corporation.  All rights reserved.

You can control how LCSSCAN runs by entering the LCSSCAN command
 followed by the required parameters. To specify parameters, you use
 keywords:

Example: LCSSCAN RESULTS=2 END=1000 FORMAT=HTML FILE=index.html

Keyword    Description (Default)
 --------------------------------------------------------------------
 RESULTS    number of language and character set pairs to return (1)
 BEGIN      beginning byte offset of file (1)
 END        ending byte offset of file (end of file)
 FORMAT     file format TEXT, HTML or AUTO detect (TEXT)
 FILE       name of input file
 HELP       show help screen (this screen)

[oracle@allinone admin]$ csscan help=y

Character Set Scanner v2.2 : Release 11.2.0.4.0 - Production on Mon Mar 27 14:12:02 2017

Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.

You can let Scanner prompt you for parameters by entering the CSSCAN
command followed by your username/password:

Example: CSSCAN \"SYSTEM/MANAGER AS SYSDBA\"

Or, you can control how Scanner runs by entering the CSSCAN command
followed by various parameters. To specify parameters, you use keywords:

Example:
    CSSCAN \"SYSTEM/MANAGER AS SYSDBA\" FULL=y TOCHAR=utf8 ARRAY=1024000 PROCESS=3

Keyword    Default Prompt Description
---------- ------- ------ -------------------------------------------------
USERID             yes    username/password
FULL       N       yes    scan entire database
USER               yes    owner of tables to be scanned
TABLE              yes    list of tables to scan
COLUMN             yes    list of columns to scan
EXCLUDE                   list of tables to exclude from scan
TOCHAR             yes    new database character set name
FROMCHAR                  current database character set name
TONCHAR                   new national character set name
FROMNCHAR                 current national character set name
ARRAY      1024000 yes    size of array fetch buffer
PROCESS    1       yes    number of concurrent scan process
MAXBLOCKS                 split table if block size exceed MAXBLOCKS
CAPTURE    N              capture convertible data
SUPPRESS                  maximum number of exceptions logged for each table
FEEDBACK                  report progress every N rows
BOUNDARIES                list of column size boundaries for summary report
LASTRPT    N              generate report of the last database scan
LOG        scan           base file name of report files
PARFILE                   parameter file name
PRESERVE   N              preserve existing scan results
LCSD       N       no     enable language and character set detection
LCSDDATA   LOSSY   no     define the scope of the detection
HELP       N              show help screen (this screen)
QUERY      N              select clause to scan subset of tables or columns
---------- ------- ------ -------------------------------------------------
Scanner terminated successfully.

[oracle@allinone ~]$ lcsscan file=cp.html format=html results=3

Language and Character Set File Scanner v2.1

(c) Copyright 2003, 2004 Oracle Corporation.  All rights reserved.

cp.html:        SIMPLIFIED CHINESE  UTF8;       TRADITIONAL CHINESE  UTF8;      JAPANESE  UTF8;
[oracle@allinone ~]$ lcsscan file=dblog.txt

Language and Character Set File Scanner v2.1

(c) Copyright 2003, 2004 Oracle Corporation.  All rights reserved.

dblog.txt:      ENGLISH  US7ASCII;

[oracle@allinone ~]$ lcsscan file=sqlplus.txt results=3 begin=300

Language and Character Set File Scanner v2.1

(c) Copyright 2003, 2004 Oracle Corporation.  All rights reserved.

sqlplus.txt:    ENGLISH  WE8ISO8859P1;  FRENCH  WE8ISO8859P1;   ITALIAN  WE8ISO8859P1;

[oracle@allinone ~]$ lcsscan file=sqlplus.txt results=3 end=300

Language and Character Set File Scanner v2.1

(c) Copyright 2003, 2004 Oracle Corporation.  All rights reserved.

sqlplus.txt:    TRADITIONAL CHINESE  ZHT16MSWIN950;     JAPANESE  AL16UTF16LE;  JAPANESE  AL16UTF16;

=========================================

[grid@rac01 ~]$ ocrconfig -showbackup

rac01     2016/09/19 10:12:26     /u01/app/11.2.0/grid/cdata/rac-cluster/backup00.ocr

rac01     2016/09/19 06:12:26     /u01/app/11.2.0/grid/cdata/rac-cluster/backup01.ocr

rac01     2016/09/19 02:12:26     /u01/app/11.2.0/grid/cdata/rac-cluster/backup02.ocr

rac01     2016/09/18 06:12:24     /u01/app/11.2.0/grid/cdata/rac-cluster/day.ocr

rac01     2016/09/08 06:12:08     /u01/app/11.2.0/grid/cdata/rac-cluster/week.ocr
PROT-25: Manual backups for the Oracle Cluster Registry are not available
[grid@rac01 ~]$ ocrdump -backupfile /u01/app/11.2.0/grid/cdata/rac-cluster/day.ocr
[grid@rac01 ~]$ ls
normal  OCRDUMPFILE  oradiag_grid  spfileman.ora
[grid@rac01 ~]$ less OCRDUMPFILE

==================================

============================================

[grid@rac01 ~]$ srvctl
Usage: srvctl <command> <object> [<options>]
    commands: enable|disable|start|stop|relocate|status|add|remove|modify|getenv|setenv|unsetenv|config|convert|upgrade
    objects: database|instance|service|nodeapps|vip|network|asm|diskgroup|listener|srvpool|server|scan|scan_listener|oc4j|home|filesystem|gns|cvu
For detailed help on each command and object and its options use:
  srvctl <command> -h or
  srvctl <command> <object> -h

[grid@rac01 ~]$ srvctl status home -h

Displays the current state of of all resources for the Oracle home.

Usage: srvctl status home -o <oracle_home> -s <state_file> -n <node_name>
    -o <oracle_home>         ORACLE_HOME path
    -s <state_file>   Specify a file path for the 'srvctl status home' command to store the state of the resources
    -n <node_name>           Node name
    -h                       Print usage

[grid@rac01 ~]$ srvctl status database -d baoka
Instance baoka1 is running on node rac01
Instance baoka2 is running on node rac02

[grid@rac01 ~]$ srvctl status asm
ASM is running on rac02,rac01
[grid@rac01 ~]$ srvctl status listener
Listener LISTENER is enabled
Listener LISTENER is running on node(s): rac02,rac01

[grid@rac01 ~]$ srvctl status server -n rac01
Server name: rac01
Server state: ONLINE
[grid@rac01 ~]$ srvctl status server -n rac02
Server name: rac02
Server state: ONLINE
[grid@rac01 ~]$ srvctl status scan
SCAN VIP scan1 is enabled
SCAN VIP scan1 is running on node rac02
[grid@rac01 ~]$ srvctl status scan_listener
SCAN Listener LISTENER_SCAN1 is enabled
SCAN listener LISTENER_SCAN1 is running on node rac02

[grid@rac01 ~]$ srvctl status filesystem -d baoka
PRCT-1129 : Execution of ACFS driver state check failed on local node with result ACFS-9459: ADVM/ACFS is not supported on this OS version: 'centos-release-6-8.el6.centos.12.3.x86_64
'
ACFS-9201: Not Supported
[grid@rac01 ~]$ srvctl status gns
PRCS-1065 : GNS is not configured.
[grid@rac01 ~]$ srvctl status cvu
CVU is enabled and running on node rac02

====================================
[grid@rac01 ~]$ srvctl status nodeapps
VIP rac01-vip is enabled
VIP rac01-vip is running on node: rac01
VIP rac02-vip is enabled
VIP rac02-vip is running on node: rac02
Network is enabled
Network is running on node: rac01
Network is running on node: rac02
GSD is disabled
GSD is not running on node: rac01
GSD is not running on node: rac02
ONS is enabled
ONS daemon is running on node: rac01
ONS daemon is running on node: rac02
eONS is enabled
eONS daemon is running on node: rac01
eONS daemon is running on node: rac02
[grid@rac01 ~]$ srvctl status listener
Listener LISTENER is enabled
Listener LISTENER is running on node(s): rac02
[grid@rac01 ~]$ srvctl status asm
ASM is running on rac01,rac02
[grid@rac01 ~]$ srvctl status scan
SCAN VIP scan1 is enabled
SCAN VIP scan1 is running on node rac01
[grid@rac01 ~]$ srvctl status scan_listener
SCAN Listener LISTENER_SCAN1 is enabled
SCAN listener LISTENER_SCAN1 is running on node rac01
[grid@rac01 ~]$ srvctl status srvpool
Server pool name: Free
Active servers count: 0
Server pool name: Generic
Active servers count: 2
[grid@rac01 ~]$ srvctl status oc4j
OC4J is disabled
[grid@rac01 ~]$ srvctl status database -d man
Instance man is not running on node rac01
[grid@rac01 ~]$ srvctl status database -d bus
Instance bus is running on node rac02

====================================

[grid@rac02 rac02]$ srvctl config database
bus
man
[grid@rac02 rac02]$ srvctl config database -d man
Database unique name: man
Database name: man
Oracle home: /u01/app/oracle/product/11.2.0/db_1
Oracle user: oracle
Spfile: +DATA/man/spfileman.ora
Domain:
Start options: open
Stop options: immediate
Database role: PRIMARY
Management policy: AUTOMATIC
Server pools: man
Database instances: man
Disk Groups: DATA,FLASH
Services:
Database is administrator managed

[grid@rac01 ~]$ srvctl config database -d baoka
Database unique name: baoka
Database name: baoka
Oracle home: /oracle/app/oracle/product/11.2.0/db_1
Oracle user: oracle
Spfile: +DATA1/baoka/spfilebaoka.ora
Domain:
Start options: open
Stop options: immediate
Database role: PRIMARY
Management policy: AUTOMATIC
Server pools: baoka
Database instances: baoka1,baoka2
Disk Groups: DATA1,FLASH,ARCH
Mount point paths:
Services:
Type: RAC
Database is administrator managed

[grid@rac02 rac02]$ srvctl config listener
Name: LISTENER
Network: 1, Owner: grid
Home: <CRS home>
End points: TCP:1521
[grid@rac02 rac02]$ srvctl config nodeapps
VIP exists.:rac01
VIP exists.: /rac01-vip/192.168.2.3/255.255.255.0/eth0
VIP exists.:rac02
VIP exists.: /rac02-vip/192.168.2.4/255.255.255.0/eth0
GSD exists.
ONS daemon exists. Local port 6100, remote port 6200
eONS daemon exists. Multicast port 22130, multicast IP address 234.241.222.16, listening port 2016

[grid@cu-kvm1 trace]$ srvctl config asm
ASM home: /u01/app/11.2.0/grid_1
ASM listener: LISTENER
[grid@cu-kvm1 trace]$ srvctl status asm
ASM is running on cu-kvm2,cu-kvm1

=====================================

crsctl status res ora.LISTENER_SCAN1.lsnr
crsctl status res ora.scan1.vip
crsctl stop res ora.LISTENER_SCAN1.lsnr
crsctl stop res ora.scan1.vip -f
crsctl start res ora.LISTENER_SCAN1.lsnr
crsctl start res ora.scan1.vip
select * from v$database;
select * from v$instance;

crsctl stat res -t

scanip不能自动漂移,只能手动
有时需要将RAC上的一些资源切换到其他节点,采用srvctl relocate 命令即可完成,如切换SCAN-IP
srvctl status scan_listener
srvctl relocate scan_listener -i 1 -n rac02

srvctl stop listener
srvctl stop scan_listener
srvctl start listener
srvctl start scan_listener

启用SCAN 之后,会在数据库与客户端之间,添加了一层虚拟的服务层,就是SCAN IP和SCAN IP Listener,在客户端仅需要配置SCAN IP的tns信息,通过SCANIP Listener,连接后台集群数据库。这样,不论集群数据库是否有添加或者删除节点的操作,均不会对客户端产生影响,也就不需要修改配置。
配置SCAN有3种方法:
1. 使用/etc/hosts文件
这个是我们目前用的最多的方式,但是缺点只能对应一个SCAN IP,该方法Oracle 不推荐,但是简单,不需要单独的DNS 服务器,使用该方法,客户端还是需要VIP来链接。 Oracle 推荐使用其他的2种方法来实现SCAN 功能。
2. 在DNS中定义域名,只需要在DNS中配置即可实现SCAN 功能。

=====================================

Oracle 11G R2 RAC增加了scan ip功能,在11.2之前,client链接数据库的时候要用vip,假如你的cluster有4个节点,那么客户端的tnsnames.ora中就对应有四个主机vip的一个连接串,如果cluster增加了一个节点,那么对于每个连接数据库的客户端都需要修改这个tnsnames.ora。

引入了scan以后,就方便了客户端连接的一个接口,顾名思义 single client access name
,简单客户端连接名,这是一个唯一的名称,在整个公司网络内部唯一,并且在DNS中可以解析为三个ip地址,客户端连接的时候只需要知道这个名称,并连接即可,
每个SCAN VIP对应一个scan listener,cluster内部的service在每个scan listener上都有注册,scan
listener接受客户端的请求,并foward到不同的Local listener中去,还是由local
的listener提供服务给客户端。

scan只是一个名字,这个名字在DNS上解析成三个IP地址(VIP也是一个名字,也要配置一个ip地址阿)

无论cluster有多大(两个节点或者20个节点),都只有三个scan vip,在随机的节点上启动(如果是两个节点,可能三个vip在一个节点,也可能是1+2)

scan主要是简化客户端连接,你如果有20个节点,客户端连接的时候,是不是需要配置20个vip,如果用scan,只需要一个scan name就行了,剩下的事情,scan帮你做了。

至于为什么需要在dns里注册三个,主要是为了尽量提高可用性。
当节点数大于3时,最多也只会有3个SCAN listener,也就是说有的节点上没有scan listener.
如果使用/etc/hosts文件解析scan ip,因为不能做轮训的负载均衡,所以这时候scan ip就只能有一个了。

===============================

我们都知道Oracle RAC中每个节点都有一个虚拟IP,简称VIP,与公网IP在同一个网段。

没有VIP时,Oracle客户端是靠“TCP/IP协议栈超时”来判断服务器故障。而TCP/IP协议栈是作为OS Kernel的一部分来实现,不同的OS有不同的阀值,用户获悉数据库异常的时间完全取决于OS Kernel的实现,虽然有些OS允许修改这个阀值,但是会对其它程序产生未知影响。因此,oracle RAC引入了VIP,从而避开对TCP协议栈超时的依赖。

VIP和IP最主要的不同之处在于:VIP是浮动的,而IP是固定的。在所有节点都正常运行时,每个节点的VIP会被分配到public NIC上;在linux下ifconfig查看,public网卡上是2个IP地址;如果一个节点宕机,这个节点的VIP会被转移到还在运行的节点上。也就是幸存的节点的public NIC这个网卡上,会有3个IP地址。

当一个节点宕机,这个节点真实IP就连接不上了,但是这个节点的虚拟IP是可以连接的,他会自动把客户端的连接请求转接给存活的节点。
在tnsname.ora文件里,指定Address列表,客户端会随机选择一个节点来连接数据库,而不是顺序选择的。
    
VIP特点:
1 VIP是在clusterware安装最后阶段,通过脚本VIPCA创建的;
2 VIP作为一个Nodeapps类型的CRS Resource注册到OCR中,并由CRS维护状态;
3 VIP会绑定到节点的public 网卡上;那么public网卡就有两个地址了;
4 当某个节点发生故障时,CRS会把故障节点的VIP转移到其他节点上;
5 每个节点的Listener会同时在public网卡的public IP和VIP两个地址上监听;
6 客户端的tnsname.ora一般会配置指向节点的VIP;

从上面第6条可以引出一个问题。如果增加一个节点,那么客户端的tnsname.ora需要加入新增节点的VIP。那么想象一下:多个客户端,增加多个节点,那么维护起来特别麻烦。因此到了Oracle11gR2,引入了一个scan的概念。

scan,single client access
name。简单客户端连接名,这是一个唯一的名称,在整个公司网络内部唯一,并且在DNS中可以解析为三个ip地址,客户端连接的时候只需要知道这个名称,并连接即可,
每个SCAN VIP对应一个scan listener,cluster内部的service在每个scan listener上都有注册,scan
listener接受客户端的请求,并foward到不同的Local listener中去,还是由local
的listener提供服务给客户端。
   
    注意:scan不一定要resolve到三个ip,一个也够了。只不过为了防止scan单点故障而推荐3个。

=================================