Linux下使用oracle asmlib的技巧

来源:爱站网时间:2021-01-19编辑:网友分享
oracle asmlib在linux中是经常使用到的工具,那么你知道Linux下如何使用oracle asmlib吗?下面的内容中我们就一起去学习Linux下使用oracle asmlib的技巧。

oracle asmlib在linux中是经常使用到的工具,那么你知道Linux下如何使用oracle asmlib吗?下面的内容中我们就一起去学习Linux下使用oracle asmlib的技巧。

1、fdisk磁盘
[Oracle@CHN-FS-5-546 Disk1]$fdisk /dev/sdb
First cylinder (1-239931, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-239931, default 239931): 80000
Command (m for help): p
Disk /dev/sdb: 1973.5 GB, 1973503918080 bytes
255 heads, 63 sectors/track, 239931 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdb1 1 239931 1927245757 5 Extended
/dev/sdb5 1 80000 642599999 83 Linux
Command (m for help): n
Command action
l logical (5 or over)
p primary partition (1-4)
l
First cylinder (80001-239931, default 80001):
Using default value 80001
Last cylinder or +size or +sizeM or +sizeK (80001-239931, default 239931): 160000
Command (m for help): n
Command action
l logical (5 or over)
p primary partition (1-4)
l
First cylinder (160001-239931, default 160001):
Using default value 160001
Last cylinder or +size or +sizeM or +sizeK (160001-239931, default 239931):
Using default value 239931
Command (m for help): p
Disk /dev/sdb: 1973.5 GB, 1973503918080 bytes
255 heads, 63 sectors/track, 239931 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdb1 1 239931 1927245757 5 Extended
/dev/sdb5 1 80000 642599999 83 Linux
/dev/sdb6 80001 160000 642599999+ 83 Linux
/dev/sdb7 160001 239931 642045757 83 Linux
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
[root@CHN-FS-5-544 /]#

2、安装asmlib包
[root@CHN-FS-5-546 ~]# uname -a
Linux CHN-FS-5-546 2.6.9-55.ELsmp #1 SMP Fri Apr 20 17:03:35 EDT 2007 i686 i686 i386 GNU/Linux
[root@CHN-FS-5-546 ~]#
[root@CHN-FS-5-546 asmlib]# rpm -Uvh oracleasm-support-2.0.3-1.i386.rpm oracleasm-2.6.9-55.ELsmp-2.0.3-1.i686.rpm oracleasmlib-2.0.2-1.i386.rpm

[root@CHN-FS-5-546 asmlib]# /etc/init.d/oracleasm configure
Configuring the Oracle ASM library driver.
This will configure the on-boot properties of the Oracle ASM library
driver. The following questions will determine whether the driver is
loaded on boot and what permissions it will have. The current values
will be shown in brackets ('[]'). Hitting without typing an
answer will keep that current value. Ctrl-C will abort.
Default user to own the driver interface []: oracle
Default group to own the driver interface []: dba
Start Oracle ASM library driver on boot (y/n) [n]: y
Fix permissions of Oracle ASM disks on boot (y/n) [y]: y
Writing Oracle ASM library driver configuration: [ OK ]
Creating /dev/oracleasm mount point: [ OK ]
Loading module "oracleasm": [ OK ]
Mounting ASMlib driver filesystem: [ OK ]
Scanning system for ASM disks: [ OK ]
[root@CHN-FS-5-546 asmlib]#

[root@CHN-FS-5-546 asmlib]# /etc/init.d/oracleasm listdisks
[root@CHN-FS-5-546 asmlib]# fdisk -l /dev/sdb
Disk /dev/sdb: 1973.5 GB, 1973503918080 bytes
255 heads, 63 sectors/track, 239931 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdb1 1 239931 1927245726 5 Extended
/dev/sdb5 1 80000 642599937 83 Linux
/dev/sdb6 80001 160000 642599968+ 83 Linux
/dev/sdb7 160001 239931 642045726 83 Linux
[root@CHN-FS-5-546 asmlib]# /etc/init.d/oracleasm createdisk VOL1 /dev/sdb5
Marking disk "/dev/sdb5" as an ASM disk: [ OK ]
[root@CHN-FS-5-546 asmlib]# /etc/init.d/oracleasm listdisks
VOL1
[root@CHN-FS-5-546 asmlib]#

3、设置linux asm数据库自启动
sh /etc/init.d/init.cssd run &
sleep 60
#su - oracle -c '/home/oracle/startup.sh'
su - oracle -c 'dbstart'
设置Oracle自启动
方法一、
1、修改/etc/oratab,将$ORACLE_HOME后默认的N改Y
[oracle@CHN-FS-5-546 ~]$ more /etc/oratab
。。。。。。
+ASM:/u01/app/oracle/product/10.2.0/db_1:Y
logstat1:/u01/app/oracle/product/10.2.0/db_1:Y
2、修改$ORACLE_HOME/bin/dbstart
将ORACLE_HOME_LISTNER赋值为$ORACLE_HOME
3、在rc.local中
添加su - oracle -c 'dbstart'
方法二、
1、添加一个startup脚本
[root@CHN-FS-5-546 oracle]# more startup.sh
ORACLE_HOME=/u01/app/oracle/product/10.2.0/db_1
ORACLE_SID=+ASM
PATH=$ORACLE_HOME/bin
export ORACLE_HOME ORACLE_SID PATH
sqlplus -S '/as sysdba' spool /home/oracle/startup1.log
startup
spool off
exit;
EOF
ORACLE_SID=logstat1
PATH=$ORACLE_HOME/bin
export ORACLE_SID
sqlplus -S '/as sysdba' spool /home/oracle/startup2.log
startup
spool off
exit;
EOF
[root@CHN-FS-5-544 oracle]#
2、在rc.local中添加
su - oracle -c '/home/oracle/startup.sh'
备注:在调用启动脚本之前应该先启动css服务,否则asm无法启动
sh /etc/init.d/init.cssd run & 

上文就是小编介绍Linux下使用oracle asmlib的技巧,大家在看完后是不是觉得非常有趣呢?想了解更多技巧就上爱站技术频道。

上一篇:Ubuntu7.10平台中安装Discuz!6.0

下一篇:Arch Linux下如何搭建vsftpd

您可能感兴趣的文章

相关阅读

热门软件源码

最新软件源码下载