台上十分钟,台下十年功
昨天晚上给部门的同事们做了一个关于oracle rac的培训,本来也只是一个全面大概的介绍。但培训实际是对自己的知识和技术的一种检测,才发现自己其实有很多概念都还理解得不够清楚,回想起oracle的何老师,真是挺佩服他的。想起来觉得自己确实惭愧。技术这条路确实还有很长很长等着我走。。。。。
这是我第二次来广州,两次都是因为oracle的培训,对于我来说,广州还是那么的陌生,方向都找不到:)。
去年的那次关于oracle 10g的培训是跟我同事一起过来参加的,觉得收获还是挺大的,这次是一门提高课程,关于RAC。
要在这里呆五天,说句心理话,我是很不喜欢出差的,在宾馆住的感觉比起自己的房间,差太远了,不知道以后去HK上班了,两边跑,日子是否还是这么难过!
看来我是没有出差的命!晕车+叉床(到新的地方就失眠)。
10G RAC: srvctl
1. Grammar:
srvctl <command> <object> [<options]]
available <command>: enable/disable/start/stop/relocate/status/
add/remove/modify/getenv/setenv/unsetenv/config
avaliable <object>: database/instance/service/nodeapps/vip_range
show help: srvctl <command> <object> -h
2. Examples:
2.1 srvctl config
Available options: database|service|nodeapps|asm
Usage for backward compatibility
srvctl config: Display database name
srvctl config -V : Display the version of srvctl
# display the database info on the specfied node
srvctl config -p orcl -n rac1 :
Full usage:
# list all registered instance of the database
srvctl config database -d orcl
example output:
rac1 orcl1 /orabase/product/10.1.0/db_1
rac2 orcl2 /orabase/product/10.1.0/db_1
# show additional attributes
srvctl config database -d orcl -a
example output:
DB_NAME: orcl
ORACLE_HOME: /orabase/product/10.1.0/db_1
SPFILE: /oradata/orcl/spfileorcl.ora
DOMAIN: null
DB_ROLE: null
START_OPTIONS: null
# show tns entries
srvctl config database -d orcl -t
Example client-side TNS entry for service orcltest:
orcltest =
(description=
(address=(protocol=tcp)(host=db_vip)(port=dedicated_port))
(connect_data=
(service_name=orcltest)
(failover_mode=
(type=select)
(method=basic)
)
)
)
# Display help
srvctl config service -h
# Display service's information
srvctl config service -d orcl -s <service_name>
# display help
srvctl config nodeapps -h
# display node's information
srvctl config nodeapps -n rac1
example output:
rac1 orcl1 /orabase/product/10.1.0/db_1
# display VIP configuration
srvctl config nodeapps -n rac1 -a
# display GSD configuration
srvctl config nodeapps -n rac1 -g
# display OSD configuration
srvctl config nodeapps -n rac1 -s
# display Listener configuration
srvctl config nodeapps -n rac1 -l
2.2 srvctl status
Available options: database|instance|service|nodeapps|asm
# Display help for database level
srvctl status database -h
# Display instance's running status on each node
srvctl status database -d orcl
example output:
Instance orcl1 is(not) running on node rac1
Instance orcl2 is(not) running on node rac2
# include disabled applications
srvctl status database -d orcl -f
# verbos output
srvctl status database -d orcl -v
# Additional information for EM Console
srvctl status database -d orcl -S EM_AGENT_DEBUG
# Additional information for EM Console
srvctl status database -d orcl -i orcl1 -S EM_AGENT_DEBUG
# Display help for instance level
srvctl status instance -h
# display appointed instance's running status
srvctl status instance -d orcl -i orcl1
# Display help for node level
srvctl status nodeapps -h
# Display all app's status on the node xxx
srvctl status nodeapps -n <node_name>
Not finished, Continue...
2.3 srvctl start
I think maybe it's one of the most frequently used commands
as well as 'srvctl stop'.
Available options: database|instance|service|nodeapps|asm
# Start database
srvctl start database -d orcl -o nomount
srvctl start database -d orcl -o mount
srvctl start database -d orcl -o open
# Grammar for start instance
srvctl start instance -d [db_name] -i [instance_name]
-o [start_option] -c [connect_str] -q
# Start all instances on the all nodes
srvctl start instance -d orcl -i orcl1,orcl2,...
# Start ASM instance
srvctl start ASM -n [node_name] -i asm1 -o open
# Start all apps in one node
srvctl start nodeapps -n [node_name]
2.4 srvctl stop
I think maybe it's also one of the most frequently used
commands as well as 'srvctl start'.
Available options: database|instance|service|nodeapps|asm
# Stop database
srvctl stop database -d orcl -o normal
srvctl stop database -d orcl -o immediate
srvctl stop database -d orcl -o abort
# Grammar for stop instance
srvctl stop instance -d [db_name] -i [instance_name]
-o [start_option] -c [connect_str] -q
# Stop all instances on the all nodes
srvctl stop instance -d orcl -i orcl1,orcl2,...
# Stop ASM instance
srvctl stop ASM -n [node_name] -i asm1 -o [option]
# Stop all apps in one node
srvctl stop nodeapps -n [node_name]
2.5 srvctl add
Available options: database|instance|service|nodeapps|asm
Description:
Add a configuration to your cluster database configuration.
"srvctl add service" adds services to a database and
assigns them to instances. You can use "srvctl add service"
to configure the Transparent Application Failover (TAF)
policy for a service.
2.6 srvctl remove
Available options: database|instance|service|nodeapps|asm
Description: Removes the named object from the cluster
environment.
OS:sol-10-u4-ga-x86-v*.iso
CRS:10.2
when check the requirement meet this issue:
Checking operating system requirements ...
Expected result: One of 5.10
Actual Result: 5.10
Check complete. The overall result of this check is: Passed
=======================================================================
Checking operating system package requirements ...
Checking for SUNWbtool; found CCS tools bundled with SunOS(SUNWbtool). Passed
Checking for SUNWarc; found Lint Libraries (usr)(SUNWarc). Passed
Checking for SUNWhea; found SunOS Header Files(SUNWhea). Passed
Checking for SUNWlibm; found Math & Microtasking Library Headers & Lint Files (Usr)(SUNWlibm). Passed
Checking for SUNWlibms; found Math & Microtasking Libraries (Usr)(SUNWlibms). Passed
Checking for SUNWsprot; found Solaris Bundled tools(SUNWsprot). Passed
Checking for SUNWtoo; found Programming Tools(SUNWtoo). Passed
Checking for SUNWi1of; found ISO-8859-1 (Latin-1) Optional Fonts(SUNWi1of). Passed
Checking for SUNWi1cs; found Not found. Failed <<<<
Checking for SUNWi15cs; found Not found. Failed <<<<
Checking for SUNWxwfnt; found X Window System platform required fonts(SUNWxwfnt). Passed
Check complete. The overall result of this check is: Failed <<<<
Problem: Some packages required for the Oracle Database 10g to function properly are missing (see above).
Recommendation: Install the required packages before continuing with the installation.
=======================================================================
Checking physical memory requirements ...
Expected result: 922MB
Actual Result: 764MB
Check complete. The overall result of this check is: Failed <<<<
Problem: The system does not have sufficient physical memory to perform the install.
Recommendation: Increase the amount of physical memory available to your system before continuing with the installation.
=======================================================================
Checking for Oracle Home incompatibilities ....
Actual Result: NEW_HOME
Check complete. The overall result of this check is: Passed
=======================================================================
Checking Oracle Home path for spaces...
Check complete. The overall result of this check is: Passed
=======================================================================
Checking local Cluster Synchronization Services (CSS) status ...
Check complete. The overall result of this check is: Passed
=======================================================================
Checking whether Oracle 9.2 RAC is available on all selected nodes
Check complete. The overall result of this check is: Passed
=======================================================================
在安装CRS的时候需要安装三个包:SUNWi1cs SUNWi15cs SUNWxwfnt
这三个包在solairs的第一张光盘里可以找到,安装方法
bash-3.00#pkgadd -d /cdrom/sol_10_807_x86/Solairs_10/Product SUNWi1cs
bash-3.00#pkgadd -d /cdrom/sol_10_807_x86/Solairs_10/Product SUNWi15cs
bash-3.00#pkgadd -d /cdrom/sol_10_807_x86/Solairs_10/Product SUNWxwfnt

按照oracle官方文档反复检查了设置,未发现问题,google,baidu,之后,下面这个是比较合理的解释:
Error:*** Alert: The specified nodes are not clusterable. This could be due to one or more of the following reasons:
1. The user performing the install is not configured in an equivalent manner on all nodes.
2. ssh and scp are not configured properly on all nodes.
3. rsh and rcp are not configured properly on all nodes.
/**********************************************************************/
但我反复检查这几个方面,都没有问题,郁闷几天之后,发现:
[oratest@tx1000 ~]$ more /etc/hosts
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1 tx1000 localhost.localdomain localhost
172.16.0.1 tx1000.rac.com tx1000
172.16.0.99 tx1000-vip.rac.com tx1000-vip
192.168.0.100 tx1000-priv.rac.com tx1000-priv
172.16.0.101 tx1001.rac.com tx1001
172.16.0.98 tx1001-vip.rac.com tx1001-vip
192.168.0.200 tx1001-priv.rac.com tx1001-priv
因为第一行是默认的,我之前就没修改它,也没注意它,但最终它造成了问题,看来默认的不一定就是正确的,把第一行的127.0.0.1后面的tx1000去掉,问题PASS。
如图:

Checking local Cluster Synchronization Services (CSS) status ...
Actual Result: One or more of the selected nodes in the cluster has local CSS configured on it.
Check complete. The overall result of this check is: Failed <<<<
Problem: One or more of the selected nodes in the cluster has local CSS configured on it.
Recommendation: Cluster Synchronization Services (CSS) provide services for single-instance Automatic Storage Management (ASM) in addition to being part of the Oracle Clusterware stack. When configured stand-alone outside of the Oracle Clusterware, it is sometimes referred to as "local" CSS.
Because you are installing Oracle Clusterware on a set of nodes that already have local CSS configured, you must shut down any ASM instances and any databases using ASM and deconfigure local CSS on those nodes before proceeding with the Oracle Clusterware installation. You can deconfigure local CSS by running 'localconfig delete' as the root user from OH/bin. After the Oracle Clusterware installation and configuration is complete, CSS will be started and configured to run from the Oracle Clusterware Home. You may then restart any ASM instances and any databases that use ASM.
=======================================================================
搞了半天,也想了很多办法,清除以前安装的oracle,把ASM也设置为boot时不启动,可还是没办法,只有重新安装OS了。
测试ASM 数据库的automatic rebalance 功能
添加两个虚拟硬盘,分别是sdf 和sdg,大小500M
启动系统,启动ASM 实例,启动数据库实例
创建ASM 磁盘
#/etc/init.d/oracleasm createdisk VOL5 /dev/sdf
#/etc/init.d/oracleasm createdisk VOL6 /dev/sdg
登入ASM 实例检查v$asm_disk 视图,发现这两个新加的硬盘已经找到了
将硬盘添加到磁盘组中
SQL> ALTER DISKGROUP DGROUP1 ADD FAILGROUP FGROUP1 DISK
'ORCL:VOL5' FAILGROUP FGROUP2 DISK 'ORCL:VOL6';
Diskgroup altered. 查看全文
安装Oracle ASMLib
下载ASMLib 需要的三个文件:
asmlib:http://otn.oracle.com/software/tech/linux/asmlib/files/RPMS/rhel3/x8
6/oracleasmlib-1.0.0-1.i386.rpm
asm-support:http://otn.oracle.com/software/tech/linux/asmlib/files/RPMS/r
hel3/x86/oracleasm-support-1.0.2-1.i386.rpm
asm-kernel:http://otn.oracle.com/software/tech/linux/asmlib/files/RPMS/rhe
l3/x86/oracleasm-2.4.21-EL-1.0.0-1.i686.rpm
Oracle 集群文件系统 (OCFS) 第 1 版
OCFS 第 1 版是原始设备的一个优秀替代品。 它不仅更易于管理和维护,而且克服了 255 个原始设备的限制。 但是,它并不是一个通用集群文件系统。 它只能用于存储以下类型的文件:
- Oracle 数据文件
- 联机重做日志
- 归档重做日志
- 控制文件
- Spfile
- CRS 共享文件(Oracle Cluster Registry 和 CRS voting disk)。
昨天花了半天时间准备在redhat as4上安装10g RAC,结果在晚上十点遇到这个问题Loading module "oracleasm": Unable to load module "oracleasm"[FAILED]
今天一上班就处理这个问题,结果如下:
# /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.
查看全文
一、 环境配置
primary: IP:192.168.0.120
CPU:2个Intel(R) Xeon(TM) CPU 2.80GHz (HT)
Mem:2G Swap:4G
Disk:130G DB:
Oracle Database 10g Enterprise Edition Release 10.1.0.3.0 - Prod OS:Linux oracle 2.4.21-20.ELsmp #1 SMP
standby: IP:192.168.0.101 Cup:2个Intel(R) Xeon(TM) CPU 2.40GHz (HT) Mem:2G Swap:2G Disk:66G DB:
Oracle Database 10g Enterprise Edition Release 10.1.0.3.0 - Prod OS:Linux boss-3 2.4.21-15.ELsmp #1 SMP Primary
Db Name: Microsoft SQL Server (6.5, 7, 2000 and 2005) and Sybase (10, 11, 12).
JDBC Name: jTDS
Home Page: http://jtds.sourceforge.net/
JDBC Ver: 1.0.2
Download: http://sourceforge.net/project/showfiles.php?group_id=33291
Conn Code:
Class.forName("net.sourceforge.jtds.jdbc.Driver ");
Connection con = DriverManager.getConnection("jdbc:jtds:sqlserver://host:port/database","user","password");
or
Connection con = DriverManager.getConnection("jdbc:jtds:sybase://host:port/database","user","password");












