联系:手机/微信(+86 17813235971) QQ(107644445)
作者:惜分飞©版权所有[未经本人同意,不得以任何形式转载,否则有进一步追究法律责任的权利.]
1.检查Oracle XML Database组件
SQL> select comp_name, status, version from DBA_REGISTRY where comp_name='Oracle XML Database';
COMP_NAME STATUS VERSION
------------------------- ---------------------- ------------------------------
Oracle XML Database VALID 11.2.0.3.0
SQL> select count(*) from dba_objects where owner='XDB' and status='INVALID';
COUNT(*)
----------
0
2.配置xdb的ftp和http
[oracle@rac1 ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.3.0 Production on Tue May 1 12:05:27 2012
Copyright (c) 1982, 2011, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options
SQL> execute dbms_xdb.sethttpport(8080);
PL/SQL procedure successfully completed.
SQL> execute dbms_xdb.setftpport(2100);
PL/SQL procedure successfully completed.
SQL> commit;
Commit complete.
SQL> select dbms_xdb.GETFTPPORT() from dual;
DBMS_XDB.GETFTPPORT()
---------------------
2100
SQL> select dbms_xdb.GETHTTPPORT() from dual;
DBMS_XDB.GETHTTPPORT()
----------------------
8080
--根据你的需求,可以选择一个即可
SQL> show parameter dispatchers;
NAME TYPE VALUE
------------------------------------ ----------- -------------------------------
dispatchers string (PROTOCOL=TCP) (SERVICE=XFFXDB)
--dispatchers参数会自动配置,这里需要说明,MOS中说的sidxdb是不恰当的,我这里是db_namexdb
--因为我这里是rac,sid为XFF1,总之相信自动配置
3.查看监听
[oracle@rac1 ~]$ lsnrctl status LSNRCTL for Linux: Version 11.2.0.3.0 - Production on 01-MAY-2012 12:09:14 Copyright (c) 1991, 2011, Oracle. All rights reserved. Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521)) STATUS of the LISTENER ------------------------ Alias LISTENER Version TNSLSNR for Linux: Version 11.2.0.3.0 - Production Start Date 01-MAY-2012 11:51:13 Uptime 0 days 0 hr. 18 min. 1 sec Trace Level off Security ON: Local OS Authentication SNMP OFF Listener Parameter File /u01/app/11.2.0/grid/network/admin/listener.ora Listener Log File /u01/app/gridbase/diag/tnslsnr/rac1/listener/alert/log.xml Listening Endpoints Summary... (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=LISTENER))) (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.1.31)(PORT=1521))) (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.1.33)(PORT=1521))) (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=rac1)(PORT=8080))(Presentation=HTTP)(Session=RAW)) (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=rac1)(PORT=2100))(Presentation=FTP)(Session=RAW)) Services Summary... Service "+ASM" has 1 instance(s). Instance "+ASM1", status READY, has 1 handler(s) for this service... Service "XFF" has 1 instance(s). Instance "XFF1", status READY, has 1 handler(s) for this service... Service "XFFXDB" has 1 instance(s). Instance "XFF1", status READY, has 1 handler(s) for this service... The command completed successfully --以下两条监听是自动增加上去,如果没有自动增加,需要手工增加并且重启或者重新加载监听 (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=rac1)(PORT=8080))(Presentation=HTTP)(Session=RAW)) (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=rac1)(PORT=2100))(Presentation=FTP)(Session=RAW))
4.ftp基本操作
[oracle@rac1 ~]$ ftp -n ftp> open rac1 2100 Connected to rac1. 220- rac1 Unauthorised use of this FTP server is prohibited and may be subject to civil and criminal prosecution. 220 rac1 FTP Server (Oracle XML DB/Oracle Database) ready. 530 Please login with USER and PASS. 530 Please login with USER and PASS. KERBEROS_V4 rejected as an authentication type ftp> user system xifenfei 331 pass required for SYSTEM 230 SYSTEM logged in ftp> ls 227 Entering Passive Mode (192,168,1,31,181,5) 150 ASCII Data Connection drw-r--r-- 2 SYS oracle 0 SEP 18 17:49 OLAP_XDS drw-r--r-- 2 SYS oracle 0 SEP 18 17:47 home drw-r--r-- 2 SYS oracle 0 SEP 18 18:02 images drw-r--r-- 2 SYS oracle 0 SEP 18 17:49 olap_data_security drw-r--r-- 2 SYS oracle 0 SEP 18 17:43 public drw-r--r-- 2 SYS oracle 0 SEP 18 17:44 sys -rw-r--r-- 1 SYS oracle 0 MAY 01 04:06 xdbconfig.xml drw-r--r-- 2 SYS oracle 0 SEP 18 17:49 xds 226 ASCII Transfer Complete ftp> cd sys 250 CWD Command successful ftp> cd asm 250 CWD Command successful ftp> ls 227 Entering Passive Mode (192,168,1,31,98,133) 150 ASCII Data Connection drw-r--r-- 2 SYS oracle 0 MAY 01 04:14 XIFENFEI drw-r--r-- 2 SYS oracle 0 MAY 01 04:14 DATA 226 ASCII Transfer Complete ftp> cd xifenfei 250 CWD Command successful ftp> ls 227 Entering Passive Mode (192,168,1,31,151,70) 150 ASCII Data Connection drw-r--r-- 2 SYS oracle 0 MAY 01 04:15 XFF drw-r--r-- 2 SYS oracle 0 MAY 01 04:15 ASM 226 ASCII Transfer Complete ftp> cd xff 250 CWD Command successful ftp> ls 227 Entering Passive Mode (192,168,1,31,100,14) 150 ASCII Data Connection drw-r--r-- 2 SYS oracle 0 MAY 01 04:15 DATAFILE drw-r--r-- 2 SYS oracle 0 MAY 01 04:15 CONTROLFILE drw-r--r-- 2 SYS oracle 0 MAY 01 04:15 ONLINELOG drw-r--r-- 2 SYS oracle 0 MAY 01 04:15 TEMPFILE drw-r--r-- 2 SYS oracle 0 MAY 01 04:15 PARAMETERFILE -rw-r--r-- 1 SYS oracle 3584 MAY 01 04:15 spfileXFF.ora 226 ASCII Transfer Complete ftp> cd xff/datafile 250 CWD Command successful ftp> ls 227 Entering Passive Mode (192,168,1,31,30,63) 150 ASCII Data Connection -rw-r--r-- 1 SYS oracle 744497152 MAY 01 04:20 SYSTEM.256.776961315 -rw-r--r-- 1 SYS oracle 618668032 MAY 01 04:20 SYSAUX.257.776961315 -rw-r--r-- 1 SYS oracle 83894272 MAY 01 04:20 UNDOTBS1.258.776961317 -rw-r--r-- 1 SYS oracle 6291456 MAY 01 04:20 user_dd.dbf -rw-r--r-- 1 SYS oracle 26222592 MAY 01 04:20 UNDOTBS2.264.776961693 -rw-r--r-- 1 SYS oracle 157294592 MAY 01 04:20 xifenfei01.dbf 226 ASCII Transfer Complete ftp> get xifenfei01.dbf local: xifenfei01.dbf remote: xifenfei01.dbf 227 Entering Passive Mode (192,168,1,31,143,34) 150 ASCII Data Connection 550- Error Response ORA-31198: Mismatch in number of bytes transferred due to non-binary mode 550 End Error Response 270340 bytes received in 0.053 seconds (5e+03 Kbytes/s) ftp> binary 200 Type set to I. ftp> get xifenfei01.dbf local: xifenfei01.dbf remote: xifenfei01.dbf 227 Entering Passive Mode (192,168,1,31,9,112) 150 BIN Data Connection 226 BIN Transfer Complete 157294592 bytes received in 14 seconds (1.1e+04 Kbytes/s) --主要需要设置为二进制传输模式,默认是ASCII方式的,可能会报错 ftp> quit 221 QUIT Goodbye.
这篇文章主要参考How to configure XDB for using ftp and http protocols with ASM [ID 357714.1],但是在自己试验过程中,发现文档中有些地方不太合适,这里做个补充说明:
1.ftp服务端不需要启动(这里只是用到了操作系统的ftp客户端功能,如果使用其他客户端工具,连操作系统客户端都省了)
2.dispatchers 中的SERVICE=
3.ftp和http两个功能,只需要配置一个即可(选择你需要的)
4.下图展示的是通过http方式访问结果(system用户登录)

Applies to: Oracle Server - Enterprise Edition - Version: 10.2.0.1 to 11.2.0.3 - Release: 10.2 to 11.2 Linux x86 Linux x86-64 Oracle Server Enterprise Edition - Version: 10.2.0.1 to 11.1.0.7 Goal Configuration of XDB to be able to use ftp and http protocols to browse and manage ASM directories Solution ASM XDB CONFIGURATION Xdb configuration enable the possibility to use FTP from an ftp session on unix or through a browser on Windows. Files can be easily moved in/out from ASM this way It also provides an http interface to easily browse through ASM directories in a graphic environment. Follow Note: 243554.1 "How to Deinstall and Reinstall XML Database (XDB)" to install XDB. Configuration steps: 1) As root check that ftp service is running: # netstat -a | grep ftp tcp 0 0 *:ftp *:* LISTEN If no output is returned, start ftp: # service vsftpd start Starting vsftpd for vsftpd: [ OK ] Also configure ftp to start automatically # chkconfig vsftpd on 2) Configure the FTP and HTTP ports of XDB using: connect / as sysdba execute dbms_xdb.sethttpport(8080); execute dbms_xdb.setftpport(2100); commit; to check use: select dbms_xdb.GETFTPPORT() from dual; select dbms_xdb.GETHTTPPORT() from dual; 3) Check the dispatchers configuration for xdb, if it is not set set it up, for single instance: ALTER SYSTEM SET dispatchers = =(PROTOCOL=TCP) (SERVICE=<sid>XDB)" SCOPE=BOTH For RAC instances: ALTER SYSTEM SET siebprod1.dispatchers = "(PROTOCOL=TCP) (SERVICE=<sid1>XDB)" SCOPE=BOTH ALTER SYSTEM SET siebprod2.dispatchers = "(PROTOCOL=TCP) (SERVICE=<sid2>XDB)" SCOPE=BOTH If you are not using the default Listener ensure you have set LOCAL_LISTENER in the (init.ora/spfile) as prescribed for RAC/NON-RAC instances or the end points will not register. 4) Restart the listener: lsnrctl stop <LISTENER NAME> lsnrctl start <LISTENER NAME> 5) Check that the following lines are returned when executing lsnrctl, if they are not you may need to restart your database. (DESCRIPTION =(ADDRESS = (PROTOCOL = tcp)(HOST = <host>)(PORT = 2100))(Presentation = FTP)(Session = RAW)) (DESCRIPTION = (ADDRESS = (PROTOCOL = tcp)(HOST = <host>)(PORT = 8080))(Presentation = HTTP)(Session = RAW)) 6) Connect to the ftp as follows : OS> ftp -n open <host> 2100 user system <password> cd sys cd asm ... ... 7) From browser : follow the below for FTP type the url :--- ftp://<host>:2100/ for HTTP type the url :-- http://<host>:8080/ Enter the user and password as SYSTEM and <password> Troubleshooting: If you do not succeed to connect to ftp then : a. Check for any invalid XDB owned objects: SQL> select count(*) from dba_objects where owner='XDB' and status='INVALID'; COUNT(*) ---------- 0 b. Check DBA_REGISTRY for XDB status: SQL> select comp_name, status, version from DBA_REGISTRY where comp_name='Oracle XML Database' The results should indicate the correct version and patch in a valid status. c. Restart database and listener to enable Oracle XML DB protocol access.