概述
https://www.cndba.cn/dave/article/240
在上篇中我们看了12c中创建单实例ASM 环境的方法:
Oracle 12c 中 基于ASM 的单实例 搭建手册
文章里采用的是asmca来创建的ASM 实例。 我们这里来看下不使用ASMCA,而是手工来创建ASM 实例的方法。
他们的区别是用asmca的情况下,ASM 实例的spfile 必须存放在磁盘组。 手工创建的ASM 实例更灵活,我们直接放本地进行操作。
https://www.cndba.cn/dave/article/240
1安装GRID
Grid 安装部分我们不在说明,具体可以参考上篇文章。
[root@dave ~]# crsctl stat res -t
--------------------------------------------------------------------------------
Name Target State Server State details
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
ora.ons
OFFLINE OFFLINE dave STABLE
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.cssd
1 ONLINE ONLINE dave STABLE
ora.diskmon
1 OFFLINE OFFLINE STABLE
ora.evmd
1 ONLINE ONLINE dave STABLE
--------------------------------------------------------------------------------
[root@dave ~]#
2创建参数文件
在grid用户的$ORACLE_HOME/dbs目录下创建init+ASM.ora文件并添加如下内容:
https://www.cndba.cn/dave/article/240
*.asm_diskstring='/dev/oracleasm/disks/*'
*.asm_power_limit=1
*.large_pool_size=12M
*.instance_type='asm'
*.remote_login_passwordfile='EXCLUSIVE'
3设置环境变量并启动ASM 实例
[grid@dave dbs]$ cat ~/.bash_profile
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User specific environment and startup programs
PATH=$PATH:$HOME/.local/bin:$HOME/bin
export PATH
export ORACLE_SID=+ASM
export ORACLE_BASE=/u01/app/grid
export ORACLE_HOME=/u01/app/12.1.0/grid
export PATH=$ORACLE_HOME/bin:$PATH:/usr/local/bin/:.
export TEMP=/tmp
export TMP=/tmp
export TMPDIR=/tmp
umask 022
[grid@dave dbs]$ sqlplus / as sysasm
SQL*Plus: Release 12.1.0.2.0 Production on Thu Dec 24 11:43:00 2015
Copyright (c) 1982, 2014, Oracle. All rights reserved.
Connected to an idle instance.
SQL> startup
ASM instance started
Total System Global Area 1140850688 bytes
Fixed Size 2933400 bytes
Variable Size 1112751464 bytes
ASM Cache 25165824 bytes
ORA-15110: no diskgroups mounted
SQL>
[grid@dave ~]$ ps -ef|grep asm
grid 20190 19653 0 11:42 pts/1 00:00:00 sqlplus as sysasm
grid 20207 1 0 11:44 ? 00:00:00 asm_pmon_+ASM
grid 20209 1 0 11:44 ? 00:00:00 asm_psp0_+ASM
grid 20211 1 2 11:44 ? 00:00:01 asm_vktm_+ASM
grid 20215 1 0 11:44 ? 00:00:00 asm_gen0_+ASM
grid 20217 1 0 11:44 ? 00:00:00 asm_mman_+ASM
grid 20221 1 0 11:44 ? 00:00:00 asm_diag_+ASM
grid 20223 1 0 11:44 ? 00:00:00 asm_dia0_+ASM
grid 20225 1 0 11:44 ? 00:00:00 asm_dbw0_+ASM
grid 20227 1 0 11:44 ? 00:00:00 asm_lgwr_+ASM
grid 20229 1 0 11:44 ? 00:00:00 asm_ckpt_+ASM
grid 20231 1 0 11:44 ? 00:00:00 asm_smon_+ASM
grid 20233 1 0 11:44 ? 00:00:00 asm_lreg_+ASM
grid 20235 1 0 11:44 ? 00:00:00 asm_pxmn_+ASM
grid 20237 1 0 11:44 ? 00:00:00 asm_rbal_+ASM
grid 20239 1 0 11:44 ? 00:00:00 asm_gmon_+ASM
grid 20241 1 0 11:44 ? 00:00:00 asm_mmon_+ASM
grid 20243 1 0 11:44 ? 00:00:00 asm_mmnl_+ASM
grid 20282 19117 0 11:45 pts/0 00:00:00 grep --color=auto asm
[grid@dave ~]$
4添加到crs
手工创建的ASM 实例需要把ASM 实例单独的添加到CRS中。 否则会报如下错误:
ORA-29786: SIHA attribute GET failed with Error If 11gR2 ASM instance is created manually [ID 976075.1]
https://www.cndba.cn/dave/article/240
另外,如果不注册的话,执行asmca,还是会认为没有ASM实例,提示需要创建。 https://www.cndba.cn/dave/article/240
SQL> create spfile from pfile;
create spfile from pfile
*
ERROR at line 1:
ORA-29786: SIHA attribute GET failed with error [Attribute 'SPFILE' sts[200]
lsts[0]]
[grid@dave ~]$ crsctl stat res -t
--------------------------------------------------------------------------------
Name Target State Server State details
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
ora.ons
OFFLINE OFFLINE dave STABLE
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.cssd
1 ONLINE ONLINE dave STABLE
ora.diskmon
1 OFFLINE OFFLINE STABLE
ora.evmd
1 ONLINE ONLINE dave STABLE
--------------------------------------------------------------------------------
[grid@dave ~]$
[grid@dave ~]$ srvctl add asm -p $ORACLE_HOME/dbs/init+ASM.ora -d '/dev/oracleasm/disks/*'
[grid@dave ~]$ crsctl stat res -t
--------------------------------------------------------------------------------
Name Target State Server State details
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
ora.asm
OFFLINE OFFLINE dave STABLE
ora.ons
OFFLINE OFFLINE dave STABLE
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.cssd
1 ONLINE ONLINE dave STABLE
ora.diskmon
1 OFFLINE OFFLINE STABLE
ora.evmd
1 ONLINE ONLINE dave STABLE
--------------------------------------------------------------------------------
[grid@dave ~]$
如果要加监听,语法如下:
srvctl add asm -l listener -p $ORACLE_HOME/dbs/init+ASM.ora -d '/dev/oracleasm/disks/*'
[grid@dave ~]$ crsctl start resource -all
CRS-5702: Resource 'ora.cssd' is already running on 'dave'
CRS-5702: Resource 'ora.evmd' is already running on 'dave'
CRS-2501: Resource 'ora.ons' is disabled
CRS-2672: Attempting to start 'ora.asm' on 'dave'
CRS-2672: Attempting to start 'ora.diskmon' on 'dave'
CRS-2676: Start of 'ora.diskmon' on 'dave' succeeded
CRS-2676: Start of 'ora.asm' on 'dave' succeeded
CRS-4000: Command Start failed, or completed with errors.
[grid@dave ~]$ crsctl stat res -t
--------------------------------------------------------------------------------
Name Target State Server State details
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
ora.asm
ONLINE ONLINE dave Started,STABLE
ora.ons
OFFLINE OFFLINE dave STABLE
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.cssd
1 ONLINE ONLINE dave STABLE
ora.diskmon
1 OFFLINE OFFLINE STABLE
ora.evmd
1 ONLINE ONLINE dave STABLE
--------------------------------------------------------------------------------
[grid@dave ~]$
--创建SPFILE:
SQL> create spfile='$ORACLE_HOME/dbs/spfile+ASM.ora' from pfile='$ORACLE_HOME/dbs/init+ASM.ora';
File created.
5创建磁盘组
这里使用的是ASMLIB:
SQL> create diskgroup DISK1 external redundancy disk '/dev/oracleasm/disks/DISK1' attribute 'sector_size'='4096';
Diskgroup created.
[grid@dave ~]$ asmcmd lsdg
State Type Rebal Sector Block AU Total_MB Free_MB Req_mir_free_MB Usable_file_MB Offline_disks Voting_files Name
MOUNTED EXTERN N 4096 4096 1048576 102400 102350 0 102350 0 N DISK1/
[grid@dave ~]$
6验证
SQL> show parameter asm
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
asm_diskgroups string DISK1
asm_diskstring string /dev/oracleasm/disks/*
asm_power_limit integer 1
asm_preferred_read_failure_groups string
在单实例的ASM 环境中不能使用crsctl stop crs 进行操作,只能使用如下语法:https://www.cndba.cn/dave/article/240
[grid@dave dbs]$ crsctl stop res -all
CRS-2500: Cannot stop resource 'ora.diskmon' as it is not running
CRS-2500: Cannot stop resource 'ora.ons' as it is not running
CRS-2673: Attempting to stop 'ora.asm' on 'dave'
CRS-2673: Attempting to stop 'ora.evmd' on 'dave'
CRS-2677: Stop of 'ora.evmd' on 'dave' succeeded
CRS-2677: Stop of 'ora.asm' on 'dave' succeeded
CRS-2673: Attempting to stop 'ora.cssd' on 'dave'
CRS-2677: Stop of 'ora.cssd' on 'dave' succeeded
CRS-4000: Command Stop failed, or completed with errors.
[grid@dave dbs]$ crsctl start res -all
CRS-2501: Resource 'ora.ons' is disabled
CRS-2672: Attempting to start 'ora.cssd' on 'dave'
CRS-2672: Attempting to start 'ora.diskmon' on 'dave'
CRS-2672: Attempting to start 'ora.evmd' on 'dave'
CRS-2676: Start of 'ora.diskmon' on 'dave' succeeded
CRS-2676: Start of 'ora.evmd' on 'dave' succeeded
CRS-2676: Start of 'ora.cssd' on 'dave' succeeded
CRS-2672: Attempting to start 'ora.asm' on 'dave'
CRS-2676: Start of 'ora.asm' on 'dave' succeeded
CRS-4000: Command Start failed, or completed with errors.
[grid@dave dbs]$ crsctl stat res -t
--------------------------------------------------------------------------------
Name Target State Server State details
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
ora.asm
ONLINE ONLINE dave Started,STABLE
ora.ons
OFFLINE OFFLINE dave STABLE
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.cssd
1 ONLINE ONLINE dave STABLE
ora.diskmon
1 OFFLINE OFFLINE STABLE
ora.evmd
1 ONLINE ONLINE dave STABLE
--------------------------------------------------------------------------------
[grid@dave dbs]$
版权声明:本文为博主原创文章,未经博主允许不得转载。
最后
以上就是动听豆芽为你收集整理的oracle创建asm,Oracle 12c 中手工创建ASM 实例步骤的全部内容,希望文章能够帮你解决oracle创建asm,Oracle 12c 中手工创建ASM 实例步骤所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
发表评论 取消回复