本篇演示将单实例下的数据库迁移至ASM环境。
一 软件环境
- Oracle VM Virtualbox 5.2.8
- Oracle Linux 6.5
- Oracle 11.2.0.4
二 主机设置
1 创建用户和组
[root@strong ~]# groupadd asmadmin
[root@strong ~]# groupadd asmdba
[root@strong ~]# groupadd asmoper
[root@strong ~]# useradd -g oinstall -G asmadmin,asmdba,asmoper,oper,dba grid
[root@strong ~]# passwd grid
Changing password for user grid.
New password:
BAD PASSWORD: it is too short
BAD PASSWORD: is too simple
Retype new password:
passwd: all authentication tokens updated successfully.
2 修改Oracle用户组
[root@strong ~]# id oracle
uid=500(oracle) gid=500(oinstall) groups=500(oinstall),501(dba),502(oper)
[root@strong ~]# usermod -G dba,asmadmin,asmdba,oper oracle
[root@strong ~]# id oracle
uid=500(oracle) gid=500(oinstall) groups=500(oinstall),501(dba),502(oper),503(asmadmin),504(asmdba)
3 配置内核参数
在 /etc/security/limits.conf配置文件增加下面的内容。
[root@strong ~]# vim /etc/security/limits.conf
grid soft nproc 2047
grid hard nproc 16384
grid soft nofile 1024
grid hard nofile 65536
4 创建目录
[root@strong ~]# mkdir -p /u01/app/grid
[root@strong ~]# chown -R grid:oinstall /u01/app/grid/
[root@strong ~]# chmod -R 775 /u01/app/grid/
5 设置环境变量
[root@strong ~]# su - grid
在.bash_profile增加如下内容。
[grid@strong ~]$ vim .bash_profile
ORACLE_BASE=/u01/app/grid
export ORACLE_BASE
ORACLE_SID=+ASM
export ORACLE_SID
export ORACLE_TERM=xterm
ORACLE_HOME=/u01/app/grid/product/11.2.0/grid
export ORACLE_HOME
PATH=$ORACLE_HOME/bin:$PATH
export PATH
[grid@strong ~]$ . .bash_profile
[grid@strong ~]$ echo $ORACLE_SID
+ASM
三 ASM配置(udev)
1 Linux系统关闭情况下增加4块磁盘
2 创建分区
[root@strong ~]# fdisk /dev/sdb
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel with disk identifier 0xc5819521.
Changes will remain in memory only, until you decide to write them.
After that, of course, the previous content won't be recoverable.
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
switch off the mode (command 'c') and change display units to
sectors (command 'u').
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-1566, default 1):
Using default value 1
Last cylinder, +cylinders or +size{K,M,G} (1-1566, default 1566):
Using default value 1566
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
[root@strong ~]#
注:同样的方法分别对/dev/sdc、/dev/sdd、/dev/sde创建分区。
创建完后查看磁盘配置
[root@strong ~]# f