VirtualBox创建11G+ASM实例数据库

1、组 
groupadd -g 500 dba
groupadd -g 501 oinstall

2、用户
useradd -u 500 -g dba -G oinstall oracle

useradd -u 501 -g dba -G oinstall grid


/home/oracle/.bash_profile
export NLS_LANG=american_america.ZHS16GBK
export EDITOR=vi
export ORACLE_SID=prod
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1
export LD_LIBRARY_PATH=$ORACLE_HOME/lib
export PATH=$ORACLE_HOME/bin:/bin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/X11R6/bin

umask 022


/home/grid/.bash_profile

export EDITOR=vi
export ORACLE_SID=+ASM
export ORACLE_BASE=/u01/grid
export ORACLE_HOME=/u01/11.2/grid
export LD_LIBRARY_PATH=$ORACLE_HOME/lib
export PATH=$ORACLE_HOME/bin:/bin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/X11R6/bin
umask 022


3、内核、包
[root@node1 ~]# vi /etc/sysctl.conf                ------文件最后加一下内容
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 2097152
kernel.shmmax = 536870912
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
net.ipv4.ip_local_port_range = 9000 65500
net.core.rmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048586

[root@node1 ~]# vi /etc/security/limits.conf
oracle              soft    nproc   2047
oracle              hard    nproc   16384
oracle              soft    nofile  1024
oracle              hard    nofile  65536
oracle              soft    stack   10240
grid              soft    nproc   2047
grid              hard    nproc   16384
grid              soft    nofile  1024
grid              hard    nofile  65536
grid              soft    stack   10240

[root@node1 ~]# chkconfig ntpd off             ---关掉操作系统时间服务
[root@node1 ~]# chkconfig sendmail off
[root@node1 ~]# mv /etc/ntp.conf /etc/ntp.conf.bak

[root@node1 ~]# cd /etc/yum.repos.d
[root@node1 yum.repos.d]# cp rhel-debuginfo.repo yum.repo
[root@node1 yum.repos.d]# vi yum.repo
[base]
name=Red Hat Enterprise Linux
baseurl=file:///media/Server
enabled=1
gpgcheck=0

加载ISO镜像文件  挂载
[root@node1 ~]# mount /dev/cdrom /media
mount: block device /dev/cdrom is write-protected, mounting read-only
[root@node1 ~]# yum clean all
[root@node1 ~]# yum install -y sysstat*
[root@node1 ~]# yum install -y libaio*
[root@node1 ~]# yum install -y unix*
[root@node1 ~]# yum install -y *ftp*

4、安装软件目录
grid用户
mkdir -p /u01/grid
mkdir -p /u01/11.2/grid
chown -R grid:dba /u01/grid
chown -R grid:dba /u01/11.2/grid
mkdir -R /u01/app/oraInventory
chown -R grid:dba  /u01/app/oraInventory
oracle用户
mkdir -p /u01/app/oracle
chown -R oracle:dba /u01

5存储
配置裸设备(修改/etc/udev/rules.d/60-raw.rules文件)
 
1.先将磁盘进行分区
#fdisk /dev/sdb
#fdisk /dev/sdc
2.编辑/etc/udev/rules.d/60-raw.rules配置文件
#vi  /etc/udev/rules.d/60-raw.rules
加载裸设备,添加以下内容
1)设置分区与RAW对应关系
ACTION=="add", KERNEL=="/dev/sdb" , RUN+="/bin/raw /dev/raw/raw1 %N"
ACTION=="add", ENV{MAJOR}=="120", ENV{MINOR}=="1905", RUN+="/bin/raw /dev/raw/raw1 %M %m"
ACTION=="add", KERNEL=="/dev/sdc" , RUN+="/bin/raw /dev/raw/raw2 %N"
ACTION=="add", ENV{MAJOR}=="120", ENV{MINOR}=="1921", RUN+="/bin/raw /dev/raw/raw2 %M %m"
2)设置RAW的权限
ACTION=="add", KERNEL=="raw1",owner="grid", GROUP="dba", MODE="660"
ACTION=="add", KERNEL=="raw2",owner="grid", GROUP="dba", MODE="660"

 如果多个RAW的权限相同可以做以下设置,如raw1,raw2权限相同:
ACTION=="add", KERNEL=="raw[1-2]",owner="grid", GROUP="dba", MODE="660"

或者

raw /dev/raw/raw1 /dev/sdc1   ---重启会失效


之前通过/etc/init.d/rawdevices来管理raw设备的启动和关闭。
rhel5正规的方法是通过udev来管理raw。裸设备绑定的重启命令为start_udev 

3.重启服务
 #start_udev
4.查看raw设备
#ls -lrt /dev/raw 或者 
#raw -aq

6、软件
grid 、oracle
7oracle数据库

ASM常用命令及视图
create diskgroup datadg external redundancy disk '/dev/raw/raw1';
drop diskgroup datadg;
alter diskgroup datadg add disk '/dev/raw/raw2';

select name,path from v$asm_disk;
alter diskgroup datadg drop disk '名称'

v$asm_disk(stat)\diskgroup\operation\client\file\template\alias

你可能感兴趣的:(ORACLE--安装备份恢复)