首页 > 数据库 > Oracle > asm下用xdb的http ftp备份db
Oracle XDB是oracle 9i推出的oracle XML数据库,oracle xdb数据能通过基于http服务的8080 tcp端口或基于ftp服务的2100端口访问。
对于oracle XDB也是初次接触,昨天群的网友问到关于asm管理的数据库如何做物理备份,其实当然根据物理备份可以分为用户管理的备份和oracle管理的备份,rman属于oracle管理的备份,如果不利用rman那就要使用用户管理的备份,普通的cp肯定是不行的,asm在os上是透明的,那么可以使用oracle xdb的ftp http端口来备份数据库。
首先查看下是否支持oracle XML database
SQL> col comp_name for a30
SQL> select comp_name,status,version from dba_registry where comp_name like '%XML%';
COMP_NAME STATUS VERSION
------------------------------ ---------------------- --------------------
Oracle XML Database VALID 10.2.0.1.0
设置ftp的端口2100
SQL> execute dbms_xdb.setftpport(2100);
PL/SQL procedure successfully completed.
SQL> select dbms_xdb.getftpport() from dual;
DBMS_XDB.GETFTPPORT()
---------------------
2100
SQL> show parameter dispatchers;
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
dispatchers string (PROTOCOL=TCP) (SERVICE=benguo
XDB)
max_dispatchers integer
SQL> exit
[oracle@rac101 ~]$ ftp
ftp> open rac101 2100
Connected to rac101.
220- rac101
Unauthorised use of this FTP server is prohibited and may be subject to civil and criminal prosecution.
220 rac101 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
Name (rac101:oracle): system
331 pass required for SYSTEM
Password:
230 SYSTEM logged in
Remote system type is Unix.
ftp> dir
227 Entering Passive Mode (192,168,0,2,8,102)
150 ASCII Data Connection
drw-r--r-- 2 SYS oracle 0 OCT 22 22:08 public
drw-r--r-- 2 SYS oracle 0 OCT 22 22:08 sys
-rw-r--r-- 1 SYS oracle 0 AUG 14 04:42 xdbconfig.xml
226 ASCII Transfer Complete
ftp> cd sys
250 CWD Command successful
ftp> ls
227 Entering Passive Mode (192,168,0,2,168,103)
150 ASCII Data Connection
drw-r--r-- 2 SYS oracle 0 OCT 22 22:08 acls
drw-r--r-- 2 SYS oracle 0 OCT 22 22:08 apps
drw-r--r-- 2 SYS oracle 0 OCT 22 22:08 asm
drw-r--r-- 2 SYS oracle 0 OCT 22 22:08 log
drw-r--r-- 2 SYS oracle 0 OCT 22 22:08 oid
drw-r--r-- 2 SYS oracle 0 OCT 22 22:08 schemas
226 ASCII Transfer Complete
ftp> cd asm
250 CWD Command successful
ftp> ls
227 Entering Passive Mode (192,168,0,2,31,215)
150 ASCII Data Connection
drw-r--r-- 2 SYS oracle 0 AUG 14 04:44 DISKVOL1
226 ASCII Transfer Complete
ftp> cd diskvol1
250 CWD Command successful
ftp> ls
227 Entering Passive Mode (192,168,0,2,113,58)
150 ASCII Data Connection
drw-r--r-- 2 SYS oracle 0 AUG 14 04:44 BENGUO
226 ASCII Transfer Complete
ftp> cd benguo
250 CWD Command successful
ftp> ls
227 Entering Passive Mode (192,168,0,2,205,74)
150 ASCII Data Connection
drw-r--r-- 2 SYS oracle 0 AUG 14 04:44 DATAFILE
drw-r--r-- 2 SYS oracle 0 AUG 14 04:44 CONTROLFILE
drw-r--r-- 2 SYS oracle 0 AUG 14 04:44 ONLINELOG
drw-r--r-- 2 SYS oracle 0 AUG 14 04:44 TEMPFILE
drw-r--r-- 2 SYS oracle 0 AUG 14 04:44 PARAMETERFILE
-rw-r--r-- 1 SYS oracle 4608 AUG 14 04:44 spfilebenguo.ora
drw-r--r-- 2 SYS oracle 0 AUG 14 04:44 ARCHIVELOG
226 ASCII Transfer Complete
ftp> cd datafile
250 CWD Command successful
ftp> binary
200 Type set to I.
ftp> get TEST.675.791226421 /tmp/TEST.675.791226421
local: /tmp/TEST.675.791226421 remote: TEST.675.791226421
227 Entering Passive Mode (192,168,0,2,79,20)
150 BIN Data Connection
226 BIN Transfer Complete
104865792 bytes received in 0.61 seconds (1.7e+05 Kbytes/s)
[oracle@rac101 ~]$ ls -l /tmp/TEST.675.791226421
-rw-r--r-- 1 oracle oinstall 104865792 08-14 12:44 /tmp/TEST.675.791226421
当然也可以利用oracle xdb的http端口来进行复制
SQL> execute dbms_xdb.sethttpport(8080);
PL/SQL procedure successfully completed.
SQL> select dbms_xdb.gethttpport() from dual;
DBMS_XDB.GETHTTPPORT()
----------------------
8080
然后通过crt的端口转发把远程数据库的8080端口转发到本地的8080端口,可以在本地的windows环境下利用http下载。
[root@rac101 ~]# wget --http-user=system --http-passwd=xiaoyu http://rac101:8080/sys/asm/DISKVOL1/BENGUO/DATAFILE/TEST.675.791226421
--2012-08-14 13:39:42-- http://rac101:8080/sys/asm/DISKVOL1/BENGUO/DATAFILE/TEST.675.791226421
正在解析主机 rac101... 192.168.0.2
Connecting to rac101|192.168.0.2|:8080... 已连接。
已发出 HTTP 请求,正在等待回应... 401 Unauthorized
Connecting to rac101|192.168.0.2|:8080... 已连。
已发出 HTTP 请求,正在等待回应... 200 OK
长度:104865792 (100M)
Saving to: `TEST.675.791226421'
4% [====> ] 4,646,240 --.-K/s eta 8m 14s
在oracle 10g后,xdb也不会随着listener的启动后而http和ftp占用了系统的8080和2100端口,初始值中他们都是0端口,也就是没有予以设置,而9i下xdb的会随着listener的启动后,xdb’的http和ftp就会默认的占用了8080端口和2100端口,对于系统中如果存在了tomcat应用中间件,会占用tomcat的8080端口。如果需要在数据库层面上修改,可以执行如下的脚本。(10g后很方便,手动设置即可)
SQL> call dbms_xdb.cfg_update(updateXML(
2 dbms_xdb.cfg_get()
3 , /xdbconfig/sysconfig/protocolconfig/httpconfig/http-port/text()
4 , 8081))
5 /
Call completed.
SQL> -- Change the FTP port from 2100 to 2111
SQL> call dbms_xdb.cfg_update(updateXML(
2 dbms_xdb.cfg_get()
3 , /xdbconfig/sysconfig/protocolconfig/ftpconfig/ftp-port/text()
4 , 2111))
5 /
Call completed.
SQL> COMMIT;
Commit complete.
SQL> EXEC dbms_xdb.cfg_refresh;
PL/SQL procedure successfully completed.
[@more@]
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/25362835/viewspace-1059176/ ,如需转载,请注明出处,否则将追究法律责任。