asm命令及安裝
OS Version RHEL4 U4 2.6.9-42
ASM是ORACLE10G引入的一項新的儲存管理技術,藉助一個新增的ASM例項來實現對
原始裝置的管理,多個原始裝置被組織為一個或多個ASM磁碟卷組,儲存的操作以
ASM磁碟卷組為單位進行,
所需軟體包:
oracleasm-support-2.0.3-1.i386.rpm
oracleasm-2.6.9-42.EL-2.0.3-1.i686.rpm
oracleasmlib-2.0.2-1.i386.rpm
2、配置ASMLib
#/etc/init.d/oracleasm configure
Default user to own the driver interface [oracle]: oracle
Default group to own the driver interface [oinstall]: oinstall
Start Oracle ASM library driver on boot (y/n) [y]: y
Fix permissions of Oracle ASM disks on boot (y/n) [y]: y
Writing Oracle ASM library driver configuration: [ OK ]
Loading module "oracleasm": [ OK ]
Mounting ASMlib driver filesystem: [ OK ]
Scanning system for ASM disks: [ OK ]
Zx:
#ls -l /etc/init.d/*asm*
-rwxr-xr-x 1 root root 1861 Jul 6 2006 /etc/init.d/ibmasm
-rwxr-xr-x 1 root root 18084 Jul 25 2006 /etc/init.d/oracleasm
檢視oracleasm啟動時是否被載入:
#cd /etc/rc3.d
ls -l /etc/rc3.d/*oracleasm
檢視ASM命令選項:
# /etc/init.d/oracleasm
若服務沒有載入加入連結:
#ln -s ../init.d/oracleasm S29oracleasm
#ln -s ../init.d/oracleasm K01oracleasm
建立ASM磁碟:
[root@dbrac bin]# service oracleasm createdisk vol19 /dev/hda19
Marking disk "/dev/hda19" as an ASM disk: [ OK ]
[root@dbrac bin]# service oracleasm createdisk vol20 /dev/hda20
Marking disk "/dev/hda20" as an ASM disk: [ OK ]
檢視ASM磁碟:
[root@dbrac bin]# /etc/init.d/oracleasm listdisks
VOL19
VOL20
如何檢視ASM磁碟VOL19中有哪些裝置:
[root@dbrac bin]# service oracleasm querydisk VOL19
Disk "VOL19" is a valid ASM disk on device [3, 19]
[root@dbrac bin]# ls -l /dev/hda* | grep '3, 19'
brw-rw---- 1 root disk 3, 19 Apr 20 2010 /dev/hda19
修改oracleasm指令碼看看ASM資訊寫在系統什麼位置:
vi /etc/init.d/oracleasm/listdisks
listdisks)
if [ -d "${ORACLE_ASMMANAGER}/disks/" ]
then
ls -1 "${ORACLE_ASMMANAGER}/disks/"
# echo "\${ORACLE_ASMMANAGER} = ${ORACLE_ASMMANAGER} " #將資訊列印出來
fi
;;
[root@stu6 ~]# service oracleasm listdisks
VOL19
VOL20
${ORACLE_ASMMANAGER} = /dev/oracleasm #列印出來了吧!原來ASM資訊寫在這!
[root@dbrac bin]# cd /dev/oracleasm
[root@dbrac oracleasm]# ls
disks iid
[root@stu6 oracleasm]# cd disks
[root@dbrac disks]# ls -l
total 0
brw-rw---- 1 oracle oinstall 3, 19 Apr 19 21:13 VOL19
brw-rw---- 1 oracle oinstall 3, 20 Apr 19 21:13 VOL20
ASM磁碟的資訊在系統中都得到了!
使用oracleasm刪除ASM磁碟
#/etc/init.d/oracleasm deletedisk VOL4
建立ASM資料庫:用嚮導建庫,儲存模式選擇ASM
dbca在建庫過程中會出現一個提示要求啟動oracle叢集同步服務(CSS),啟動方法是在root使用者執行一個指令碼:
#/u01/app/oracle/product/10.2.0/db_1/bin/localconfig add
ASM網路配置
listener.ora
########################
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = siemens)
(ORACLE_HOME = /u01/app/oracle/product/10.2.0/db_1)
(SID_NAME = siemens)
)
(SID_DESC =
(ORACLE_HOME = /u01/app/oracle/product/10.2.0/db_1)
(SID_NAME = +ASM)
)
)
LISTENER =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = dbrac)(PORT = 1521))
)
#######################
tnsnames.ora
#######################
SIEMENS =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = dbrac)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = siemens)
)
)
ASM =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = dbrac)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = +ASM)
)
)
########################
啟動時先起ASM,停庫時先停資料庫
啟動ASM例項問題:
create and start ASM instance:
ORA-01034:ORACLE not available 重新啟動後問題解決!
檢視磁碟組資訊:
col name for a10
SELECT group_number,name,type,state,total_mb,free_mb,offline_disks FROM V$ASM_diskgroup;
GROUP_NUMBER NAME TYPE STATE TOTAL_MB FREE_MB OFFLINE_DISKS
------------ ----- ------ ----------- ---------- ---------- -------------
1 DGA NORMAL CONNECTED 4000 1420 0
檢視ASM磁碟的資訊:
col group# for 99
col disk# for 99
col name for a5
col path for a11
col LABEL for a7
col FAILGROUP for a10
select GROUP_NUMBER group#,DISK_NUMBER disk#,LABEL,STATE,FAILGROUP,name,path,TOTAL_MB,FREE_MB from v$asm_disk;
GROUP# DISK# LABEL REDUNDA STATE FAILGROUP NAME PATH TOTAL_MB FREE_MB
------ ----- ------- ------- -------- ---------- ----- ----------- ---------- ----------
1 1 VOL19 UNKNOWN NORMAL FG1 DGA1 ORCL:VOL19 2000 710
1 0 VOL20 UNKNOWN NORMAL FG2 DGA2 ORCL:VOL20 2000 710
在ASM例項下為磁碟組dga增加磁碟(大小寫敏感):
alter diskgroup dgb add failgroup fg3 disk 'ORCL:VOL5' name vol5;
alter diskgroup dgb add failgroup fg3 disk '/dev/raw/raw6' name vol6;
從組中刪除磁碟:
ALTER DISKGROUP dga DROP DISK vol21;
ALTER DISKGROUP dgA ADD DISK
'/dev/rdsk/c0t4d0s2' NAME A5,
'/dev/rdsk/c0t5d0s2' NAME A6,
'/dev/rdsk/c0t6d0s2' NAME A7,
'/dev/rdsk/c0t7d0s2' NAME A8;
ALTER DISKGROUP dgroupA ADD DISK '/devices/A*';
在ASM例項下刪除磁碟組中的磁碟同時新增新磁碟:
ALTER DISKGROUP dgA DROP DISK vol21 ADD FAILGROUP fg3 DISK 'ORCL:VOL01' NAME VOL21;
在ASM例項下手工建立ASM磁碟組(external normal high):
CREATE DISKGROUP dgb external REDUNDANCY DISK 'ORCL:vol22' name dgb1 SIZE 1000M;
CREATE DISKGROUP dga NORMAL REDUNDANCY
FAILGROUP fg1 DISK 'ORCL:VOL01' name VOL01
FAILGROUP fg2 DISK 'ORCL:VOL02' name VOL02;
Vi $ORACLE_HOME/dbs/initorac.ora
#control_files
Db_create_file_dest=’+DGA’
使用 oracle 代替ASM磁碟
CREATE DISKGROUP dgd NORMAL REDUNDANCY
FAILGROUP controller1 DISK
'/dev/raw/raw1' NAME diskA1 SIZE 120G FORCE,
'/dev/raw/raw2',
'/dev/raw/raw3'
FAILGROUP controller2 DISK
'/dev/raw/raw4',
'/dev/raw/raw5',
'/dev/raw/raw6';
解除安裝磁碟組:
ALTER DISKGROUP dgA DISMOUNT;
檢測磁碟組或磁碟:
ALTER DISKGROUP dga CHECK ALL;
alter diskgroup dga check disk vol19;
在模板中加入新項,預設是雙映象粗條帶化模式(MIRROR 雙映象;HIGH 三映象;UNPROTECTED 無映象)
雙映象粗條帶化(COARSE :1M)
ALTER DISKGROUP dgc ADD TEMPLATE my_template ATTRIBUTES (COARSE);
ALTER DISKGROUP dgc ADD TEMPLATE reliable ATTRIBUTES (MIRROR COARSE);
無映象粗條帶化
ALTER DISKGROUP dgc ADD TEMPLATE userdata ATTRIBUTES (UNPROTECTED);
雙映象細條帶化(FINE :128K)
ALTER DISKGROUP dgc ADD TEMPLATE reliable ATTRIBUTES (MIRROR FINE);
修改模板項屬性
alter diskgroup dgc alter template my_template attributes (fine);
使用自定義模板
ALTER SYSTEM SET DB_CREATE_FILE_DEST = '+dgc(my_template)';
CREATE TABLESPACE test;
刪除模板中的項(模板預設選項不能刪除):
ALTER DISKGROUP dgb DROP TEMPLATE reliable;
刪除資料檔案:
1.資料庫例項
create tablespace test;
alter tablespace test offline;
2.ASM例項:
ALTER DISKGROUP dgA DROP FILE '+DGA/siemens/datafile/test.271.716979429';
在ASM例項下建立磁碟組中的目錄:
ALTER DISKGROUP dgB ADD DIRECTORY '+dgB/mydir';
為OMF檔案命名別名:
ALTER DISKGROUP dgroupA ADD ALIAS '+dgroupA/mydir/datafile.dbf' FOR '+dgroupA.274.38745';
ALTER DISKGROUP dgroupA DROP ALIAS '+dgroupA/mydir/datafile.dbf';
怎樣檢視磁碟組中的路徑:(amscmd)
磁碟組dismount
alter diskgroup group2 dismount;
show parameter asm_diskgroups
磁碟組mount
alter diskgroup group2 mount;
控制均衡容錯組資料的速度:
ALTER DISKGROUP dgb REBALANCE POWER 11;
平衡速度控制引數:
asm_power_limit = 1~11
增加容錯組同時將資料從其它兩組向該組平衡:
ALTER DISKGROUP group1 ADD FAILGROUP fail3 DISK 'ORCL:DISK10' REBALANCE POWER 11;
檢查資料庫平衡速度:
SELECT group_number, operation, state, est_work, sofar, est_rate, est_minutes FROM v$asm_operation;
修改磁碟組大小:
ALTER DISKGROUP group1 RESIZE ALL SIZE 4G;
刪除磁碟組:
drop diskgroup group1 including contents;
取消刪除:
ALTER DISKGROUP group1 UNDROP DISKS;
向容錯組新增磁碟:紀錄在+ASM/bdump/alert_+ASM.log,資料從該容錯組中的其它磁碟向該盤平衡
從組中刪除容錯組:
如果有掛起則不能新增!提示ORA-15029: disk 'ORCL:DISK2' is already mounted by this instance!
HUNG如何處理:除非將組刪除!但資料何處去?
ALTER DISKGROUP group1 ADD FAILGROUP fail1 DISK 'ORCL:DISK6' REBALANCE POWER 11;
惡意測試:破壞ASM磁碟資料
dd if=/dev/zero f=/dev/hda19 bs=10M count=20
刪除垃圾檔案:
1.得到卷組中的所有檔案資訊(在ASM例項):
select file_number,name from v$asm_alias;
2.找到有用檔案(在資料庫例項)
show parameter spfile
select name from v$datafile;
select name from v$controlfile;
select member from v$logfile;
---oracle10g----
V$ASM_TEMPLATE
V$ASM_ALIAS
V$ASM_FILE
V$ASM_CLIENT
V$ASM_DISKGROUP
V$ASM_DISKGROUP_STAT
V$ASM_DISK
V$ASM_DISK_STAT
V$ASM_OPERATION
---oracle11g----
V$ASM_ATTRIBUTE
V$ASM_DISK_IOSTAT
ASMCMD:
export ORACLE_SID=+ASM
asmcmd -p (-p 選項可以在提示中顯示當前路徑)
rm 刪除檔案
lsdg (list diskgroup)檢視 ASM 例項掛載的磁碟,分配的空間大小、可用空間大小和離線磁碟
du (disk utilization )檢視目錄內部已使用的空間大小
du +disk/test/controlfile
find -t CONRTOLFILE +group1/oraasm/ *
mkalias TEST_ASM.281.637521303 TEST_ASM01.DBF
Linux RH5平臺下使用Oracle ASM建立資料庫
實驗環境
作業系統: linux 5.4
日期:2010-09-04
實驗目標
Linux RH5平臺下使用Oracle ASM建立資料庫
實驗步驟
一、安裝配置先決條件
1.安裝oracleasm支援包
建立asm資料庫,首先需要ASMLib驅動程式包,可以從相關的網站下載到和作業系統對應的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.新增磁碟
關閉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 0x0000 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
# start_udev
Starting udev: [ OK ]
4.配置oracleasm
以root使用者登陸,執行
# /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
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 ]
二、建立ASM例項
1.建立初始化檔案
$ 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.建立密碼檔案
$ su – oracle
$ cd $ORACLE_HOME/dbs
$ orapwd file=orapw+ASM password=dba
3. 建立目錄結構
$ 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. 啟動例項
$ 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
因為我們是首次啟動asm例項,還沒有建立diskgroup,所以顯示15110錯誤是正常的。
如果啟動例項的時候碰到如下報錯:
ORA-29701: unable to connect to Cluster Manager
那麼請檢查/etc/inittab 檔案,看看是否有下面這行
h1:35:respawn:/etc/init.d/init.cssd run >/dev/null 2>&1 如果沒有請新增,如果被註釋了請取消註釋。
5.用dbca 建立例項資料 選擇asm安裝
途中需要執行這兩個指令碼
使用root使用者來執行該指令碼,分別執行/opt/app/oracle/oraInventory/orainstRoot.sh和/opt/app/oracle/product/10.2.0/db_1/root.sh
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/27042095/viewspace-742332/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- Docker安裝及基本命令Docker
- asm-windows下安裝asmASMWindows
- kafka安裝及常用命令Kafka
- ASM學習筆記_ASM安裝ASM筆記
- ASM的安裝配置ASM
- Oracle ASM安裝要點OracleASM
- ASM驅動安裝與ASM盤建立(一)ASM
- ASM驅動安裝與ASM盤建立(二)ASM
- 【ASM】asm常用命令及主要功能介紹ASM
- Typescript安裝及編譯《CMD命令列方法》TypeScript編譯命令列
- 安裝__DB、ASM注意事項ASM
- windows下 安裝 rabbitMQ 及操作常用命令WindowsMQ
- git安裝及客戶端常用命令Git客戶端
- Oracleasm下載地址、安裝順序及配置命令OracleASM
- 【ASM】Oracle ASM + 11gR2 + RHEL6.5 安裝ASMOracle
- docker安裝及解除安裝Docker
- AIX (NORAC)下面 ASM的安裝及條帶化和映象的實現AIASM
- RAC安裝【AIX 7 + 11.2.0.4 + ASM】AIASM
- ASM入網小助手解除安裝ASM
- 【Oracle】ASM例項安裝入門OracleASM
- RAW+ASM 的RAC 安裝文件ASM
- Oracle ASM+11gR2安裝OracleASM
- 在linux安裝asm總結LinuxASM
- 探索ORACLE之ASM02_安裝OracleASM
- oracle asm命令OracleASM
- kratos安裝及依賴安裝
- CentOS簡單操作命令及node.js的安裝方法CentOSNode.js
- 手把手教你HDFS基礎配置安裝及命令使用!
- 安裝python3.5注意事項及相關命令Python
- mysql安裝------RPM包安裝及解除安裝MySql
- OEL5.6+oracle11.2.0.3+ASM安裝OracleASM
- OCFS2+ASM 的RAC安裝文件ASM
- oracle10g ASM+RAC安裝OracleASM
- 【RAC】在ESX 上安裝asm 共享磁碟ASM
- 清除安裝失敗的asm例項ASM
- kangle 解除安裝命令
- pytorch安裝命令PyTorch
- mysql ubuntu 命令安裝MySqlUbuntu