分类: Oracle
2009-10-10 23:51:13
注:本文档为转载,其中某些命令需视个人安装情况不同而不同,需灵活变通。
1. 安装ultra search组件
从Oracle网站上下载oracle10g companion安装。
重启数据库;
SQL> startup force
2. 安装Oracle Text 10g
a) 创建Oracle Text对象
SQL> connect SYS/password as SYSDBA
SQL> spool text_install.txt
SQL> @?/ctx/admin/catctx.sql CTXSYS SYSAUX TEMP UNLOCK
其中,CTSYS是用户CTSYS的密码,SYSAUX是其所在表空间,TEMP是其临时表空间,LOCK是CTSYS创建后是否锁住。
检查日至是否有错误,如果出错,卸载Oracle Text 10g(见),重启数据库,从第二步重新开始。
b) 安装Oracle Text语种支持
在$ORACLE_HOME/ctx/admin/defaults目录下有各种语种支持,选择正确的包安装。Drdefus.sql是美语。
SQL> connect CTXSYS/password
SQL>@?/ctx/admin/defaults/drdefus.sql
SQL> spool off
c) 检查Oracle Text 10g是否安装正确
检查所有对象是否正确建立,版本是否正确。执行以下语句:
connect SYS/password as SYSDBA
set pages 1000
col object_name format a40
col object_type format a20
col comp_name format a30
column library_name format a8
column file_spec format a60 wrap
spool text_install_verification.log
-- check on setup
select comp_name, status, substr(version,1,10) as version
from dba_registry
where comp_id = 'CONTEXT';
select * from ctxsys.ctx_version;
select substr(ctxsys.dri_version,1,10) VER_CODE from dual;
select count(*)
from dba_objects where owner='CTXSYS';
-- Get a summary count
select object_type, count(*)
from dba_objects where owner='CTXSYS'
group by object_type;
-- Any invalid objects
select object_name, object_type, status
from dba_objects
where owner='CTXSYS'
and status != 'VALID'
order by object_name;
spool off
如果是10gR1,请确保结果如下:
SQL> select comp_name, status, substr(version,1,10) as version
from dba_registry
where comp_id = 'CONTEXT';
COMP_NAME STATUS VERSION
------------------------------ ----------- ------------------------------
Oracle Text VALID 10.1.0.2.0
SQL> select * from ctxsys.ctx_version;
VER_DICT VER_CODE
---------- ------------------------------
10.1.0.2.0 10.1.0.2.0
SQL> select substr(ctxsys.dri_version,1,10) VER_CODE from dual;
VER_CODE
------------------------------
10.1.0.2.0
SQL> select count(*)
from dba_objects where owner='CTXSYS';
COUNT(*)
----------
338
SQL> select object_type, count(*)
from dba_objects where owner='CTXSYS'
group by object_type;
OBJECT_TYPE COUNT(*)
-------------------- ----------
FUNCTION 5
INDEX 46
INDEXTYPE 4
LIBRARY 1
LOB 1
OPERATOR 6
PACKAGE 71
PACKAGE BODY 58
PROCEDURE 3
SEQUENCE 3
TABLE 37
TYPE 42
TYPE BODY 7
VIEW 54
14 rows selected.
SQL> select object_name, object_type, status
from dba_objects
where owner='CTXSYS'
and status != 'VALID'
order by object_name;
no rows selected
如果是10gR2,请确保结果如下:
SQL> select comp_name, status, substr(version,1,10) as version
2 from dba_registry
3 where comp_id = 'CONTEXT';
COMP_NAME STATUS
------------------------------ ---------------------------------
VERSION
------------------------------
Oracle Text VALID
10.2.0.1.0
SQL> select * from ctxsys.ctx_version;
VER_DICT VER_CODE
---------- ------------------------------
10.2.0.1.0 10.2.0.1.0
SQL> select substr(ctxsys.dri_version,1,10) VER_CODE from dual;
VER_CODE
------------------------------
10.2.0.1.0
SQL>
SQL> select count(*)
2 from dba_objects where owner='CTXSYS';
COUNT(*)
----------
339
SQL>
SQL> -- Get a summary count
SQL> select object_type, count(*)
2 from dba_objects where owner='CTXSYS'
3 group by object_type;
OBJECT_TYPE COUNT(*)
-------------------- ----------
SEQUENCE 3
PROCEDURE 2
OPERATOR 6
PACKAGE 71
PACKAGE BODY 58
LOB 1
LIBRARY 1
TYPE BODY 7
INDEX 46
TABLE 37
FUNCTION 5
VIEW 54
INDEXTYPE 4
TYPE 44
14 rows selected.
SQL>
SQL> -- Any invalid objects
SQL> select object_name, object_type, status
2 from dba_objects
3 where owner='CTXSYS'
4 and status != 'VALID'
5 order by object_name;
no rows selected
如果有问题,卸载重装。
3. 在Oracle 10g中重装、重载JVM
保险起见,先对数据库做一次冷备。
a) 确保以下条件:
Shared_pool_size最少24M;
Java_pool_size最少12M;
SYSTEM表空间最少有70M剩余空间;
回归段表空间最少有100M剩余空间;
b) 卸载JVM
关闭数据库,运行以下脚本:
spool full_rmjvm.log
set echo on
connect / as sysdba
startup mount
alter system set "_system_trig_enabled" = false scope=memory;
alter system enable restricted session;
alter database open;
@?/rdbms/admin/catnoexf.sql
@?/rdbms/admin/rmaqjms.sql
@?/rdbms/admin/rmcdc.sql
@?/xdk/admin/rmxml.sql
@?/javavm/install/rmjvm.sql
truncate table java$jvm$status;
select * from obj$ where obj#=0 and type#=0;
delete from obj$ where obj#=0 and type#=0;
commit;
select owner, count(*) from all_objects
where object_type like '%JAVA%' group by owner;
select obj#, name from obj$
where type#=28 or type#=29 or type#=30 or namespace=32;
select o1.name from obj$ o1,obj$ o2
where o1.type#=5 and o1.owner#=1 and o1.name=o2.name and o2.type#=29;
shutdown immediate
set echo off
spool off
exit
确认结果日志是否正确(在drop对象时,报对象不存在的错误可以忽略)。特别注意:最后一个exit不能省略,确保后面的安装过程是在一个新的会话中。
c) 安装JVM
运行以下脚本安装JVM:
spool full_jvminst.log;
set echo on
connect / as sysdba
startup mount
alter system set "_system_trig_enabled" = false scope=memory;
alter database open;
select obj#, name from obj$
where type#=28 or type#=29 or type#=30 or namespace=32;
@?/javavm/install/initjvm.sql
select count(*), object_type from all_objects
where object_type like '%JAVA%' group by object_type;
@?/xdk/admin/initxml.sql
select count(*), object_type from all_objects
where object_type like '%JAVA%' group by object_type;
@?/xdk/admin/xmlja.sql
select count(*), object_type from all_objects
where object_type like '%JAVA%' group by object_type;
@?/rdbms/admin/catjava.sql
select count(*), object_type from all_objects
where object_type like '%JAVA%' group by object_type;
@?/rdbms/admin/catexf.sql
select count(*), object_type from all_objects
where object_type like '%JAVA%' group by object_type;
shutdown immediate
set echo off
spool off
exit
d) 重启数据库,修正所有不可用对象
@?/rdbms/admin/utlrp.sql
4. 安装Ultra Search
a) 安装
set echo on
spool ultrasearch_inst.log
@?/ultrasearch/admin/wk0install.sql SYS SYS wksys SYSAUX TEMP "" "" FALSE
spool off
exit
其中,change_on_install是sys用户的密码;wksys指定为新创建用户wksys的密码;sysaux是其所在表空间;temp是其临时表空间;
第一个””在非RAC时为””,如果是RAC,就要指定为一个TNS字符串,如”
没有portal时就为””;最后一个参数,当RAC使用聚簇文件系统(CFS)时为TRUE,否则为FALSE。
b) 检查
确保以上日至中无错误,否则卸载重装。
执行以下语句,确保结果相同(10gR1为351,10gR2为371)
SQL> SELECT COUNT(*) FROM DBA_OBJECTS
2 WHERE OWNER = 'WKSYS';
COUNT(*)
----------
371
SQL> SELECT COUNT(*) FROM DBA_OBJECTS
2 WHERE OWNER = 'WKSYS' AND STATUS = 'INVALID';
COUNT(*)
----------
0
5. 确认Ultra Search配置是否正确
一般情况,Oracle已经自动配置好了。
检查文件$ORACLE_HOME/oc4j/j2ee/OC4J_Search/config/http-web-site.xml,确认是否包含以下内容:
其中,5620是Ultra Search的端口。
检查文件$ORACLE_HOME/oc4j/j2ee/OC4J_Search/config/data-sources.xml,确认用户、密码、连接字符串配置是否正确。内容如下:
name="UltraSearchDS"
location="jdbc/UltraSearchPooledDS"
username="demo"
password="demo"
url="jdbc:oracle:thin:@huanged:1521:edgar"
/>
检查文件$ORACLE_HOME\ultrasearch\webapp\config\ultrasearch.properties。下面是一个配置好的例子:
# Install type can be "ocs", "ias", "rdbms"
install_type=rdbms
# If set, the jdbc connection specified here will override the dynamically
# aquired one from OID. This setting is also used by the 9i query sample
# (gsearch.jsp).
#
# Example:
# connection.url=jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=
# (PROTOCOL=tcp)(HOST=
#
connection.url=jdbc:oracle:thin:@huanged:1521:edgar
connection.driver=oracle.jdbc.driver.OracleDriver
domain=corp.oocl.com
# The oracle.net variables control the secure JDBC properties
# and they are in effect only if using thin jdbc drivers as in example above
# Refer to jdbc users guide for more information.
oracle.net.encryption_client=REQUESTED
oracle.net.encryption_types_client=(RC4_56,DES56C,RC4_40,DES40C)
oracle.net.crypto_checksum_client=REQUESTED
oracle.net.crypto_checksum_types_client=(MD5)
6. 启动Ultra Search
执行:searchctl startm,结果如下:
E:\oracle\product\10.1.0\Db_1\ultrasearch\admin>searchctl start
Copyright (c) 2005 Oracle. All rights reserved.
Starting Ultra Search midtier .... please wait.
Ultra Search midtier started...
Administration Tool ->
Search page ->
7. 用wksys账号登陆管理
登陆
a) 给用户赋WKUSER角色
b) 创建实例:
8. 利用Ultra Search
进入一下地址使用Ultra Search
附录:
1. 卸载Ultra search
set echo on
spool ultrasearch_deinst.log
@?/ultrasearch/admin/wk0deinst.sql SYS SYS ""
spool off
exit
2. 卸载JVM
见安装部分。
3. 卸载Oracle Text 10g
SQL> connect SYS/password as SYSDBA
SQL> spool spool textdeinstall.log
SQL>@?/ctx/admin/catnoctx.sql
SQL> spool off