ASM工具集合-amdu

这个工具功能非常强大,可以在磁盘组unmount的情况下,直接读取ASM磁盘的file directory部分,找到文件和目录结构,然后根据用户需求,直接将文件抽取出来,因此功能非常强大。

AMDUOracle 11g里自带的一个免费的工具,用于分析ASM磁盘组的元数据以及从不能mount的磁盘组中往外抽取数据文件。

NOTE:553639.1 Placeholder for AMDU binaries and using with ASM 10g明确指出:AMDU也可用于10g,并提供了可用于10gAMDU的各个操作系统的版本供大家下载。

AMDU的原理是解析file directory,这一点ODU也是一样,只不过ODU做的更彻底一些,即使file directory全部损坏,ODU也可以把数据文件抽取出来,尽最大的可能挽救用户的数据。

首先要知道的是如何确定要抽取的文件名字

amdu -dump 'DATA'

从image中找出文件sequence号
strings DATA_0001.img |more
...
DATAFILE
system01.dbf
sysaux01.dbf
undotbs01.dbf
users01.dbf
CONTROLFILE
control01.ctl
一般256的文件时control01.ctl文件,如果不是可以向下计算。
amdu -extract 'DATA.256'
256是SYSTEM表空间:
strings DATA_256.f |more
}|{z
M5#PFT10G
SYSTEM
_SYSSMU2$
从256开始数,260是控制文件。
amdu -extract 'DATA.260'

我们来看一个用AMDU从不能mount的磁盘组中往外抽取数据文件的实例:

我们现在shutdown Oracle实例和ASM实例:

[root@bspdev odu]# su – oracle

[oracle@bspdev ~]$ sqlplus ‘/ as sysdba’;

SQL*Plus: Release 11.2.0.1.0 Production on Thu Feb 23 10:43:36 2012

Copyright (c) 1982, 2009, Oracle. All rights reserved.

Connected to:

Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 – Production

With the Partitioning, Automatic Storage Management, OLAP, Data Mining

and Real Application Testing options

SQL> shutdown immediate

Database closed.

Database dismounted.

ORACLE instance shut down.

SQL> exit

Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 – Production

With the Partitioning, Automatic Storage Management, OLAP, Data Mining

and Real Application Testing options

[oracle@bspdev ~]$ su – grid

Password:

[grid@bspdev ~]$ sqlplus ‘/ as sysasm’;

SQL*Plus: Release 11.2.0.1.0 Production on Thu Feb 23 10:45:05 2012

Copyright (c) 1982, 2009, Oracle. All rights reserved.

Connected to:

Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 – Production

With the Automatic Storage Management option

SQL> shutdown immediate

ASM diskgroups dismounted

ASM instance shutdown

SQL> exit

Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 – Production

With the Automatic Storage Management option

[grid@bspdev ~]$ crsctl status res

NAME=ora.DATA.dg

TYPE=ora.diskgroup.type

TARGET=OFFLINE

STATE=OFFLINE

NAME=ora.LISTENER.lsnr

TYPE=ora.listener.type

TARGET=ONLINE

STATE=ONLINE on bspdev

NAME=ora.RECO.dg

TYPE=ora.diskgroup.type

TARGET=OFFLINE

STATE=OFFLINE

NAME=ora.asm

TYPE=ora.asm.type

TARGET=OFFLINE

STATE=OFFLINE

NAME=ora.cssd

TYPE=ora.cssd.type

TARGET=ONLINE

STATE=ONLINE on bspdev

NAME=ora.diskmon

TYPE=ora.diskmon.type

TARGET=ONLINE

STATE=ONLINE on bspdev

NAME=ora.ora11g.db

TYPE=ora.database.type

TARGET=OFFLINE

STATE=OFFLINE

ASM diskgroup不能mount的情况下asmcmd不能使用:

[grid@bspdev ~]$ asmcmd

Connected to an idle instance.

ASMCMD> ls

ASMCMD-08102: no connection to ASM; command requires ASM to run

但此时ODU内嵌的asmcmd是可以使用的,所以我们可以轻易的使用ODU内嵌的asmcmd命令来得到所有的datafile的名称

[grid@bspdev ~]$ su -

Password:

[root@bspdev ~]# cd /u01/app/oracle/odu

[root@bspdev odu]# ./odu

Oracle Data Unloader:Release 4.2.1

Copyright (c) 2008,2009,2010,2011 XiongJun. All rights reserved.

Web: http://www.oracleodu.com

Email: magic007cn@gmail.com

loading default config…….

byte_order little

block_size 8192

block_buffers 1024

db_timezone -7

Invalid db timezone:-7

client_timezone 8

Invalid client timezone:8

asmfile_extract_path /odu/asmfile

data_path data

lob_path /odu/data/lob

charset_name AL32UTF8

ncharset_name AL16UTF16

output_format text

lob_storage infile

clob_byte_order big

trace_level 1

delimiter |

unload_deleted no

file_header_offset 0

is_tru64 no

record_row_addr no

convert_clob_charset yes

use_scanned_lob yes

trim_scanned_blob yes

lob_switch_dir_rows 20000

db_block_checksum yes

db_block_checking yes

rdba_file_bits 10

compatible 10

load config file ‘config.txt’ successful

loading default asm disk file ……

grp# dsk# bsize ausize disksize diskname groupname path

—- —- —– —— ——– ————— ————— ——————————————–

1 0 4096 1024K 9000 DATA_0000 DATA /dev/sda3

1 1 4096 1024K 9000 DATA_0001 DATA /dev/sda5

1 2 4096 1024K 9000 DATA_0002 DATA /dev/sda6

2 0 4096 1024K 9000 RECO_0000 RECO /dev/sda7

2 1 4096 1024K 7288 RECO_0001 RECO /dev/sda8

load asm disk file ‘asmdisk.txt’ successful

loading default control file ……

ts# fn rfn bsize blocks bf offset filename

—- —- —- —– ——– — —— ——————————————–

load control file ‘control.txt’ successful

loading dictionary data……done

loading scanned data……done

ODU> asmcmd

Entering asmcmd module.

ASMCMD> ls

Current directory: <root>

Disk Group

————————————

DATA

RECO

ASMCMD> cd +DATA

Current directory: +DATA

ASMCMD> ls

Current directory: +DATA

Name

—————————————-

ASM <DIR>

ORA11G <DIR>

ASMCMD> cd ORA11G

Current directory: +DATA/ORA11G

ASMCMD> ls

Current directory: +DATA/ORA11G

Name

—————————————-

DATAFILE <DIR>

CONTROLFILE <DIR>

ONLINELOG <DIR>

TEMPFILE <DIR>

PARAMETERFILE <DIR>

spfileora11g.ora => +DATA.265.747311071

ASMCMD> cd DATAFILE

Current directory: +DATA/ORA11G/DATAFILE

可以看到,当前的第259号(这个259ASMinternal file number)文件名称为+DATA/ORA11G/DATAFILE / USERS.259.747310451

ASMCMD> ls

Current directory: +DATA/ORA11G/DATAFILE

Name

—————————————-

SYSTEM.256.747310449

SYSAUX.257.747310449

UNDOTBS1.258.747310451

USERS.259.747310451

MYTEST.266.761050749

GAOZCINDEX.267.770299335

GAOZCINDEX1 => +DATA.267.770299335

GAOZCDATA.268.770299347

GAOZCDATA1 => +DATA.268.770299347

现在我们用AMDU把这个文件给抽出来,注意现在这个文件所在的磁盘组DATA还是处于unmount状态。

AMDU抽取数据文件的语法非常简单,只需要指定磁盘组所在的设备文件名称(可以用*号模糊匹配),以及磁盘组的名称和待抽取的数据文件号(这里的数据文件号是指ASMinternal file number)就可以了

[root@bspdev odu]# /u01/app/oracle/bin/amdu -diskstring ‘/dev/sda*’ -extract ‘DATA.259′

amdu_2012_02_23_11_21_34/

进入上述目录,可以看到抽取出的第259号文件DATA_259.f已经生成:

[root@bspdev odu]# cd amdu_2012_02_23_11_21_34

[root@bspdev amdu_2012_02_23_11_21_34]# ls -lrt

total 39744

-rw-r–r–. 1 root root 8600 Feb 23 11:21 report.txt

-rw-r–r–. 1 root root 40640512 Feb 23 11:21 DATA_259.f

我们现在再用ODU259号文件提出来,跟AMDU做一个对比:

[root@bspdev amdu_2012_02_23_11_21_34]# cd ..

[root@bspdev odu]# ./odu

Oracle Data Unloader:Release 4.2.1

Copyright (c) 2008,2009,2010,2011 XiongJun. All rights reserved.

Web: http://www.oracleodu.com

Email: magic007cn@gmail.com

loading default config…….

byte_order little

block_size 8192

block_buffers 1024

db_timezone -7

Invalid db timezone:-7

client_timezone 8

Invalid client timezone:8

asmfile_extract_path /odu/asmfile

data_path data

lob_path /odu/data/lob

charset_name AL32UTF8

ncharset_name AL16UTF16

output_format text

lob_storage infile

clob_byte_order big

trace_level 1

delimiter |

unload_deleted no

file_header_offset 0

is_tru64 no

record_row_addr no

convert_clob_charset yes

use_scanned_lob yes

trim_scanned_blob yes

lob_switch_dir_rows 20000

db_block_checksum yes

db_block_checking yes

rdba_file_bits 10

compatible 10

load config file ‘config.txt’ successful

loading default asm disk file ……

grp# dsk# bsize ausize disksize diskname groupname path

—- —- —– —— ——– ————— ————— ——————————————–

1 0 4096 1024K 9000 DATA_0000 DATA /dev/sda3

1 1 4096 1024K 9000 DATA_0001 DATA /dev/sda5

1 2 4096 1024K 9000 DATA_0002 DATA /dev/sda6

2 0 4096 1024K 9000 RECO_0000 RECO /dev/sda7

2 1 4096 1024K 7288 RECO_0001 RECO /dev/sda8

load asm disk file ‘asmdisk.txt’ successful

loading default control file ……

ts# fn rfn bsize blocks bf offset filename

—- —- —- —– ——– — —— ——————————————–

0 1 1 8192 112640 N 0 +DATA/ORA11G/DATAFILE/SYSTEM.256.747310449

1 2 2 8192 119040 N 0 +DATA/ORA11G/DATAFILE/SYSAUX.257.747310449

2 3 3 8192 70400 N 0 +DATA/ORA11G/DATAFILE/UNDOTBS1.258.747310451

4 4 4 8192 4960 N 0 +DATA/ORA11G/DATAFILE/USERS.259.747310451

load control file ‘oductl.dat’ successful

loading dictionary data……done

loading scanned data……done

ODU> asmcmd

Entering asmcmd module.

注意:ODU的最新版本中extract命令已被copy命令替换了:

ASMCMD> extract asmfile +DATA/ORA11G/DATAFILE/USERS.259.747310451 to /u01/app/oracle/odu/amdu_2012_02_23_11_21_34/user01.dbf

starting extract asm file ‘+DATA/ORA11G/DATAFILE/USERS.259.747310451′ to ‘/u01/app/oracle/odu/amdu_2012_02_23_11_21_34/user01.dbf’,file size is 40640512

asm file extract completed.

ASMCMD> exit

Exiting asmcmd module.

[root@bspdev odu]# cd amdu_2012_02_23_11_21_34

[root@bspdev amdu_2012_02_23_11_21_34]# ls -lrt

total 79476

-rw-r–r–. 1 root root 8600 Feb 23 11:21 report.txt

-rw-r–r–. 1 root root 40640512 Feb 23 11:21 DATA_259.f

-rw-r–r–. 1 root root 40640512 Feb 23 11:27 user01.dbf

从结果里可以看到,两者大小一模一样。

dbv校验的结果来看,两者内容也是一模一样:

[oracle@bspdev ~]$ dbv file=/u01/app/oracle/odu/amdu_2012_02_23_11_21_34/DATA_259.f blocksize=8192

DBVERIFY: Release 11.2.0.1.0 – Production on Thu Feb 23 11:29:50 2012

Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.

DBVERIFY – Verification starting : FILE = /u01/app/oracle/odu/amdu_2012_02_23_11_21_34/DATA_259.f

DBVERIFY – Verification complete

Total Pages Examined : 4960

Total Pages Processed (Data) : 4442

Total Pages Failing (Data) : 0

Total Pages Processed (Index): 33

Total Pages Failing (Index): 0

Total Pages Processed (Other): 334

Total Pages Processed (Seg) : 0

Total Pages Failing (Seg) : 0

Total Pages Empty : 151

Total Pages Marked Corrupt : 0

Total Pages Influx : 0

Total Pages Encrypted : 0

Highest block SCN : 2132237218 (1932.2132237218)

[oracle@bspdev ~]$ dbv file=/u01/app/oracle/odu/amdu_2012_02_23_11_21_34/user01.dbf blocksize=8192

DBVERIFY: Release 11.2.0.1.0 – Production on Thu Feb 23 11:30:11 2012

Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.

DBVERIFY – Verification starting : FILE = /u01/app/oracle/odu/amdu_2012_02_23_11_21_34/user01.dbf

DBVERIFY – Verification complete

Total Pages Examined : 4960

Total Pages Processed (Data) : 4442

Total Pages Failing (Data) : 0

Total Pages Processed (Index): 33

Total Pages Failing (Index): 0

Total Pages Processed (Other): 334

Total Pages Processed (Seg) : 0

Total Pages Failing (Seg) : 0

Total Pages Empty : 151

Total Pages Marked Corrupt : 0

Total Pages Influx : 0

Total Pages Encrypted : 0

Highest block SCN : 2132237218 (1932.2132237218)

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
一、安装前准备 磁盘规划 使用iscsi共享磁盘做成raw设备 Vote_OCR /dev/sdb1 /dev/raw/raw1 Vote_OCR /dev/sdb2 /dev/raw/raw2 Vote_OCR /dev/sdb3 /dev/raw/raw3 Vote_OCR /dev/sdb5 /dev/raw/raw4 Vote_OCR /dev/sdb6 /dev/raw/raw5 DATA / dev/sdb7 /dev/raw/raw6 DATA dev/sdb8 /dev/raw/raw7 DATA dev/sdb9 /dev/raw/raw8 FLR dev/sdb10 /dev/raw/raw9 FLR dev/sdb11 /dev/raw/raw10 以下操作如果没有特殊说明在两个节点都做相同操作 网络及主机名规划 #public 192.168.10.10 node1 192.168.10.20 node2 #vip 192.168.10.100 node1vip 192.168.10.200 node2vip #private 192.168.20.10 node1priv 192.168.20.20 node2priv #scan 192.168.10.101 scanip 修改/etc/hosts文件添加以上内容 # vi /etc/hosts 192.168.10.10 node1 192.168.10.20 node2 #vip 192.168.10.100 node1vip 192.168.10.200 node2vip #private 192.168.20.10 node1priv 192.168.20.20 node2priv #scan 192.168.10.101 scanip 修改以下文件的最后一行 # vi /etc/sysconfig/network HOSTNAME=node1 ---第二台机器修改为node2 命令行修改 # hostname node1 第二节点修改为 node2 执行 [root@localhost ~]# su - [root@node1 ~]# 我们在安装虚拟机时添加了两块网卡 在这里我们把 eth0作为对外访问使用 eth1作为对对内访问使用 配置IP地址 使用setup命令修改IP 分别配置eth0和eth1(我们只演示node1的配置,node2也配置成相应的IP) 保存退出 重启使配置生效 3、关闭没必要的服务 chkconfig autofs off chkconfig acpid off chkconfig sendmail off chkconfig cups-config-daemon off chkconfig cpus off chkconfig xfs off chkconfig lm_sensors off chkconfig gpm off chkconfig openibd off chkconfig iiim off chkconfig pcmcia off chkconfig cpuspeed off chkconfig nfslock off chkconfig ip6tables off chkconfig rpcidmapd off chkconfig apmd off chkconfig sendmail off chkconfig arptables_jf off chkconifg microcode_ctl off chkconfig rpcgssd off 上述服务有不存在的会提示,服务中读取信息时出错:没有那个文件或目录。没问题,忽略。 停用NTP服务 /sbin/service ntpd stop chkconfig ntpd off mv /etc/ntp.conf /etc/ntp.conf.bak 重启所有节点 安装yum源规划 在/etc/yum.repos.d/ 目录下添加rhel5.repo文件 [root@node1 yum.repos.d]# pwd /etc/yum.repos.d [root@node1 yum.repos.d]# ls rhel5.repo [root@node1 yum.repos.d]# [root@node1 yum.repos.d]# vi rhel5.repo [Server] name=server baseurl=file:///mnt/Server/ enabled=1 gpgcheck=0 [ClusterStorage] name=server baseurl=file:///mnt/ClusterStorage/ enabled=1 gpgcheck=0 挂载光驱到/mnt目录 [root@node1 yum.repos.d]# mount /dev/hdc /mnt mount: block device /dev/hdc is write-protected, mounting read-only [root@node1 yum.repos.d]# cd /mnt/ [root@node1 mnt]# ls Server ClusterStorage -ld dr-xr-xr-x 3 root root 8192 2010-03-22 ClusterStorage dr-xr-xr-x 3 root root 557056 2010-03-22 Server [root@node1 mnt]# 刷新yum列表 [root@node1 mnt]# yum clean all Loaded plugins: rhnplugin, security Cleaning up Everything [root@node1 mnt]# 4、软件包规划 安装所有依赖包 binutils-* compat-libstdc++-* elfutils-libelf-* elfutils-libelf-devel-* gcc-* gcc-c++-* glibc-* glibc-common-* glibc-devel-* glibc-headers-* ksh-* libaio-* libaio-devel-* libgcc-* libstdc++-* make-* sysstat-* expat-* pdksh-* unixODBC-* 使用YUM安装 # yum install -y binutils-* compat-libstdc++-* elfutils-libelf-* elfutils-libelf-devel-* gcc-* gcc-c++-* glibc-* glibc-common-* glibc-devel-* glibc-headers-* ksh-* libaio-* libaio-devel-* libgcc-* libstdc++-* make-* sysstat-* expat-* pdksh-* unixODBC-* 5、建立用户和目录 用户及目录规划 /usr/sbin/groupadd -g 501 oinstall /usr/sbin/groupadd -g 502 dba /usr/sbin/groupadd -g 504 asmadmin /usr/sbin/groupadd -g 506 asmdba /usr/sbin/groupadd -g 507 asmoper /usr/sbin/useradd -u 501 -g oinstall -G asmadmin,asmdba,asmoper,dba grid /usr/sbin/useradd -u 502 -g oinstall -G dba,asmdba oracle # passwd grid Changing password for user grid. New UNIX password: BAD PASSWORD: it is too short Retype new UNIX password: passwd: all authentication tokens updated successfully. [root@node1 /]# passwd oracle Changing password for user oracle. New UNIX password: BAD PASSWORD: it is based on a dictionary word Retype new UNIX password: passwd: all authentication tokens updated successfully. 创建grid目录结构 mkdir -p /u01/app/oraInventory chown -R grid:oinstall /u01/app/oraInventory chmod -R 775 /u01/app/oraInventory mkdir -p /u01/app/grid chmod -R 775 /u01/app/grid chown -R grid:oinstall /u01/app/grid mkdir -p /u01/app/11.2.0/grid chown -R grid:oinstall /u01/app/11.2.0/grid chmod -R 775 /u01/app/11.2.0/grid 创建oracle目录结构 mkdir -p /u01/app/oracle mkdir /u01/app/oracle/cfgtoollogs chown -R oracle:oinstall /u01/app/oracle chmod -R 775 /u01/app/oracle mkdir -p /u01/app/oracle/product/11.2.0/db_1 chown -R oracle:oinstall /u01/app/oracle/product/11.2.0/db_1 chmod -R 775 /u01/app/oracle/product/11.2.0/db_1 mkdir –p /u01/software chmod -R 775 /u01 iscsi共享存储规划 (分为server端和client端,我们这里是实验环境,为了节省机器,有一台机器既做服务器同时也做客户端<node1+iscsi>,另一台只有客户端<node2>。注:node1这个虚拟机尽量内存稍微大一些),下面我们开始配置。 在node1上准备要使用的磁盘,并做成相应的raw设备 我们在配置虚拟机的时候加了一块20G的盘 sdb 安装和配置 Node1+iscsi端: [root@node1 mnt]# yum install -y *scsi* [root@node1 /]# vi /etc/tgt/targets.conf #添加以下几行 <target iqn.2012-09.com.example:server.target4> #注:红色部分是在我们存储客户端登录的时候需要 backing-store /dev/sdb # Becomes LUN 1 </target> [root@node1 /]# /etc/init.d/tgtd restart [root@node1 /]# chkconfig tgtd on [root@node1 /]#cd /etc/rc.d/rc5.d/ [root@node1 rc5.d]# mv S13iscsi S40iscsi [root@node1 rc5.d]# [root@node1 ~]# /etc/init.d/iscsi start [root@node1 ~] iscsiadm -m discovery -t st -p 192.168.10.10 <-----(存储地址) 192.168.10.10:3260,1 iqn.2012-09.com.example:server.target4 [root@node1 ~]#iscsiadm -m node -T iqn.2012-09.com.example:server.target4 -p 192.168.10.10 -l Logging in to [iface: default, target: iqn.2012-09.com.example:server.target4, portal: 192.168.10.10,3260] Login to [iface: default, target: iqn.2012-09.com.example:server.target4, portal: 192.168.10.10,3260]: successful 查看磁盘信息 [root@node1 /]# fdisk -l Node2端: [root@node2 ~]# yum install *scsi* -y [root@node2 ~]# /etc/init.d/iscsi start [root@node2 ~]# iscsiadm -m discovery -t st -p 192.168.10.10 <-----(存储地址) 192.168.10.10:3260,1 iqn.2012-09.com.example:server.target4 [root@node2 ~]#iscsiadm -m node -T iqn.2012-09.com.example:server.target4 -p 192.168.10.10 -l Logging in to [iface: default, target: iqn.2012-09.com.example:server.target4, portal: 192.168.10.10,3260] Login to [iface: default, target: iqn.2012-09.com.example:server.target4, portal: 192.168.10.10,3260]: successful [root@node2 /]# 查看磁盘信息 # fdisk -l 在其中一个节点上分区 /dev/sdb 分成10个2G大小的分区 Device Boot Start End Blocks Id System /dev/sdb1 1 1908 1953776 83 Linux /dev/sdb2 1909 3816 1953792 83 Linux /dev/sdb3 3817 5724 1953792 83 Linux /dev/sdb4 5725 20480 15110144 5 Extended /dev/sdb5 5725 7632 1953776 83 Linux /dev/sdb6 7633 9540 1953776 83 Linux /dev/sdb7 9541 11448 1953776 83 Linux /dev/sdb8 11449 13356 1953776 83 Linux /dev/sdb9 13357 15264 1953776 83 Linux /dev/sdb10 15265 17172 1953776 83 Linux /dev/sdb11 17173 19080 1953776 83 Linux [root@node2 ~]# fdisk -l /dev/sdb Disk /dev/sdb: 21.4 GB, 21474836480 bytes 64 heads, 32 sectors/track, 20480 cylinders Units = cylinders of 2048 * 512 = 1048576 bytes Device Boot Start End Blocks Id System /dev/sdb1 1 1908 1953776 83 Linux /dev/sdb2 1909 3816 1953792 83 Linux /dev/sdb3 3817 5724 1953792 83 Linux /dev/sdb4 5725 20480 15110144 5 Extended /dev/sdb5 5725 7632 1953776 83 Linux /dev/sdb6 7633 9540 1953776 83 Linux /dev/sdb7 9541 11448 1953776 83 Linux /dev/sdb8 11449 13356 1953776 83 Linux /dev/sdb9 13357 15264 1953776 83 Linux /dev/sdb10 15265 17172 1953776 83 Linux /dev/sdb11 17173 19080 1953776 83 Linux [root@node2 ~]# 做完分区之后 在两个节点上分别执行以下命令: # partprobe 配置raw设备(每个节点都操作) #vi /etc/udev/rules.d/60-raw.rules ACTION=="add", KERNEL=="sdb1", RUN+="/bin/raw /dev/raw/raw1 %N" ACTION=="add", KERNEL=="sdb2", RUN+="/bin/raw /dev/raw/raw2 %N" ACTION=="add", KERNEL=="sdb3", RUN+="/bin/raw /dev/raw/raw3 %N" ACTION=="add", KERNEL=="sdb5", RUN+="/bin/raw /dev/raw/raw4 %N" ACTION=="add", KERNEL=="sdb6", RUN+="/bin/raw /dev/raw/raw5 %N" ACTION=="add", KERNEL=="sdb7", RUN+="/bin/raw /dev/raw/raw6 %N" ACTION=="add", KERNEL=="sdb8", RUN+="/bin/raw /dev/raw/raw7 %N" ACTION=="add", KERNEL=="sdb9", RUN+="/bin/raw /dev/raw/raw8 %N" ACTION=="add", KERNEL=="sdb10", RUN+="/bin/raw /dev/raw/raw9 %N" ACTION=="add", KERNEL=="sdb11", RUN+="/bin/raw /dev/raw/raw10 %N" KERNEL=="raw*", OWNER="grid" GROUP="asmadmin", MODE="0660" # start_udev  启动 udev: [确定] [root@node1 ~]# ll /dev/raw/ 总计 0 crw-rw---- 1 grid asmadmin 162, 1 09-29 18:13 raw1 crw-rw---- 1 grid asmadmin 162, 10 09-29 18:13 raw10 crw-rw---- 1 grid asmadmin 162, 2 09-29 18:13 raw2 crw-rw---- 1 grid asmadmin 162, 3 09-29 18:13 raw3 crw-rw---- 1 grid asmadmin 162, 4 09-29 18:13 raw4 crw-rw---- 1 grid asmadmin 162, 5 09-29 18:13 raw5 crw-rw---- 1 grid asmadmin 162, 6 09-29 18:13 raw6 crw-rw---- 1 grid asmadmin 162, 7 09-29 18:13 raw7 crw-rw---- 1 grid asmadmin 162, 8 09-29 18:13 raw8 crw-rw---- 1 grid asmadmin 162, 9 09-29 18:13 raw9 [root@node1 ~]# 各类参数及所需配置设置 配置内核参数 vi /etc/sysctl.conf kernel.shmmni = 4096 kernel.sem = 250 32000 100 128 fs.file-max = 6553600 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 = 1048576 # sysctl -p net.ipv4.ip_forward = 0 net.ipv4.conf.default.rp_filter = 1 net.ipv4.conf.default.accept_source_route = 0 kernel.sysrq = 0 kernel.core_uses_pid = 1 net.ipv4.tcp_syncookies = 1 kernel.msgmnb = 65536 kernel.msgmax = 65536 kernel.shmmax = 68719476736 kernel.shmall = 4294967296 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 = 1048576 fs.file-max = 6553600 fs.file-max = 6815744 fs.aio-max-nr = 1048576 修改limits文件,添加如下内容 vi /etc/security/limits.conf grid soft nproc 2047 grid hard nproc 16384 grid soft nofile 1024 grid hard nofile 65536 oracle soft nproc 2047 oracle hard nproc 16384 oracle soft nofile 1024 oracle hard nofile 65536 配置hangcheck-timer # modprobe hangcheck-timer hangcheck_tick=1 hangcheck_margin=10 hangcheck_reboot=1 修改pam文件 #vi /etc/pam.d/login 添加一行 session required pam_limits.so 修改profile文件 #vi /etc/profile if [ $USER = "oracle" ] || [ $USER = "grid" ]; then if [ $SHELL = "/bin/ksh" ]; then ulimit -p 16384 ulimit -n 65536 else ulimit -u 16384 -n 65536 fi umask 022 fi 配置ssh密钥互认(oracle和grid两个用户) [root@node1 u01]# su - oracle [oracle@node1 ~]$ [oracle@node1 ~]$ ssh-keygen -t rsa Generating public/private rsa key pair. Enter file in which to save the key (/home/oracle/.ssh/id_rsa): Created directory '/home/oracle/.ssh'. Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in /home/oracle/.ssh/id_rsa. Your public key has been saved in /home/oracle/.ssh/id_rsa.pub. The key fingerprint is: 5d:94:12:23:9c:5b:ae:e8:5e:23:fb:ce:65:bc:a6:23 oracle@node1 [oracle@node1 ~]$ cd .ssh/ [oracle@node1 .ssh]$ mv id_rsa.pub authorized_keys [oracle@node1 .ssh]$ ll 总计 8 -rw-r--r-- 1 oracle oinstall 394 09-27 21:52 authorized_keys -rw------- 1 oracle oinstall 1675 09-27 21:52 id_rsa [oracle@node1 .ssh]$ chmod 600 authorized_keys [oracle@node1 .ssh]$ cd .. [oracle@node1 ~]$ scp -r .ssh/ 192.168.10.20:/home/oracle The authenticity of host '192.168.10.20 (192.168.10.20)' can't be established. RSA key fingerprint is 95:ed:6d:87:61:00:27:ed:38:17:6c:e9:6c:c3:8a:1d. Are you sure you want to continue connecting (yes/no)? yes Warning: Permanently added '192.168.10.20' (RSA) to the list of known hosts. oracle@192.168.10.20's password: id_rsa 100% 1675 1.6KB/s 00:00 authorized_keys 100% 394 0.4KB/s 00:00 known_hosts 100% 395 0.4KB/s 00:00 [oracle@node1 ~]$ [oracle@node1 ~]$ su - grid 口令: [grid@node1 ~]$ ssh-keygen -t rsa Generating public/private rsa key pair. Enter file in which to save the key (/home/grid/.ssh/id_rsa): Created directory '/home/grid/.ssh'. Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in /home/grid/.ssh/id_rsa. Your public key has been saved in /home/grid/.ssh/id_rsa.pub. The key fingerprint is: 09:b9:21:44:1e:fc:a1:94:6f:9a:e6:5e:ee:d2:76:e4 grid@node1 [grid@node1 ~]$ cd .ssh/ [grid@node1 .ssh]$ ls id_rsa id_rsa.pub [grid@node1 .ssh]$ mv id_rsa.pub authorized_keys [grid@node1 .ssh]$ chmod 600 authorized_keys [grid@node1 .ssh]$ cd .. [grid@node1 ~]$ scp -r .ssh/ 192.168.10.20:/home/grid The authenticity of host '192.168.10.20 (192.168.10.20)' can't be established. RSA key fingerprint is 95:ed:6d:87:61:00:27:ed:38:17:6c:e9:6c:c3:8a:1d. Are you sure you want to continue connecting (yes/no)? yes Warning: Permanently added '192.168.10.20' (RSA) to the list of known hosts. grid@192.168.10.20's password: id_rsa 100% 1671 1.6KB/s 00:00 authorized_keys 100% 392 0.4KB/s 00:00 known_hosts 100% 395 0.4KB/s 00:00 [grid@node1 ~]$ 测试: #su - oracle [oracle@node1 ~]$ ssh node2 date The authenticity of host 'node2 (192.168.10.20)' can't be established. RSA key fingerprint is 95:ed:6d:87:61:00:27:ed:38:17:6c:e9:6c:c3:8a:1d. Are you sure you want to continue connecting (yes/no)? yes Warning: Permanently added 'node2' (RSA) to the list of known hosts. 2012年 09月 27日 星期四 21:57:17 CST [oracle@node1 ~]$ ssh node2priv date The authenticity of host 'node2priv (192.168.20.20)' can't be established. RSA key fingerprint is 95:ed:6d:87:61:00:27:ed:38:17:6c:e9:6c:c3:8a:1d. Are you sure you want to continue connecting (yes/no)? yes Warning: Permanently added 'node2priv,192.168.20.20' (RSA) to the list of known hosts. 2012年 09月 27日 星期四 21:57:28 CST [oracle@node1 ~]$ ssh node1 date The authenticity of host 'node1 (192.168.10.10)' can't be established. RSA key fingerprint is 95:ed:6d:87:61:00:27:ed:38:17:6c:e9:6c:c3:8a:1d. Are you sure you want to continue connecting (yes/no)? yes Warning: Permanently added 'node1,192.168.10.10' (RSA) to the list of known hosts. 2012年 09月 27日 星期四 21:57:45 CST [oracle@node1 ~]$ ssh node1priv date The authenticity of host 'node1priv (192.168.20.10)' can't be established. RSA key fingerprint is 95:ed:6d:87:61:00:27:ed:38:17:6c:e9:6c:c3:8a:1d. Are you sure you want to continue connecting (yes/no)? yes Warning: Permanently added 'node1priv,192.168.20.10' (RSA) to the list of known hosts. 2012年 09月 27日 星期四 21:58:02 CST [oracle@node1 ~]$ [oracle@node1 ~]$ ssh node2 [oracle@node2 ~]$ id uid=502(oracle) gid=501(oinstall) groups=501(oinstall),502(dba),506(asmdba) [oracle@node2 ~]$ ssh node2 date The authenticity of host 'node2 (192.168.10.20)' can't be established. RSA key fingerprint is 95:ed:6d:87:61:00:27:ed:38:17:6c:e9:6c:c3:8a:1d. Are you sure you want to continue connecting (yes/no)? yes Warning: Permanently added 'node2' (RSA) to the list of known hosts. 2012年 09月 27日 星期四 21:58:41 CST [oracle@node2 ~]$ ssh node2priv date The authenticity of host 'node2priv (192.168.20.20)' can't be established. RSA key fingerprint is 95:ed:6d:87:61:00:27:ed:38:17:6c:e9:6c:c3:8a:1d. Are you sure you want to continue connecting (yes/no)? yes Warning: Permanently added 'node2priv,192.168.20.20' (RSA) to the list of known hosts. 2012年 09月 27日 星期四 21:58:49 CST [oracle@node2 ~]$ ssh node1 date The authenticity of host 'node1 (192.168.10.10)' can't be established. RSA key fingerprint is 95:ed:6d:87:61:00:27:ed:38:17:6c:e9:6c:c3:8a:1d. Are you sure you want to continue connecting (yes/no)? yes Warning: Permanently added 'node1,192.168.10.10' (RSA) to the list of known hosts. 2012年 09月 27日 星期四 21:59:01 CST [oracle@node2 ~]$ ssh node1priv date The authenticity of host 'node1priv (192.168.20.10)' can't be established. RSA key fingerprint is 95:ed:6d:87:61:00:27:ed:38:17:6c:e9:6c:c3:8a:1d. Are you sure you want to continue connecting (yes/no)? yes Warning: Permanently added 'node1priv,192.168.20.10' (RSA) to the list of known hosts. 2012年 09月 27日 星期四 21:59:12 CST [oracle@node2 ~]$ [root@node1 /]# su - grid [grid@node1 ~]$ ssh node1 date The authenticity of host 'node1 (192.168.10.10)' can't be established. RSA key fingerprint is 95:ed:6d:87:61:00:27:ed:38:17:6c:e9:6c:c3:8a:1d. Are you sure you want to continue connecting (yes/no)? yes Warning: Permanently added 'node1,192.168.10.10' (RSA) to the list of known hosts. 2012年 09月 27日 星期四 21:59:53 CST [grid@node1 ~]$ ssh node1priv date The authenticity of host 'node1priv (192.168.20.10)' can't be established. RSA key fingerprint is 95:ed:6d:87:61:00:27:ed:38:17:6c:e9:6c:c3:8a:1d. Are you sure you want to continue connecting (yes/no)? yes Warning: Permanently added 'node1priv,192.168.20.10' (RSA) to the list of known hosts. 2012年 09月 27日 星期四 21:59:59 CST [grid@node1 ~]$ ssh node2 date The authenticity of host 'node2 (192.168.10.20)' can't be established. RSA key fingerprint is 95:ed:6d:87:61:00:27:ed:38:17:6c:e9:6c:c3:8a:1d. Are you sure you want to continue connecting (yes/no)? yes Warning: Permanently added 'node2' (RSA) to the list of known hosts. 2012年 09月 27日 星期四 22:00:09 CST [grid@node1 ~]$ ssh node2priv date The authenticity of host 'node2priv (192.168.20.20)' can't be established. RSA key fingerprint is 95:ed:6d:87:61:00:27:ed:38:17:6c:e9:6c:c3:8a:1d. Are you sure you want to continue connecting (yes/no)? Host key verification failed. [grid@node1 ~]$ ssh node2priv date The authenticity of host 'node2priv (192.168.20.20)' can't be established. RSA key fingerprint is 95:ed:6d:87:61:00:27:ed:38:17:6c:e9:6c:c3:8a:1d. Are you sure you want to continue connecting (yes/no)? yes Warning: Permanently added 'node2priv,192.168.20.20' (RSA) to the list of known hosts. 2012年 09月 27日 星期四 22:00:16 CST [grid@node1 ~]$ ssh node2 [grid@node2 ~]$ ssh node2 date The authenticity of host 'node2 (192.168.10.20)' can't be established. RSA key fingerprint is 95:ed:6d:87:61:00:27:ed:38:17:6c:e9:6c:c3:8a:1d. Are you sure you want to continue connecting (yes/no)? yes Warning: Permanently added 'node2' (RSA) to the list of known hosts. 2012年 09月 27日 星期四 22:00:29 CST [grid@node2 ~]$ ssh node2priv date The authenticity of host 'node2priv (192.168.20.20)' can't be established. RSA key fingerprint is 95:ed:6d:87:61:00:27:ed:38:17:6c:e9:6c:c3:8a:1d. Are you sure you want to continue connecting (yes/no)? yes Warning: Permanently added 'node2priv,192.168.20.20' (RSA) to the list of known hosts. 2012年 09月 27日 星期四 22:00:38 CST [grid@node2 ~]$ ssh node1 date The authenticity of host 'node1 (192.168.10.10)' can't be established. RSA key fingerprint is 95:ed:6d:87:61:00:27:ed:38:17:6c:e9:6c:c3:8a:1d. Are you sure you want to continue connecting (yes/no)? yes Warning: Permanently added 'node1,192.168.10.10' (RSA) to the list of known hosts. 2012年 09月 27日 星期四 22:00:49 CST [grid@node2 ~]$ ssh node1priv date The authenticity of host 'node1priv (192.168.20.10)' can't be established. RSA key fingerprint is 95:ed:6d:87:61:00:27:ed:38:17:6c:e9:6c:c3:8a:1d. Are you sure you want to continue connecting (yes/no)? yes Warning: Permanently added 'node1priv,192.168.20.10' (RSA) to the list of known hosts. 2012年 09月 27日 星期四 22:00:58 CST [grid@node2 ~]$ 最后 在每个节点的 oracle用户 grid用户都执行一个命令 $ ssh node1 date && ssh node1priv date && ssh node2 date && ssh node2priv date $ id uid=501(grid) gid=501(oinstall) groups=501(oinstall),502(dba),504(asmadmin),506(asmdba),507(asmoper) 最后是这个效果: [grid@node2 ~]$ ssh node1 date && ssh node1priv date && ssh node2 date && ssh node2priv date 2012年 09月 27日 星期四 22:04:03 CST 2012年 09月 27日 星期四 22:04:03 CST 2012年 09月 27日 星期四 22:04:00 CST 2012年 09月 27日 星期四 22:04:01 CST [grid@node2 ~]$ su - oracle 口令: [oracle@node2 ~]$ ssh node1 date && ssh node1priv date && ssh node2 date && ssh node2priv date 2012年 09月 27日 星期四 22:04:14 CST 2012年 09月 27日 星期四 22:04:14 CST 2012年 09月 27日 星期四 22:04:11 CST 2012年 09月 27日 星期四 22:04:12 CST [oracle@node2 ~]$ ssh node1 [oracle@node1 ~]$ ssh node1 date && ssh node1priv date && ssh node2 date && ssh node2priv date 2012年 09月 27日 星期四 22:04:22 CST 2012年 09月 27日 星期四 22:04:22 CST 2012年 09月 27日 星期四 22:04:19 CST 2012年 09月 27日 星期四 22:04:20 CST [oracle@node1 ~]$ su - grid 口令: [grid@node1 ~]$ ssh node1 date && ssh node1priv date && ssh node2 date && ssh node2priv date 2012年 09月 27日 星期四 22:04:45 CST 2012年 09月 27日 星期四 22:04:45 CST 2012年 09月 27日 星期四 22:04:42 CST 2012年 09月 27日 星期四 22:04:42 CST [grid@node1 ~]$ 8、配置远程图形界面管理 可以使用xmanager,也可以使用vnc。对于远程链接跨越互联网的建议用vnc,如果在局域网中我们使用xmanager即可。 Xmanager配置说明: 配置文件位置: vi /usr/share/gdm/defaults.conf找到下面内容修改配置选项: [xdmcp] DisplaysPerHost=10 Enable=true //257行 Port=177 //284行 [security] AllowRemoteRoot =true //214行 /etc/inittab文件最后一行添加 x:5:respawn:/usr/sbin/gdm 使用命令 # gdm-restart 重启gdm; 查看gdm监听端口开启成功 netstat -nltpu | grep 177 [root@node1 /]# netstat -nltpu | grep 177 udp 0 0 0.0.0.0:177 0.0.0.0:* 3184/gdm-binary [root@node1 /]# 安装前检测 将软件上传到服务器中的我们之前建好的/u01/software 中并解压 [root@node1 /]# chown –R grid.oinstall /u01/software/ #su -grid #cd /u01/software/grid #./runcluvfy.sh stage -pre crsinst -n node1,node2 -fixup -verbose > check.txt 最后查看check.txt文件,如果有错误,可以尝试使用root身份运行/tmp/CVU_11.2.0.1.0_grid/runfixup.sh。最后我们可能看到关于NTP的错误,我们忽略。 二、图形界面开始安装clusterware [root@node1 ~]# su – grid [grid@node1 ~]$ cd /u01/software/grid [grid@node1 grid]$ ls check1.txt doc response runcluvfy.sh sshsetup welcome.html check.txt install rpm runInstaller stage [grid@node1 grid]$ ./runInstaller 选择语言支持 配置集群名称,第二行的“SCAN名称”要和hosts文件里面的scan那项要对应 添加修改节点信息,一定要和hosts文件中的名字对应。在此步骤可以配置ssh互信。因为我们事先已经配置好,这里就不需要修改了。 网络配置 选择磁盘管理方式,我们选择ASM表决盘管理 创建ASM磁盘组 搜索路径 选择需要的盘 设置密码 选择“是” 不使用 使用默认用户即可 设置grid的base和home目录 设置日志目录 检查环境 这项可以忽略 摘要 开始安装 将两个脚本分别在两个节点上以root身份运行 每个脚本等node1执行完了,在去下一个节点执行 执行完成之后点击确定 等待完成,clusterware安装成功。 三、安装数据库软件 #su - oracle $cd /u01/software/database $ cd database/ $ ls doc install response rpm runInstaller sshsetup stage welcome.html $ ./runInstaller 关闭电子邮件接收 选择是 仅安装数据库软件 选择RAC数据库安装 选择语言支持 企业版安装 选择安装目录 选择操作组 点击完成,直到安装结束。 建库(dbca) 以oracle用户身份执行dbca 点击完成直到结束。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值