你好,游客 登录 注册 搜索
背景:
阅读新闻

Linux下设置udev作为ASM磁盘

[日期:2016-08-09] 来源:  作者: [字体: ]
创建group与user:
groupadd -g 1000 oinstall
groupadd -g 1200 asmadmin
groupadd -g 1201 asmdba
groupadd -g 1202 asmoper
useradd -m -u 1100 -g oinstall -G asmadmin,asmdba,asmoper -d /home/grid -s /bin/bash -c "Grid Infrastructure Owner" grid
groupadd -g 1300 dba
groupadd -g 1301 oper
useradd -m -u 1101 -g oinstall -G dba,oper,asmdba -d /home/oracle -s /bin/bash -c "Oracle Software Owner" oracle


修改密码:
passwd grid
passwd oracle


#SuSe Linux Enterprise Server 11上的操作:
suse11:/dev/disk/by-id # pwd
/dev/disk/by-id
suse11:/dev/disk/by-id # ll
total 0
lrwxrwxrwx 1 root root  9 Oct 23  2013 ata-VBOX_HARDDISK_VB081b60b2-26464805 -> ../../sdd
lrwxrwxrwx 1 root root  9 Oct 23  2013 ata-VBOX_HARDDISK_VB4dbd04df-1838fa05 -> ../../sdb
lrwxrwxrwx 1 root root 10 Oct 23  2013 ata-VBOX_HARDDISK_VB4dbd04df-1838fa05-part1 -> ../../sdb1
lrwxrwxrwx 1 root root  9 Oct 23  2013 ata-VBOX_HARDDISK_VBaceeceaa-c8a6ef5b -> ../../sde
lrwxrwxrwx 1 root root  9 Oct 23  2013 ata-VBOX_HARDDISK_VBd89340ab-0bd3a2dd -> ../../sda
lrwxrwxrwx 1 root root 10 Oct 23  2013 ata-VBOX_HARDDISK_VBd89340ab-0bd3a2dd-part1 -> ../../sda1
lrwxrwxrwx 1 root root 10 Oct 23  2013 ata-VBOX_HARDDISK_VBd89340ab-0bd3a2dd-part2 -> ../../sda2
lrwxrwxrwx 1 root root 10 Oct 23  2013 ata-VBOX_HARDDISK_VBd89340ab-0bd3a2dd-part3 -> ../../sda3
lrwxrwxrwx 1 root root  9 Oct 23  2013 ata-VBOX_HARDDISK_VBd9259f18-98490123 -> ../../sdc
lrwxrwxrwx 1 root root 10 Oct 23  2013 ata-VBOX_HARDDISK_VBd9259f18-98490123-part1 -> ../../sdc1
lrwxrwxrwx 1 root root  9 Oct 23 03:38 edd-int13_dev80 -> ../../sda
lrwxrwxrwx 1 root root 10 Oct 23 03:38 edd-int13_dev80-part1 -> ../../sda1
lrwxrwxrwx 1 root root 10 Oct 23 03:38 edd-int13_dev80-part2 -> ../../sda2
lrwxrwxrwx 1 root root 10 Oct 23 03:38 edd-int13_dev80-part3 -> ../../sda3
lrwxrwxrwx 1 root root  9 Oct 23 03:38 edd-int13_dev81 -> ../../sdb
lrwxrwxrwx 1 root root 10 Oct 23 03:38 edd-int13_dev81-part1 -> ../../sdb1
lrwxrwxrwx 1 root root  9 Oct 23 03:38 edd-int13_dev82 -> ../../sdc
lrwxrwxrwx 1 root root 10 Oct 23 03:38 edd-int13_dev82-part1 -> ../../sdc1
lrwxrwxrwx 1 root root  9 Oct 23  2013 scsi-SATA_VBOX_HARDDISK_VB081b60b2-26464805 -> ../../sdd       ---------------注意这个设备
lrwxrwxrwx 1 root root  9 Oct 23  2013 scsi-SATA_VBOX_HARDDISK_VB4dbd04df-1838fa05 -> ../../sdb
lrwxrwxrwx 1 root root 10 Oct 23  2013 scsi-SATA_VBOX_HARDDISK_VB4dbd04df-1838fa05-part1 -> ../../sdb1
lrwxrwxrwx 1 root root  9 Oct 23  2013 scsi-SATA_VBOX_HARDDISK_VBaceeceaa-c8a6ef5b -> ../../sde---------------注意这个设备
lrwxrwxrwx 1 root root  9 Oct 23  2013 scsi-SATA_VBOX_HARDDISK_VBd89340ab-0bd3a2dd -> ../../sda
lrwxrwxrwx 1 root root 10 Oct 23  2013 scsi-SATA_VBOX_HARDDISK_VBd89340ab-0bd3a2dd-part1 -> ../../sda1
lrwxrwxrwx 1 root root 10 Oct 23  2013 scsi-SATA_VBOX_HARDDISK_VBd89340ab-0bd3a2dd-part2 -> ../../sda2
lrwxrwxrwx 1 root root 10 Oct 23  2013 scsi-SATA_VBOX_HARDDISK_VBd89340ab-0bd3a2dd-part3 -> ../../sda3
lrwxrwxrwx 1 root root  9 Oct 23  2013 scsi-SATA_VBOX_HARDDISK_VBd9259f18-98490123 -> ../../sdc
lrwxrwxrwx 1 root root 10 Oct 23  2013 scsi-SATA_VBOX_HARDDISK_VBd9259f18-98490123-part1 -> ../../sdc1
suse11:/dev/disk/by-id # /lib/udev/ata_id /dev/sdd
VBOX_HARDDISK_VB081b60b2-26464805
suse11:/dev/disk/by-id # /lib/udev/ata_id /dev/sde
VBOX_HARDDISK_VBaceeceaa-c8a6ef5b
suse11:/dev/disk/by-id # /lib/udev/scsi_id -g -u -d /dev/add
SATA_VBOX_HARDDISK_VB081b60b2-26464805
suse11:/dev/disk/by-id # /lib/udev/scsi_id -g -u -d /dev/sde
SATA_VBOX_HARDDISK_VBaceeceaa-c8a6ef5b


编辑/etc/udev/rules.d/99-oracle-asmdevices.rules文件,加入如下内容:
# /bin/cat /etc/udev/rules.d/99-oracle-asmdevices.rules
KERNEL=="sd*",BUS=="scsi",ENV{ID_SERIAL}=="SATA_VBOX_HARDDISK_VB081b60b2-26464805", NAME="asmdisk1", OWNER="grid", GROUP="asmadmin", MODE="0660"
KERNEL=="sd*",BUS=="scsi",ENV{ID_SERIAL}=="SATA_VBOX_HARDDISK_VBaceeceaa-c8a6ef5b", NAME="asmdisk2", OWNER="grid", GROUP="asmadmin", MODE="0660"


#Redhat Enterprise Linux 6.4上的操作:
[root@rh601 by-id]# pwd
/dev/disk/by-id
[root@rh601 by-id]# ll
total 0
lrwxrwxrwx. 1 root root  9 Dec 15 14:41 ata-VBOX_HARDDISK_VB07fbdbc7-a8414329 -> ../../sdb
lrwxrwxrwx. 1 root root  9 Dec 15 12:51 ata-VBOX_HARDDISK_VB24b570a9-ad3e8146 -> ../../sda
lrwxrwxrwx. 1 root root 10 Dec 15 12:51 ata-VBOX_HARDDISK_VB24b570a9-ad3e8146-part1 -> ../../sda1
lrwxrwxrwx. 1 root root 10 Dec 15 12:51 ata-VBOX_HARDDISK_VB24b570a9-ad3e8146-part2 -> ../../sda2
lrwxrwxrwx. 1 root root 10 Dec 15 12:51 ata-VBOX_HARDDISK_VB24b570a9-ad3e8146-part3 -> ../../sda3
lrwxrwxrwx. 1 root root  9 Dec 15 14:41 ata-VBOX_HARDDISK_VB253cd409-8587c441 -> ../../sdc
lrwxrwxrwx. 1 root root  9 Dec 15 14:41 scsi-SATA_VBOX_HARDDISK_VB07fbdbc7-a8414329 -> ../../sdb
lrwxrwxrwx. 1 root root  9 Dec 15 12:51 scsi-SATA_VBOX_HARDDISK_VB24b570a9-ad3e8146 -> ../../sda
lrwxrwxrwx. 1 root root 10 Dec 15 12:51 scsi-SATA_VBOX_HARDDISK_VB24b570a9-ad3e8146-part1 -> ../../sda1
lrwxrwxrwx. 1 root root 10 Dec 15 12:51 scsi-SATA_VBOX_HARDDISK_VB24b570a9-ad3e8146-part2 -> ../../sda2
lrwxrwxrwx. 1 root root 10 Dec 15 12:51 scsi-SATA_VBOX_HARDDISK_VB24b570a9-ad3e8146-part3 -> ../../sda3
lrwxrwxrwx. 1 root root  9 Dec 15 14:41 scsi-SATA_VBOX_HARDDISK_VB253cd409-8587c441 -> ../../sdc
[root@rh601 by-id]# scsi_id -g -u -d /dev/sdb
1ATA_VBOX_HARDDISK_VB07fbdbc7-a8414329
[root@rh601 by-id]# scsi_id -g -u -d /dev/sdc
1ATA_VBOX_HARDDISK_VB253cd409-8587c441
DISK ID的另外一种查看方式:
[root@rh601 by-id]# scsi_id --whitelisted --replace-whitespace --device=/dev/sdb
1ATA_VBOX_HARDDISK_VB07fbdbc7-a8414329
[root@rh601 by-id]# scsi_id --whitelisted --replace-whitespace --device=/dev/sdc
1ATA_VBOX_HARDDISK_VB253cd409-8587c441
命令显示的disk id与/dev/disk/by-id/下看到id有点不太一样,一个是SATA,另一个是1ATA。
下面的配置文件中,不能使用SATA,仅1ATA能生效。
# cd /etc/udev/rules.d/
# cat 99-oracle-asmdevices.rules
KERNEL=="sd*", SUBSYSTEM=="block", PROGRAM=="/sbin/scsi_id -g -u -d /dev/$name", RESULT=="1ATA_VBOX_HARDDISK_VB07fbdbc7-a8414329", NAME="asmdisk1", OWNER="grid", GROUP="asmadmin", MODE="0660"
KERNEL=="sd*", SUBSYSTEM=="block", PROGRAM=="/sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/$name", RESULT=="1ATA_VBOX_HARDDISK_VB253cd409-8587c441", NAME="asmdisk2", OWNER="grid", GROUP="asmadmin", MODE="0660"


上面使用2种命令混合方式分别得出2个磁盘的disk id。
也可以使用下面的配置:
KERNEL=="sd*",BUS=="scsi",ENV{ID_SERIAL}=="VBOX_HARDDISK_VB07fbdbc7-a8414329", NAME="asmdisk1", OWNER="grid", GROUP="asmadmin", MODE="0660"
KERNEL=="sd*",BUS=="scsi",ENV{ID_SERIAL}=="VBOX_HARDDISK_VB253cd409-8587c441", NAME="asmdisk2", OWNER="grid", GROUP="asmadmin", MODE="0660"
但奇怪的是,这个设置生效之后,fdisk -l找不到/dev/sdb,/dev/sdc了。
也许是磁盘头发生了变化,连fdisk都看不到了?


Suse Linux重启udev的操作方法如下:
suse11:~ # /etc/init.d/boot.udev stop
Stopping udevd:                                                                                                                    done
suse11:~ # /etc/init.d/boot.udev start
Starting udevd:                                                                                                                    done
Loading drivers, configuring devices:                                                                                              done
suse11:~ # ls /dev/asm*
/dev/asmdisk1  /dev/asmdisk2


RHEL5重启udev的操作方法如下:
/sbin/udevcontrol reload_rules
/sbin/start_udev


RHEL6重启udev的操作方法如下:
/sbin/start_udev


重启完udev之后就可以在/dev下看到asmdisk1与asmdisk2这2个设备了!


创建安装目录并授权:
mkdir -p /u01/app/grid/
mkdir -p /u01/app/11.2.0/grid
chown grid:oinstall /u01/app/grid/11.2.0
chown grid:oinstall /u01/app/11.2.0/grid


设置grid环境变量:
export ORACLE_BASE=/u01/app/grid
export ORACLE_HOME=/u01/app/11.2.0/grid
export ORACLE_SID=+ASM
export PATH=$ORACLE_HOME/bin:$PATH


开始安装之前会弹出一个警告:
[INS-32018] The selected Oracle home is outside of Oracle base.
Are you sure you want to continue ?


Cause?-?The Oracle home selected was outside of Oracle base.  
Action?-?Oracle recommends installing Oracle software within the Oracle base directory. Adjust the Oracle home or Oracle base accordingly. 
这个是说建议ORACLE_HOME要位于ORACLE_BASE底下,不用理会。


安装grid过程中报错:
java.lang.Exception: An ASM Instance with SID +ASM is already detected
原因:这是重新安装,删除/etc/oratab即可。


安装过程会创建asm diskgroup,如果找不到udev设备,可以对磁盘头进行抹除:
dd if=/dev/zero of=/dev/asmdisk1 bs=16384 count=200
##############################################
Oracle 11gR2 RAC ohasd failed to start 解决方法
 
CRS-4124: Oracle High Availability Services startup failed.
CRS-4000: Command Start failed, or completed with errors.
ohasd failed to start: Inappropriate ioctl for device
ohasd failed to start at/u01/app/11.2.0/grid/crs/install/rootcrs.pl line 443.
就是在执行root.sh之前执行以下命令
/bin/dd if=/var/tmp/.oracle/npohasd of=/dev/null bs=1024 count=1
如果出现
/bin/dd: opening`/var/tmp/.oracle/npohasd': No such file or directory
的时候文件还没生成就继续执行,直到能执行为止,一般出现Adding daemon to inittab这条信息的时候执行dd命令。
另外还有一种解决方法就是更改文件权限
chown root:oinstall /var/tmp/.oracle/npohasd
重新执行root.sh之前别忘了删除配置:/u01/app/11.2.0/grid/crs/install/roothas.pl -deconfig -force -verbose
参考:
https://cn.forums.oracle.com/forums/thread.jspa?threadID=2350285
http://blog.csdn.net/tianlesoftware/article/details/8207629
##############################################
grid安装到最后提示运行root.sh时出错:
suse11:~ # /opt/grid/app/11gR2/grid/root.sh
Running Oracle 11g root.sh script...
……………………
……………………
/opt/grid/app/11gR2/grid/bin/clscfg.bin: error while loading shared libraries: libcap.so.1: cannot open shared object file: No such file or directory
Failed to create keys in the OLR, rc = 32512, 32512
OLR configuration failed
原因:
1)没有安装相关包,装上即可:yum info compat-libcap1
2)操作系统太新,找不到 libcap.so.1文件,从新版本链接一个即可:
suse11:~ # cd /lib
suse11:/lib # ll libcap*
lrwxrwxrwx 1 root root    14 Oct 29  2012 libcap.so.2 -> libcap.so.2.11
-rwxr-xr-x 1 root root 18076 Feb 21  2009 libcap.so.2.11
suse11:/lib # ln -s libcap.so.2.11 libcap.so.1
suse11:/lib # ll libcap*
lrwxrwxrwx 1 root root    14 Oct 23 08:49 libcap.so.1 -> libcap.so.2.11
lrwxrwxrwx 1 root root    14 Oct 29  2012 libcap.so.2 -> libcap.so.2.11
-rwxr-xr-x 1 root root 18076 Feb 21  2009 libcap.so.2.11
先删除cluster配置:
suse11:/lib # /opt/grid/app/11gR2/grid/crs/install/rootcrs.pl -deconfig -force
然后重新运行root.sh脚本:
suse11:/lib # /opt/grid/app/11gR2/grid/root.sh
Running Oracle 11g root.sh script...
……………………
……………………
Successfully configured Oracle Grid Infrastructure for a Standalone Server
Updating inventory properties for clusterware
Starting Oracle Universal Installer...
Checking swap space: must be greater than 500 MB.   Actual 3067 MB    Passed
The inventory pointer is located at /etc/oraInst.loc
The inventory is located at /opt/oracle/oraInventory
'UpdateNodeList' was successful.


dbca建库的时候找不到asm diskgroup,那么需要修改一个权限:
[root@rh01 ~]# su - grid
[grid@rh01 ~]$ cd $ORACLE_HOME/bin
[grid@rh01 bin]$ ll oracle
-rwxrwxr-x 1 grid oinstall 184286237 Jul  6 14:47 oracle
[grid@rh01 bin]$ chmod +s oracle
[grid@rh01 bin]$ ll oracle
-rwsrwsr-x 1 grid oinstall 184286237 Jul  6 14:47 oracle


oracle用户环境变量:
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0
export ORA_CRS_HOME=/u01/app/11.2.0/grid--------这个路径应该是grid用户的ORACLE_HOME
export ORACLE_SID=test
export NLS_LANG=american_america.zhs16gbk
export PATH=$ORA_CRS_HOME/bin:$ORACLE_HOME/bin:$PATH:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin


dbca的时候,oracle用户会去执行grid用户下的sqlplus,oracle,srvctl等命令。


dbca一开始如果遇到错误:
ORA-19624, ORA-19870, ORA-19504, ORA-15045, ORA-17502, ORA-15081, ORA-06512
或者从文件系统迁移到asm之前测试创建表空间时遇到如下错误:
SQL> create tablespace test datafile '+dg01' size 100m;
create tablespace test datafile '+dg01' size 100m
*
ERROR at line 1:
ORA-01119: error in creating database file '+dg01'
ORA-17502: ksfdcre:4 Failed to create file +dg01
ORA-15001: diskgroup "DG01" does not exist or is not mounted
ORA-15040: diskgroup is incomplete
ORA-15040: diskgroup is incomplete
检查diskgroup的状态正常。
SQL> select name,state from v$asm_diskgroup;


NAME                           STATE
------------------------------ -----------
DG01                           MOUNTED
关闭数据库:
SQL> shutdown immediate
SQL> exit
原因:
oracle没有访问asm磁盘的权限,请检查asm磁盘权限:
[root@rh01 ~]# ll /dev/asm*
brw-rw---- 1 grid asmadmin 8, 64 Jul  6 19:34 /dev/asmdisk1
brw-rw---- 1 grid asmadmin 8, 48 Jul  6 19:34 /dev/asmdisk2
上面udev设备的权限设置正确。
进入rdbms的ORACLE_HOME/bin目录:
# cd /u01/app/oracle/product/11.2.0/dbhome_1/bin/
检查oracle这个可执行文件的权限:
# ll oracle
-rwsr-s--x 1 oracle oinstall 226890086 Oct 20 13:00 oracle
由于对udev有权限读写的user与group分别是grid与asmadmin
而oracle用户并不在asmadmin组里,所以没有权限读取diskgroup。
但是可以修改可执行文件oracle的特殊权限。
# chown oracle:asmadmin oracle
# ll oracle
-rwxr-x--x 1 oracle asmadmin 226890086 Oct 20 13:00 oracle
# chmod +s oracle
# ll oracle
-rwsr-s--x 1 oracle asmadmin 226890086 Oct 20 13:00 oracle
然后启动数据库,可以在diskgroup上创建datafile了!


dbca中途遇到如下错误:
CRS-2566:User 'oracle' does not have sufficient permissions to operate on resource 'ora.DATA.dg', which is part of the dependency specification.
CRS-0222: Resource 'ora.test.db' has dependency error.
PRCR-1006 : Failed to add resource ora.test.db for null
PRCR-1071 : Failed to register or update resource ora.test.db
CRS-2566: User 'oracle' does not have sufficient permissions to operate on resource 'ora.DATA.dg', which is part of the dependency specification.
原因:
没有把$ORA_CRS_HOME/bin加到$PATH的最前面,因为注册数据库到grid时,需要调用
$ORA_CRS_HOME/bin下的srvctl命令,而不是$ORACLE_HOME/bin下的srvctl命令!其调用命令如下:
srvctl add database -d test -o /opt/oracle/product/11.2.0




#手工注册时遇到的问题与解决办法:
$ srvctl add database -d test -o /u01/app/oracle/product/11.2.0/db_1
英文提示:
PRCR-1006 : Failed to add resource ora.test.db for null
PRCR-1071 : Failed to register or update resource ora.test.db
CRS-0259: Owner of the resource does not belong to the group.
中文提示:
PRCR-1006 : 无法添加 null 的资源 ora.test.db
PRCR-1071 : 无法注册或更新 资源 ora.test.db
CRS-0259: Owner of the resource does not belong to the group.


解决办法:
1- First Deconfig Oracle Restart: As a root user:
# /u01/app/11.2.0/grid/perl/bin/perl -I /u01/app/11.2.0/grid/perl/lib/ -I /u01/app/11.2.0/grid/crs/install/ /u01/app/11.2.0/grid/crs/install/roothas.pl -deconfig
Using configuration parameter file: /a01/11.2.0/grid/crs/install/crsconfig_params
PRKO-2573 : ONS daemon is already stopped.
CRS-2500: Cannot stop resource 'ora.cssd' as it is not running
CRS-4000: Command Stop failed, or completed with errors.
CRS-2791: Starting shutdown of Oracle High Availability Services-managed resources on 'dbt05'
CRS-2673: Attempting to stop 'ora.evmd' on 'dbt05'
CRS-2677: Stop of 'ora.evmd' on 'dbt05' succeeded
CRS-2793: Shutdown of Oracle High Availability Services-managed resources on 'dbt05' has completed
CRS-4133: Oracle High Availability Services has been stopped.
ACFS-9200: Supported
Successfully deconfigured Oracle Restart stack


2- Config again Oracle Restart:
# /u01/app/11.2.0/grid/perl/bin/perl -I /u01/app/11.2.0/grid/perl/lib/ -I /u01/app/11.2.0/grid/crs/install/ /u01/app/11.2.0/grid/crs/install/roothas.pl
# /u01/app/11.2.0/grid/perl/bin/perl -I /u01/app/11.2.0/grid/perl/lib -I/u01/app/11.2.0/grid/crs/install  /u01/app/11.2.0/grid/crs/install/roothas.pl
Using configuration parameter file: /a01/11.2.0/grid/crs/install/crsconfig_params
LOCAL ADD MODE
Creating OCR keys for user 'grid', privgrp 'oinstall'..
Operation successful.
LOCAL ONLY MODE
Successfully accumulated necessary OCR keys.
Creating OCR keys for user 'root', privgrp 'root'..
Operation successful.
CRS-4664: Node dbt05 successfully pinned.
Adding daemon to inittab
ACFS-9300: ADVM/ACFS distribution files found.
ACFS-9307: Installing requested ADVM/ACFS software.
ACFS-9308: Loading installed ADVM/ACFS drivers.
ACFS-9321: Creating udev for ADVM/ACFS.
ACFS-9323: Creating module dependencies - this may take some time.
ACFS-9327: Verifying ADVM/ACFS devices.
ACFS-9309: ADVM/ACFS installation correctness verified.


dbt05     2011/06/22 13:12:00     /a01/11.2.0/grid/cdata/dbt05/backup_20110622_131200.olr
Successfully configured Oracle Grid Infrastructure for a Standalone Server


3- Add the database to Oracle restart configuration:
-bash-3.2$ id
uid=502(oracle) gid=501(oinstall) groups=501(oinstall),502(dba),506(asmdba)
-bash-3.2$ srvctl add database -d db01 -o /u01/app/oracle/product/11.2.0/db_1


以下是我自己的测试过程:
[grid@rh01 ~]$ crs_stat -t
Name           Type           Target    State     Host        
------------------------------------------------------------
ora.DATA.dg    ora....up.type ONLINE    ONLINE    rh01        
ora....ER.lsnr ora....er.type ONLINE    UNKNOWN   rh01        
ora.asm        ora.asm.type   ONLINE    ONLINE    rh01        
ora.cssd       ora.cssd.type  ONLINE    ONLINE    rh01        
ora.diskmon    ora....on.type ONLINE    ONLINE    rh01        
ora.test.db    ora....se.type OFFLINE   OFFLINE              
[grid@rh01 ~]$ 
[grid@rh01 ~]$ exit
[root@rh01 ~]# 
[root@rh01 ~]# /u01/app/11.2.0/grid/perl/bin/perl -I /u01/app/11.2.0/grid/perl/lib/ -I /u01/app/11.2.0/grid/crs/install/ /u01/app/11.2.0/grid/crs/install/roothas.pl -deconfig
2014-07-07 11:14:43: Checking for super user privileges
2014-07-07 11:14:43: User has super user privileges
2014-07-07 11:14:43: Parsing the host name
Using configuration parameter file: /u01/app/11.2.0/grid/crs/install/crsconfig_params
CRS resources for listeners are still configured
CRS-2529: Unable to act on 'ora.cssd' because that would require stopping or relocating 'ora.asm', but the force option was not specified
CRS-4000: Command Stop failed, or completed with errors.
CRS-2586: Deletion of a running resource 'ora.cssd' requires the force option
CRS-4000: Command Delete failed, or completed with errors.
CRS-2791: Starting shutdown of Oracle High Availability Services-managed resources on 'rh01'
CRS-2673: Attempting to stop 'ora.DATA.dg' on 'rh01'
CRS-2677: Stop of 'ora.DATA.dg' on 'rh01' succeeded
CRS-2673: Attempting to stop 'ora.asm' on 'rh01'
CRS-2677: Stop of 'ora.asm' on 'rh01' succeeded
CRS-2673: Attempting to stop 'ora.cssd' on 'rh01'
CRS-2677: Stop of 'ora.cssd' on 'rh01' succeeded
CRS-2673: Attempting to stop 'ora.diskmon' on 'rh01'
CRS-2677: Stop of 'ora.diskmon' on 'rh01' succeeded
CRS-2793: Shutdown of Oracle High Availability Services-managed resources on 'rh01' has completed
CRS-4133: Oracle High Availability Services has been stopped.
ACFS-9200: Supported
Successfully deconfigured Oracle Restart stack
[root@rh01 ~]# su - grid
[grid@rh01 ~]$ crs_stat -t
CRS-0184: Cannot communicate with the CRS daemon.


[grid@rh01 ~]$ su
Password: 
[root@rh01 grid]# crsctl check has
CRS-4047: No Oracle Clusterware components configured.
CRS-4000: Command Check failed, or completed with errors.
[root@rh01 grid]# crsctl start has
CRS-4047: No Oracle Clusterware components configured.
CRS-4000: Command Start failed, or completed with errors.
[root@rh01 grid]# exit
exit
[grid@rh01 ~]$ exit
logout
[root@rh01 ~]# /u01/app/11.2.0/grid/perl/bin/perl -I /u01/app/11.2.0/grid/perl/lib/ -I /u01/app/11.2.0/grid/crs/install/ /u01/app/11.2.0/grid/crs/install/roothas.pl
2014-07-07 11:18:31: Checking for super user privileges
2014-07-07 11:18:31: User has super user privileges
2014-07-07 11:18:31: Parsing the host name
Using configuration parameter file: /u01/app/11.2.0/grid/crs/install/crsconfig_params
LOCAL ADD MODE 
Creating OCR keys for user 'grid', privgrp 'oinstall'..
Operation successful.
CRS-4664: Node rh01 successfully pinned.
Adding daemon to inittab
CRS-4123: Oracle High Availability Services has been started.
ohasd is starting


rh01     2014/07/07 11:18:58     /u01/app/11.2.0/grid/cdata/rh01/backup_20140707_111858.olr
Successfully configured Oracle Grid Infrastructure for a Standalone Server
[root@rh01 ~]# su - grid
[grid@rh01 ~]$ crs_stat -t
Name           Type           Target    State     Host        
------------------------------------------------------------
ora.cssd       ora.cssd.type  OFFLINE   OFFLINE              
ora.diskmon    ora....on.type OFFLINE   OFFLINE  
#重新配置之后,只剩上面2个了,接下来把其他resource都一一添加进来。
[grid@rh01 ~]$ crs_start -all
Attempting to stop `ora.diskmon` on member `rh01`
Attempting to start `ora.cssd` on member `rh01`
Stop of `ora.diskmon` on member `rh01` succeeded.
Attempting to start `ora.diskmon` on member `rh01`
Start of `ora.diskmon` on member `rh01` succeeded.
Start of `ora.cssd` on member `rh01` succeeded.
[grid@rh01 ~]$ crs_stat -t
Name           Type           Target    State     Host        
------------------------------------------------------------
ora.cssd       ora.cssd.type  ONLINE    ONLINE    rh01        
ora.diskmon    ora....on.type ONLINE    ONLINE    rh01        


[grid@rh01 ~]$ cd $ORACLE_HOME/dbs 
[grid@rh01 dbs]$ more init+ASM.ora 
#spfile='+DATA/asm/asmparameterfile/registry.253.852217697'
large_pool_size=12M
instance_type="asm"
remote_login_passwordfile="EXCLUSIVE"
asm_diskgroups="DATA"
asm_diskstring="/dev/asm*"
asm_power_limit=1
diagnostic_dest="/u01/app/grid"
[grid@rh01 dbs]$ 


[grid@rh01 admin]$ srvctl add asm -l LISTENER -p $ORACLE_HOME/dbs/init+ASM.ora -d '/dev/asm*'
PRCR-1001 : Resource ora.LISTENER.lsnr does not exist
[grid@rh01 admin]$ 
[grid@rh01 admin]$ srvctl add asm -p $ORACLE_HOME/dbs/init+ASM.ora -d '/dev/asm*'
[grid@rh01 admin]$ crs_stat -t
Name           Type           Target    State     Host        
------------------------------------------------------------
ora.asm        ora.asm.type   OFFLINE   OFFLINE              
ora.cssd       ora.cssd.type  ONLINE    ONLINE    rh01        
ora.diskmon    ora....on.type ONLINE    ONLINE    rh01        
[grid@rh01 admin]$ sqlplus / as sysasm


SQL*Plus: Release 11.2.0.1.0 Production on Mon Jul 7 22:39:55 2014


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




Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Automatic Storage Management option


SQL> shutdown immediate
ASM diskgroups dismounted
ASM instance shutdown
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Automatic Storage Management option
[grid@rh01 admin]$ srvctl start asm
[grid@rh01 admin]$ crs_stat -t
Name           Type           Target    State     Host        
------------------------------------------------------------
ora.DATA.dg    ora....up.type ONLINE    ONLINE    rh01        
ora.asm        ora.asm.type   ONLINE    ONLINE    rh01        
ora.cssd       ora.cssd.type  ONLINE    ONLINE    rh01        
ora.diskmon    ora....on.type ONLINE    ONLINE    rh01  


[grid@rh01 admin]$ lsnrctl stop


LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 07-JUL-2014 22:42:45


Copyright (c) 1991, 2009, Oracle.  All rights reserved.


Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
The command completed successfully
[grid@rh01 admin]$ 
[grid@rh01 admin]$ srvctl add listener -l LISTENER -o $ORACLE_HOME
[grid@rh01 admin]$ crs_stat -t
Name           Type           Target    State     Host        
------------------------------------------------------------
ora.DATA.dg    ora....up.type ONLINE    ONLINE    rh01        
ora....ER.lsnr ora....er.type OFFLINE   OFFLINE              
ora.asm        ora.asm.type   ONLINE    ONLINE    rh01        
ora.cssd       ora.cssd.type  ONLINE    ONLINE    rh01        
ora.diskmon    ora....on.type ONLINE    ONLINE    rh01        
[grid@rh01 admin]$ srvctl start listener
[grid@rh01 admin]$ lsnrctl status


LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 07-JUL-2014 22:43:25


Copyright (c) 1991, 2009, Oracle.  All rights reserved.


Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 11.2.0.1.0 - Production
Start Date                07-JUL-2014 22:43:21
Uptime                    0 days 0 hr. 0 min. 3 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /u01/app/11.2.0/grid/network/admin/listener.ora
Listener Log File         /u01/app/grid/diag/tnslsnr/rh01/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=rh01.victor.com)(PORT=1521)))
The listener supports no services
The command completed successfully


[grid@rh01 admin]$ su - oracle
Password: 
[oracle@rh01 ~]$ 
[oracle@rh01 ~]$ srvctl add database -d test -o $ORACLE_HOME
[oracle@rh01 ~]$ crs_stat -t
Name           Type           Target    State     Host        
------------------------------------------------------------
ora.DATA.dg    ora....up.type ONLINE    ONLINE    rh01        
ora....ER.lsnr ora....er.type ONLINE    ONLINE    rh01        
ora.asm        ora.asm.type   ONLINE    ONLINE    rh01        
ora.cssd       ora.cssd.type  ONLINE    ONLINE    rh01        
ora.diskmon    ora....on.type ONLINE    ONLINE    rh01        
ora.test.db    ora....se.type OFFLINE   OFFLINE              
[oracle@rh01 ~]$ srvctl start database -d test
[oracle@rh01 ~]$ crs_stat -t                  
Name           Type           Target    State     Host        
------------------------------------------------------------
ora.DATA.dg    ora....up.type ONLINE    ONLINE    rh01        
ora....ER.lsnr ora....er.type ONLINE    ONLINE    rh01        
ora.asm        ora.asm.type   ONLINE    ONLINE    rh01        
ora.cssd       ora.cssd.type  ONLINE    ONLINE    rh01        
ora.diskmon    ora....on.type ONLINE    ONLINE    rh01        
ora.test.db    ora....se.type ONLINE    ONLINE    rh01 


大功告成!!


常用的srvctl命令:
关闭HAS:
[grid@rh01 ~]$ su
[root@rh01 grid]# crsctl stop has
CRS-2791: Starting shutdown of Oracle High Availability Services-managed resources on 'rh01'
CRS-2673: Attempting to stop 'ora.LISTENER.lsnr' on 'rh01'
CRS-2673: Attempting to stop 'ora.test.db' on 'rh01'
CRS-2677: Stop of 'ora.LISTENER.lsnr' on 'rh01' succeeded
CRS-2677: Stop of 'ora.test.db' on 'rh01' succeeded
CRS-2673: Attempting to stop 'ora.DATA.dg' on 'rh01'
CRS-2677: Stop of 'ora.DATA.dg' on 'rh01' succeeded
CRS-2673: Attempting to stop 'ora.asm' on 'rh01'
CRS-2677: Stop of 'ora.asm' on 'rh01' succeeded
CRS-2673: Attempting to stop 'ora.cssd' on 'rh01'
CRS-2677: Stop of 'ora.cssd' on 'rh01' succeeded
CRS-2673: Attempting to stop 'ora.diskmon' on 'rh01'
CRS-2677: Stop of 'ora.diskmon' on 'rh01' succeeded
CRS-2793: Shutdown of Oracle High Availability Services-managed resources on 'rh01' has completed
CRS-4133: Oracle High Availability Services has been stopped.


[root@rh01 grid]# 
[root@rh01 grid]# crsctl start crs
CRS-4013: This command is not supported in a single-node configuration.
CRS-4000: Command Start failed, or completed with errors.
[root@rh01 grid]# crsctl start has
CRS-4123: Oracle High Availability Services has been started.


[grid@rh01 ~]$ crsctl query has releaseversion
Oracle High Availability Services release version on the local node is [11.2.0.1.0]


[grid@rh01 ~]$ crsctl stat res -t
--------------------------------------------------------------------------------
NAME           TARGET  STATE        SERVER                   STATE_DETAILS      
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.cssd
      1        OFFLINE OFFLINE                                                  
ora.diskmon
      1        OFFLINE OFFLINE  


[grid@rh01 ~]$ crsctl stat res -t -init 
--------------------------------------------------------------------------------
NAME           TARGET  STATE        SERVER                   STATE_DETAILS      
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.cssd
      1        OFFLINE OFFLINE                                                  
ora.diskmon
      1        OFFLINE OFFLINE  


[grid@rh01 ~]$ crsctl stat res ora.cssd
NAME=ora.cssd
TYPE=ora.cssd.type
TARGET=OFFLINE
STATE=OFFLINE


[grid@rh01 ~]$ crsctl stat res ora.diskmon
NAME=ora.diskmon
TYPE=ora.diskmon.type
TARGET=OFFLINE
STATE=OFFLINE


crsctl modify res ora.asm -attr AUTO_START=never
crsctl stat res ora.asm -p
crsctl status resource  -init -t|grep -v ONLINE|tail -13
crsctl status resource  -init -t|grep -v ONLINE|tail -13|xargs crsctl status resource


[grid@rh01 ~]$ crsctl status res ora.cssd -init -p 
NAME=ora.cssd
TYPE=ora.cssd.type
ACL=owner:grid:rwx,pgrp:asmadmin:rwx,other::r--
ACTION_FAILURE_TEMPLATE=
ACTION_SCRIPT=
ACTIVE_PLACEMENT=0
AGENT_FILENAME=%CRS_HOME%/bin/cssdagent%CRS_EXE_SUFFIX%
AGENT_HB_INTERVAL=0
AGENT_HB_MISCOUNT=10
AUTO_START=never
CARDINALITY=1
CHECK_ARGS=
CHECK_COMMAND=
CHECK_INTERVAL=30
CLEAN_ARGS=abort
CLEAN_COMMAND=
CSSD_MODE=
CSSD_PATH=%CRS_HOME%/bin/ocssd%CRS_EXE_SUFFIX%
CSS_USER=grid
DAEMON_LOGGING_LEVELS=
DAEMON_TRACING_LEVELS=
DEFAULT_TEMPLATE=
DEGREE=1
DESCRIPTION="Resource type for CSSD"
DETACHED=true
ENABLED=1
ENV_OPTS=
FAILOVER_DELAY=0
FAILURE_INTERVAL=3
FAILURE_THRESHOLD=5
HOSTING_MEMBERS=
LOAD=1
LOGGING_LEVEL=1
NOT_RESTARTING_TEMPLATE=
OFFLINE_CHECK_INTERVAL=0
OMON_INITRATE=1000
OMON_POLLRATE=500
ORA_OPROCD_MODE=
ORA_VERSION=11.2.0.1.0
PID_FILE=
PLACEMENT=balanced
PROCD_TIMEOUT=1000
PROCESS_TO_MONITOR=
PROFILE_CHANGE_TEMPLATE=
RESTART_ATTEMPTS=5
SCRIPT_TIMEOUT=600
SERVER_POOLS=
START_ARGS=
START_COMMAND=
START_DEPENDENCIES=weak(concurrent:ora.diskmon)
START_TIMEOUT=600
STATE_CHANGE_TEMPLATE=
STOP_ARGS=
STOP_COMMAND=
STOP_DEPENDENCIES=hard(shutdown:ora.diskmon)
STOP_TIMEOUT=900
UPTIME_THRESHOLD=1m
USR_ORA_ENV=
VMON_INITLIMIT=16
VMON_INITRATE=500
VMON_POLLRATE=500




[grid@rh01 ~]$ crsctl status res ora.diskmon -p -init
NAME=ora.diskmon
TYPE=ora.diskmon.type
ACL=owner:grid:rwx,pgrp:asmadmin:rwx,other::r--
ACTION_FAILURE_TEMPLATE=
ACTION_SCRIPT=
ACTIVE_PLACEMENT=0
AGENT_FILENAME=%CRS_HOME%/bin/orarootagent%CRS_EXE_SUFFIX%
AUTO_START=never
CARDINALITY=1
CHECK_ARGS=
CHECK_COMMAND=
CHECK_INTERVAL=20
CHECK_TIMEOUT=10
CLEAN_ARGS=
CLEAN_COMMAND=
DAEMON_LOGGING_LEVELS=
DAEMON_TRACING_LEVELS=
DEFAULT_TEMPLATE=
DEGREE=1
DESCRIPTION="Resource type for Diskmon"
DETACHED=true
ENABLED=1
FAILOVER_DELAY=0
FAILURE_INTERVAL=3
FAILURE_THRESHOLD=5
HOSTING_MEMBERS=
LOAD=1
LOGGING_LEVEL=1
NOT_RESTARTING_TEMPLATE=
OFFLINE_CHECK_INTERVAL=0
ORA_VERSION=11.2.0.1.0
PID_FILE=
PLACEMENT=balanced
PROCESS_TO_MONITOR=
PROFILE_CHANGE_TEMPLATE=
RESTART_ATTEMPTS=10
SCRIPT_TIMEOUT=60
SERVER_POOLS=
START_ARGS=
START_COMMAND=
START_DEPENDENCIES=weak(concurrent:ora.cssd)pullup:always(ora.cssd)
START_TIMEOUT=60
STATE_CHANGE_TEMPLATE=
STOP_ARGS=
STOP_COMMAND=
STOP_DEPENDENCIES=
STOP_TIMEOUT=60
UPTIME_THRESHOLD=5s
USR_ORA_ENV=ORACLE_USER=grid
VERSION=11.2.0.1.0


/* 修改某些资源的属性要求root权限 */
[grid@rh01 ~]$ crsctl modify res ora.crsd -init -attr "SCRIPT_TIMEOUT"=65  
CRS-0245:  User doesn't have enough privilege to perform the operation
CRS-4000: Command Modify failed, or completed with errors.
[grid@rh01 ~]$ su
Password: 
[root@rh01 grid]#
[root@rh01 grid]# crsctl modify res ora.crsd -init -attr "SCRIPT_TIMEOUT"=65 


下面3个命令仅在RAC环境使用:
crsctl check cluster
crsctl start cluster
crsctl stop cluster


[grid@rh01 dbs]$ crsctl stop cluster
CRS-4013: This command is not supported in a single-node configuration.
CRS-4000: Command Stop failed, or completed with errors.
收藏 推荐 打印 | 阅读:
本文评论   查看全部评论 (0)
表情: 表情 姓名: 字数
点评:
       
评论声明
  • 尊重网上道德,遵守中华人民共和国的各项有关法律法规
  • 承担一切因您的行为而直接或间接导致的民事或刑事法律责任
  • 本站管理人员有权保留或删除其管辖留言中的任意内容
  • 本站有权在网站内转载或引用您的评论
  • 参与本评论即表明您已经阅读并接受上述条款
热门评论