日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問(wèn) 生活随笔!

生活随笔

當(dāng)前位置: 首頁(yè) > 运维知识 > linux >内容正文

linux

Linux RH5平台下使用Oracle ASM创建数据库

發(fā)布時(shí)間:2024/8/26 linux 28 豆豆
生活随笔 收集整理的這篇文章主要介紹了 Linux RH5平台下使用Oracle ASM创建数据库 小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

一、安裝配置先決條件

1.安裝oracleasm支持包

創(chuàng)建asm數(shù)據(jù)庫(kù),首先需要ASMLib驅(qū)動(dòng)程序包,可以從相關(guān)的網(wǎng)站下載到和操作系統(tǒng)對(duì)應(yīng)的rpm文件,分別為oracleasm-support-2.0.3-1、oracleasm-2.6.18-8.el5-2.0.4-1.el5、oracleasmlib-2.0.3-1.el5。

# rpm -Uvh oracleasm*.rpm

# rpm -qa|grep oracleasm
oracleasm-support-2.0.3-1
oracleasm-2.6.18-8.el5-2.0.4-1.el5
oracleasmlib-2.0.3-1.el5

2.添加磁盤

關(guān)閉VMware,添加一塊磁盤并格式化。

# fdisk /dev/sdb
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel. Changes will remain in memory only,
until you decide to write them. After that, of course, the previous
content won’t be recoverable.

The number of cylinders for this disk is set to 1044.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
?? (e.g., DOS FDISK, OS/2 FDISK)
Warning: invalid flag 0×0000 of partition table 4 will be corrected by w(rite)

Command (m for help): n
Command action
?? e?? extended
?? p?? primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-1044, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-1044, default 1044):
Using default value 1044

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.
[root@server oracleasmlib]# fdisk -l

Disk /dev/sda: 17.1 GB, 17179869184 bytes
255 heads, 63 sectors/track, 2088 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

?? Device Boot????? Start???????? End????? Blocks?? Id? System
/dev/sda1?? *?????????? 1????????? 13????? 104391?? 83? Linux
/dev/sda2????????????? 14??????? 2088??? 16667437+? 8e? Linux LVM

Disk /dev/sdb: 8589 MB, 8589934592 bytes
255 heads, 63 sectors/track, 1044 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

?? Device Boot????? Start???????? End????? Blocks?? Id? System
/dev/sdb1?????????????? 1??????? 1044???? 8385898+? 83? Linux

3.配置rawdevices

因?yàn)閞h5中取消了rawdevices服務(wù),要使用裸設(shè)備創(chuàng)建asm,需要做以下配置。

# vi /etc/udev/rules.d/60-raw.rules

添加以下部分的內(nèi)容

ACTION==”add”, KERNEL==”sdb1″, RUN+=”/bin/raw /dev/raw/raw1 %N”
ACTION==”add”, ENV{MAJOR}==”8″, ENV{MINOR}==”1″, RUN+=”/bin/raw /dev/raw/raw2 %M %m”

# start_udev
Starting udev: [? OK? ]

4.配置oracleasm

以root用戶登陸,執(zhí)行

# /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 <ENTER> 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) [y]:
Fix permissions of Oracle ASM disks on boot (y/n) [y]:
Writing Oracle ASM library driver configuration: [? OK? ]
Loading module “oracleasm”: [? OK? ]
Mounting ASMlib driver filesystem: [? OK? ]
Scanning system for ASM disks:
[? OK? ]

# /etc/init.d/oracleasm createdisk VOL1 /dev/sdb1
Marking disk “/dev/sdb1″ as an ASM disk: [? OK? ]
#
[root@server oracleasmlib]# /etc/init.d/oracleasm listdisks
VOL1
[root@server oracleasmlib]# /etc/init.d/oracleasm scandisks
Scanning system for ASM disks:
[? OK? ]

二、創(chuàng)建ASM實(shí)例

1.創(chuàng)建初始化文件

$ su – oracle
$ cd $ORACLE_HOME/dbs
$ vi init+ASM.ora

*.asm_diskstring=’ORCL:VOL*’
*.background_dump_dest=’/oracle/admin/+ASM/bdump’
*.core_dump_dest=’/oracle/admin/+ASM/cdump’
*.instance_type=’asm’
*.large_pool_size=12M
*.remote_login_passwordfile=’SHARED’
*.user_dump_dest=’/oracle/admin/+ASM/udump’

2.創(chuàng)建密碼文件

$ su – oracle
$ cd $ORACLE_HOME/dbs
$ orapwd file=orapw+ASM password=dba

3. 創(chuàng)建目錄結(jié)構(gòu)

$ su – oracle
$ cd $ORACLE_HOME/dbs
$ mkdir –p $ORALCE_BASE/admin/+ASM/udump
$ mkdir –p $ORALCE_BASE/admin/+ASM/bdump
$ mkdir –p $ORALCE_BASE/admin/+ASM/cdump

4. 啟動(dòng)實(shí)例

$ export ORACLE_SID=+ASM
$ sqlplus / as sysdba
SQL> startup
ASM instance started

Total System Global Area?? 100663296 bytes
Fixed Size?????????????????? 777616 bytes
Variable Size????????????? 99885680 bytes
Database Buffers????????????????? 0 bytes
Redo Buffers????????????????????? 0 bytes
ORA-15110: no diskgroups mounted

因?yàn)槲覀兪鞘状螁?dòng)asm實(shí)例,還沒(méi)有創(chuàng)建diskgroup,所以顯示15110錯(cuò)誤是正常的。

如果啟動(dòng)實(shí)例的時(shí)候碰到如下報(bào)錯(cuò):
ORA-29701: unable to connect to Cluster Manager
那么請(qǐng)檢查/etc/inittab 文件,看看是否有下面這行
h1:35:respawn:/etc/init.d/init.cssd run >/dev/null 2>&1 </dev/null
如果沒(méi)有請(qǐng)?zhí)砑?#xff0c;如果被注釋了請(qǐng)取消注釋。

5. 創(chuàng)建 spfile,重新啟動(dòng)

SQL> create spfile from pfile;
SQL> shutdown immediate;
SQL> startup;

6. 創(chuàng)建 diskgroup

SQL> create diskgroup dgroup1 external redundancy
? 2? failgroup fgroup1 disk ‘ORCL:VOL1′;

Diskgroup created.

SQL> col name for a10
SQL> select name,state from v$asm_diskgroup;

NAME?????? STATE
———- ———————-
DGROUP1??? MOUNTED

如果上述命令返回的 state是 DISMOUNTED,那么我們需要手工將掛載 diskgroup

SQL> ALTER DISKGROUP dgroup1 MOUNT;

Diskgroup altered.

SQL> show parameter asm_diskgroups
?
NAME???????????????????????????????? TYPE?????? VALUE
———————————— ———- ——————————
asm_diskgroups?????????????????????? string???? DGROUP1

三、創(chuàng)建ASM數(shù)據(jù)庫(kù)

接下來(lái),創(chuàng)建ASM數(shù)據(jù)庫(kù)的工作就非常的簡(jiǎn)單了。執(zhí)行dbca實(shí)用程序,在第六步“storage options”部分選擇“Automatic Storage Management ”,在接下來(lái)的“ASM Disk Groups”步驟中,選擇之前創(chuàng)建的“DGROUP1”,再按照普通建庫(kù)的方式完成數(shù)據(jù)庫(kù)的創(chuàng)建就OK了。

總結(jié)

以上是生活随笔為你收集整理的Linux RH5平台下使用Oracle ASM创建数据库的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。

如果覺(jué)得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。