五、安装ASM
2、根据linux内核下载相应的asm安装包:
根据uname –a查看内核(黄底红字为内核):
$ uname -a
Linux L-DB-3-6 2.6.18-92.el5 #1 SMP Tue Apr 29 13:16:15 EDT 2008 x86_64 x86_64 x86_64 GNU/Linux
如下为查询结果:
Library and Tools(别光顾内核查出来的四个RPM包遗漏这两个关键的包哦!)
Drivers for kernel 2.6.18-92.el5
3、安装 rpm -Uvh .......... --nodeps
注意:需要在root下安装,在oracle下有如下错误:
warning: oracleasm-2.6.18-92.el5xen-2.0.5-1.el5.x86_64.rpm: Header V3 DSA signature: NOKEY, key ID 1e5e0159
error: can't create transaction lock on /var/lib/rpm/__db.000
4、安装完成后对用来做asm的磁盘进行分区(采用已经划分好的三个分区:/dev/sda11、/dev/sda12、/dev/sda13):
fdisk /dev/sda
n
p
1
回车
回车
w
根据以上参数对所有硬盘都进行进行分区
示例:查看划分好的分区
Last login: Mon Oct 18 15:58:24 2010 from 172.16.4.41
[root@L-DB-3-6 ~]# vi /etc/redhat-release
[root@L-DB-3-6 ~]# vi /etc/oratab
[root@L-DB-3-6 ~]# vi /etc/redhat-release
[root@L-DB-3-6 ~]# fdisk -l
Disk /dev/sda: 291.9 GB, 291999055872 bytes
255 heads, 63 sectors/track, 35500 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 1 255 2048256 83 Linux
/dev/sda2 256 2805 20482875 83 Linux
/dev/sda3 2806 4080 10241437+ 83 Linux
/dev/sda4 4081 35500 252381150 5 Extended
/dev/sda5 4081 19378 122881153+ 83 Linux
/dev/sda6 19379 21928 20482843+ 83 Linux
/dev/sda7 21929 23203 10241406 83 Linux
/dev/sda8 23204 24478 10241406 83 Linux
/dev/sda9 24479 25753 10241406 83 Linux
/dev/sda10 25754 26263 4096543+ 82 Linux swap / Solaris
/dev/sda11 26264 28696 19543041 83 Linux
/dev/sda12 28697 31129 19543041 83 Linux
/dev/sda13 31130 33562 19543041 83 Linux
5、创建asm磁盘
/etc/init.d/oracleasm configure
/etc/init.d/oracleasm createdisk ORACLEASM1 /dev/sda11
/etc/init.d/oracleasm createdisk ORACLEASM2 /dev/sda12
/etc/init.d/oracleasm createdisk ORACLEASM3 /dev/sda13
6、查看asm磁盘:/etc/init.d/oracleasm listdisks
示例:
[root@L-DB-3-6 ~]# /etc/init.d/oracleasm listdisks
ORACLEASM1
ORACLEASM2
ORACLEASM3
7、安装oracle(只装软件,以后通过dbca创建asm和数据库)
$ cd /database
$ ls
$./runInstaller
8、安装过程中只选择数据库软件(不选数据库和ASM)
注:如下图选择第三个选项(Install database Software only)
9、创建asm实例
A.在$ORACLE_HOME/dbs下创建初始化文件init+ASM.ora内容如下:
vi init+ASM.ora
*.asm_diskstring='ORCL:ORACLEASM*'
*.background_dump_dest='/home/oracle/admin/+ASM/bdump'
*.core_dump_dest='/home/oracle/admin/+ASM/cdump'
*.instance_type='asm'
*.large_pool_size=12M
*.remote_login_passwordfile='SHARED'
*.user_dump_dest='/home/oracle/admin/+ASM/udump'
说明:第一行的ORCL:ORACLEASM*中ORCL为固定格式,ORACLEASM*代表asm磁盘,别的一目了然
B.创建目录结构
mkdir -p /home/oracle/admin/+ASM/udump
mkdir -p /home/oracle/admin/+ASM/bdump
mkdir -p /home/oracle/admin/+ASM/cdump
示例:
[oracle@L-DB-3-6 dbs]$ mkdir -p /home/oracle/admin/+ASM/udump
[oracle@L-DB-3-6 dbs]$ mkdir -p /home/oracle/admin/+ASM/bdump
[oracle@L-DB-3-6 dbs]$ mkdir -p /home/oracle/admin/+ASM/cdump
C.启动实例
export ORACLE_SID=+ASM
sqlplus /as sysdba
startup
事例:
[oracle@L-DB-3-6 dbs]$ export ORACLE_SID=+ASM
[oracle@L-DB-3-6 dbs]$ sqlplus /as sysdba
会报一个ORA-29701 :unable to connect to Cluster Manager错误
此时需要切换到root用户执行:$ORACLE_HOME/bin/localconfig add
示例:
[root@L-DB-3-6 ~]# cd /home/oracle/product/10.2.0/db_1/bin/
[root@L-DB-3-6 bin]# ./localconfig add
/etc/oracle does not exist. Creating it now.
Successfully accumulated necessary OCR keys.
Creating OCR keys for user 'root', privgrp 'root'..
Operation successful.
Configuration for local CSS has been initialized
Adding to inittab
Startup will be queued to init within 90 seconds.
Checking the status of new Oracle init process...
Expecting the CRS daemons to be up within 600 seconds.
CSS is active on these nodes.
l-db-3-6
CSS is active on all nodes.
Oracle CSS service is installed and running under init(1M)
做完后切换到oracle下就可以启动了,不过会报一个:
ORA-15110: no diskgroups mounted
示例:
SQL> startup
ASM instance started
Total System Global Area 130023424 bytes
Fixed Size 2019032 bytes
Variable Size 102838568 bytes
ASM Cache 25165824 bytes
ORA-15110: no diskgroups mounted
因为没有创建磁盘组,那么是正常的报错,先不用理会。
D.创建spfile
create spfile from pfile;
创建完后spfile,关闭实例(shutdown immediate),再利用startup启动一下。
示例:
SQL> create spfile from pfile;
File created.
E.创建磁盘组(一般最好成对添加,此处没有)
SQL> create diskgroup dgroup1 normal redundancy
2 failgroup fgroup1 disk 'ORCL:ORACLEASM1','ORCL:ORACLEASM2'
3 failgroup fgroup2 disk 'ORCL:ORACLEASM3';
Diskgroup created.
查看挂载情况:
SQL> select name,state from v$asm_diskgroup;
NAME STATE
------------------------------ -----------
DGROUP1 MOUNTED
若没有自动挂在,则需要手工挂在:
SQL> alter diskgroup dgroup1 mount;
alter diskgroup dgroup1 mount
*
ERROR at line 1:
ORA-15032: not all alterations performed
ORA-15017: diskgroup "DGROUP1" cannot be mounted
ORA-15030: diskgroup name "DGROUP1" is in use by another diskgroup
因为已经挂载,所以会报错,是正常的。
查看参数:
SQL> show parameter asm_diskgroup;
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
asm_diskgroups string DGROUP1