在Oracle Linux 4.7上安装配置Oracle 10g ASM数据库
安装Oracle Linux的时候选上Oracle需要的那些rpm包,还有Oracle ASM那些rpm包。 1,修改/boot/grub/grub.conf文件,把default改成1 0对应ELhugemem内核 1对应ELsmp内核 (我这里的虚拟机是vbox,如果启动ELhugemem内核会报错,所以在此修改了grub.conf文件)
安装Oracle Linux的时候选上Oracle需要的那些rpm包,还有Oracle ASM那些rpm包。1,修改/boot/grub/grub.conf文件,把default改成1
0对应ELhugemem内核
1对应ELsmp内核
(我这里的虚拟机是vbox,如果启动ELhugemem内核会报错,所以在此修改了grub.conf文件)
把id:5:initdefault: 改为id:3:initdefault:
关闭selinux,修改/etc/selinux/config文件:
SELINUX=disabled
因为我这里是为了安装oracle,所以就把一些不需要的service关闭了。
输入chkconfig --list查看服务,然后输入下面这些指令关闭不需要的服务:
chkconfig anacron off
chkconfig atd off
chkconfig crond off
chkconfig apmd off
chkconfig autofs off
chkconfig dund off
chkconfig pand off
chkconfig capi off
chkconfig isdn off
chkconfig dc_client off
chkconfig dc_server off
chkconfig diskdump off
chkconfig netdump off
chkconfig gpm off
chkconfig irda off
chkconfig lm_sensors off
chkconfig mdmonitor off (RAID or LVM)
chkconfig mdmpd off
chkconfig smartd off
chkconfig iptables off(关闭防火墙,这个很重要,当然也可以设置,这里为了简单起见,直接把防火墙关了)
chkconfig bluetooth off
chkconfig cups off
chkconfig sendmail off
chkconfig iiim off
binutils-2.15.92.0.2-13.EL4
compat-db-4.1.25-9
compat-libstdc++-296-2.96-132.7.2
control-center-2.8.0-12
gcc-3.4.3-22.1.EL4
gcc-c++-3.4.3-22.1.EL44
glibc-2.3.4-2.9
glibc-common-2.3.4-2.9
gnome-libs-1.4.1.2.90-44.1
libstdc++-3.4.3-22.1
libstdc++-devel-3.4.3-22.1
make-3.80-5
pdksh-5.2.14-30
sysstat-5.0.5-1
xscreensaver-4.18-5.rhel4.2
setarch-1.6-1
修改/etc/sysctl.conf的内容:
kernel.shmall = 2097152
kernel.shmmax = 2147483648
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
fs.file-max = 65536
net.ipv4.ip_local_port_range = 1024 65000
net.core.rmem_default = 1048576
net.core.rmem_max = 1048576
net.core.wmem_default = 262144
net.core.wmem_max = 262144
然后执行sysctl -p使内核参数修改生效
在文件/etc/security/limits.conf中添加如下内容:
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
session required /lib/security/pam_limits.so
session required pam_limits.so
if [ $USER = "oracle" ]; then
if [ $SHELL = "/bin/ksh" ]; then
ulimit -p 16384
ulimit -n 65536
else
ulimit -u 16384 -n 65536
fi
fi
groupadd oinstall
groupadd dba
useradd oracle -g oinstall -G dba
passwd oracle
mkdir -p /u01/app/oracle
chown -R oracle:oinstall /u01
chmod -R 775 /u01
export TMP=/tmp
export TMPDIR=$TMP
umask 022
export ORACLE_HOSTNAME=asmnode
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/10.2.0/db_1
export ORACLE_SID=orcl
export NLS_LANG=AMERICAN_AMERICA.AL32UTF8
export PATH=$ORACLE_HOME/bin:/usr/sbin:$PATH
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
export CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib
(修改主机名可以修改/etc/sysconfig/network)
(其实这一步可以跳过,直接把安装包传到oracle用户的目录下再解压就行。
我这样做的目的是不想让虚拟机的第一块磁盘增长过快,这个知识点后面在建asm磁盘的时候会用到)
fdisk /dev/sdb
n(新建分区)
p(主分区)
1(分区号是1)
1(开始cylinder为1)
1566(结束cylinder为1566,相当于12GB)
然后输入p查看分区表
w(保存)
partprobe(让kernel读取分区信息 )
mkfs.ext3 /dev/sdb1 把第二块硬盘的第一个主分区格式化为ext3
mount /dev/sdb1 /mnt/b #将第一个分区挂载到d这个目录
重启后自动挂载:vi /etc/fstab
添加:/dev/sdb1 /mnt/b ext3 default 0 0
用户远程登陆用
Xmanager Enterprise 3的Xshell的,然后输入emacs弹出图形界面,说明远程登陆没问题了。
oracle用户在家目录执行/mnt/b/database/runInstaller,根据图形界面一步步做,选择仅安装数据库软件
先删除第11步创建的磁盘,然后给虚拟机添加4块磁盘
两块属于scsi控制器
另外两块属于sas控制器
如图所示

配置 ASMLib:
root用户输入/etc/init.d/oracleasm configure
如图:

输入/etc/init.d/oracleasm createdisk VOL1 /dev/sdb
此时会出错,如下所示:
[root@asmnode ~]# /etc/init.d/oracleasm createdisk VOL1 /dev/sdb
Marking disk "/dev/sdb" as an ASM disk: asmtool: Device "/dev/sdb" is not a partition
解决方案是:
需要对/dev/sdb分区/dev/sdb1
fdisk /dev/sdb
n-p-1-回车-回车-p-w
其他磁盘也是这样分区,最后执行fdisk -l查看分区效果,确保已经分区了
然后再执行partprobe让kernel读取分区信息
这时候我们就可以创建asm磁盘了:
/etc/init.d/oracleasm createdisk VOL1 /dev/sdb1
/etc/init.d/oracleasm createdisk VOL2 /dev/sdc1
/etc/init.d/oracleasm createdisk VOL3 /dev/sdd1
/etc/init.d/oracleasm createdisk VOL4 /dev/sde1
接着我们查看asm磁盘信息:
[root@asmnode ~]# /etc/init.d/oracleasm listdisks
VOL1
VOL2
VOL3
VOL4
[root@asmnode ~]# /etc/init.d/oracleasm querydisk /dev/sdb1
Disk "/dev/sdb1" is marked an ASM disk with the label "VOL1"
如果要删除 ASM 磁盘通过以下命令:
# /etc/init.d/oracleasm deletedisk VOL4
如果是在 RAC 环境中的某一个节点中添加了ASM 磁盘,那么需要在其它的节点上
运行scandisks 来获取这种变化。
/etc/init.d/oracleasm scandisks
如图:
用root用户创建css服务(这一步的目的是实现asm实例和database实例之间的同步)
/u01/app/oracle/product/10.2.0/db_1/bin/localconfig add
可以用root用户查看css服务是否成功
[root@asmnode ~]# ps -ef | grep css
oracle 5174 1 4 10:12 ? 00:00:06 /u01/app/oracle/product/10.2.0/db_1/bin/ocssd.bin
root 5429 3943 0 10:14 pts/0 00:00:00 grep css
也可以用oracle用户执行crsctl check css来查看
效果:
[oracle@asmnode ~]$ crsctl check css
CSS appears healthy
完成
export ORACLE_SID=+ASM
sqlplus / as sysdba
select name,state from v$asm_diskgroup;
select name||header_status||path from v$asm_disk;
16,用dbca创建基于ASM的数据库
这里除了第6,7,8步,其它跟普通的dbca创建数据库是一样的。我们选择的是ASM存储方式。
创建完数据库后
export ORACLE_SID=orcl
sqlplus / as sysdba
然后执行查询
select * from scott.dept;
select name from v$datafile;
select name from v$tempfile;
select member from v$logfile;
到此我们完成了基于Oracle ASM的数据库的创建。
还有就是记得用netca创建oracle监听程序
然后用sys用户执行alter system register;
最后来查看进程ps -ef | grep oracle
17,体验一下rebanlance
执行alter diskgroup dgroup1 drop disk asmvol2;
SELECT group_number, operation, state, est_work, sofar, est_rate,
est_minutes FROM v$asm_operation;
返回
GROUP_NUMBER OPERATION STATE EST_WORK SOFAR EST_RATE
------------ --------------- ------------ ---------- ---------- ----------
EST_MINUTES
-----------
1 REBAL RUN 1021 44 343
2
然后
GROUP_NUMBER OPERATION STATE EST_WORK SOFAR EST_RATE
------------ --------------- ------------ ---------- ---------- ----------
EST_MINUTES
-----------
1 REBAL RUN 1139 1063 322
0
然后
GROUP_NUMBER OPERATION STATE EST_WORK SOFAR EST_RATE
------------ --------------- ------------ ---------- ---------- ----------
EST_MINUTES
-----------
1 EXPEL RUN 0 0 0
0
然后
no rows selected
SQL> select STATE,REDUNDANCY,TOTAL_MB,FREE_MB,NAME,FAILGROUP from v$asm_disk;
STATE REDUNDANCY TOTAL_MB FREE_MB NAME FAILGROUP
---------- --------------------- ---------- ---------- --------------- --------------------
NORMAL UNKNOWN 12284 0
NORMAL UNKNOWN 12284 11157 ASMVOL1 FGROUP1
NORMAL UNKNOWN 12284 11719 ASMVOL3 FGROUP2
NORMAL UNKNOWN 12284 11720 ASMVOL4 FGROUP2
[oracle@asmnode ~]$ ps -ef | grep arb0
oracle 7036 1 12 16:37 ? 00:00:26 asm_arb0_+ASM
oracle 7056 6942 0 16:41 pts/0 00:00:00 grep arb0
[oracle@asmnode ~]$ ps -ef | grep arb0
oracle 7069 6942 0 16:47 pts/0 00:00:00 grep arb0
由此可见当删除磁盘重新平衡的时候,会出现asm_arb0_+ASM进程,平衡结束后这个进程也就结束了
在asm实例中查询:
SQL> SELECT disk_number, label FROM V$asm_disk;
DISK_NUMBER LABEL
----------- ---------------------------------------------------------------------------------------------
0 VOL2
2 VOL1
0 VOL3
1 VOL4
而在数据库实例中查询:
SQL> SELECT disk_number, label FROM V$asm_disk;
DISK_NUMBER LABEL
----------- -------------------------------
0 VOL3
1 VOL4
2 VOL1
我们可以从上面的SQL 知道在ASM 实例中可以查询到所有可以用的磁盘,而在数据库实
例中只可以查询到让自己使用的磁盘
18,创建表空间和用户
连接asm实例:
export ORACLE_SID=+ASM
sqlplus / as sysdba
create diskgroup dgtest external redundancy
disk 'ORCL:VOL2' name testvol2;
连接数据库实例:
export ORACLE_SID=orcl
sqlplus / as sysdba
create tablespace testtblsp datafile '+dgtest';
create user lmc identified by lmc
temporary tablespace temp default tablespace testtblsp;
grant connect,resource to lmc;
conn lmc/lmc
create table tt(id int,name varchar2(20));
insert into tt values(1,'wilson');
insert into tt values(2,'scott');
commit;
conn / as sysdba
echo 3 > /proc/sys/vm/drop_caches
Oracle11g R2的ASM安装可以参考http://blog.csdn.net/liumengcheng/article/details/37565931

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



DeepSeek is a powerful intelligent search and analysis tool that provides two access methods: web version and official website. The web version is convenient and efficient, and can be used without installation; the official website provides comprehensive product information, download resources and support services. Whether individuals or corporate users, they can easily obtain and analyze massive data through DeepSeek to improve work efficiency, assist decision-making and promote innovation.

There are many ways to install DeepSeek, including: compile from source (for experienced developers) using precompiled packages (for Windows users) using Docker containers (for most convenient, no need to worry about compatibility) No matter which method you choose, Please read the official documents carefully and prepare them fully to avoid unnecessary trouble.

Solution to permission issues when viewing Python version in Linux terminal When you try to view Python version in Linux terminal, enter python...

BITGet is a cryptocurrency exchange that provides a variety of trading services including spot trading, contract trading and derivatives. Founded in 2018, the exchange is headquartered in Singapore and is committed to providing users with a safe and reliable trading platform. BITGet offers a variety of trading pairs, including BTC/USDT, ETH/USDT and XRP/USDT. Additionally, the exchange has a reputation for security and liquidity and offers a variety of features such as premium order types, leveraged trading and 24/7 customer support.

Gate.io is a popular cryptocurrency exchange that users can use by downloading its installation package and installing it on their devices. The steps to obtain the installation package are as follows: Visit the official website of Gate.io, click "Download", select the corresponding operating system (Windows, Mac or Linux), and download the installation package to your computer. It is recommended to temporarily disable antivirus software or firewall during installation to ensure smooth installation. After completion, the user needs to create a Gate.io account to start using it.

Ouyi OKX, the world's leading digital asset exchange, has now launched an official installation package to provide a safe and convenient trading experience. The OKX installation package of Ouyi does not need to be accessed through a browser. It can directly install independent applications on the device, creating a stable and efficient trading platform for users. The installation process is simple and easy to understand. Users only need to download the latest version of the installation package and follow the prompts to complete the installation step by step.

How to automatically set the permissions of unixsocket after the system restarts. Every time the system restarts, we need to execute the following command to modify the permissions of unixsocket: sudo...

Ouyi, also known as OKX, is a world-leading cryptocurrency trading platform. The article provides a download portal for Ouyi's official installation package, which facilitates users to install Ouyi client on different devices. This installation package supports Windows, Mac, Android and iOS systems. Users can choose the corresponding version to download according to their device type. After the installation is completed, users can register or log in to the Ouyi account, start trading cryptocurrencies and enjoy other services provided by the platform.
