asm下用xdb的http ftp備份db

dotaddjj發表於2012-08-14

Oracle XDBoracle 9i推出的oracle XML資料庫,oracle xdb資料能透過基於http服務的8080 tcp埠或基於ftp服務的2100埠訪問。

對於oracle XDB也是初次接觸,昨天群的網友問到關於asm管理的資料庫如何做物理備份,其實當然根據物理備份可以分為使用者管理的備份和oracle管理的備份,rman屬於oracle管理的備份,如果不利用rman那就要使用使用者管理的備份,普通的cp肯定是不行的,asmos上是透明的,那麼可以使用oracle xdbftp 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 xdbhttp埠來進行復制

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

--2012-08-14 13:39:42--

正在解析主機 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的啟動後而httpftp佔用了系統的80802100埠,初始值中他們都是0埠,也就是沒有予以設定,而9ixdb的會隨著listener的啟動後,xdb’httpftp就會預設的佔用了8080埠和2100埠,對於系統中如果存在了tomcat應用中介軟體,會佔用tomcat8080埠。如果需要在資料庫層面上修改,可以執行如下的指令碼。(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部落格 ” ,連結:http://blog.itpub.net/25362835/viewspace-1059176/,如需轉載,請註明出處,否則將追究法律責任。

相關文章