Hi,

As we all know with asm it is not possible see to asm files so ideally we should not be able to use ftp and http protocol to access asm files. But it is possible to use ftp and Http protocol with the help of XML DB Feature of Database.

Because ASM is not a regular file system, you can’t use the standard FTP and HTTP services to access these files. To access them, you can use the file mapping functionalities provided by the Oracle XML Database (Oracle XML DB) feature. This section shows you how to set up FTP and HTTP to access the ASM files and transfer them as regular OS files. This access requires a one-time setup.

Setup. FTP and HTTP services are mapped to a port on the server. By default, the FTP and HTTP services run on ports 21 and 80, respectively. However, ASM FTP and HTTP do not use the default services; they use the specialized services provided by Oracle XML DB. You have to use two different ports—one for FTP and the other for HTTP services. Typically, Oracle users choose 7777 for FTP and 8080 for HTTP, but you are free to choose any unused port number. For my setup, I want to use 8080 for HTTP and 7787 for FTP. I use the 7787 port deliberately, to show how different port numbers can be used.

To set up the FTP access, I must first set up the Oracle XML DB access to the ASM folders. I can do this by executing the catxdbdbca.sql script, found in the $ORACLE_HOME/rdbms/admin directory. The script takes two parameters: the port numbers for the FTP and HTTP services, respectively. So I run the script as follows:

@catxdbdbca 7787 8080

Running the script enables an FTP service listening on port 7787 and an HTTP service on port 8080. I can access the ASM folders from an external source, using a regular FTP client (such as ftp.exe, provided in Windows). Listing 5 shows a sample FTP session on a Windows system accessing ASM folders. To clarify the explanation, I have prefixed each line with a line number; the line numbers do not appear in the actual output.

ftp> open 172.17.240.158 7787
Connected to 172.17.240.158.
220- 01HW105868
Unauthorised use of this FTP server is prohibited and may be subject to civil a
d criminal prosecution.
220 01HW105868 FTP Server (Oracle XML DB/Oracle Database) ready.
User (172.17.240.158:(none)): system
331 pass required for SYSTEM
Password:
230 SYSTEM logged in
ftp>
ftp> cd /sys/asm
250 CWD Command successful
ftp> ls
200 PORT Command successful
150 ASCII Data Connection
DGROUP1
DB_DSK_GRP
226 ASCII Transfer Complete
ftp: 21 bytes received in 0.48Seconds 0.04Kbytes/sec.
ftp> cd dgroup1
250 CWD Command successful
ftp> ls
200 PORT Command successful
150 ASCII Data Connection
TEST
DB_UNKNOWN
226 ASCII Transfer Complete
ftp: 18 bytes received in 0.05Seconds 0.35Kbytes/sec.
ftp> cd test
250 CWD Command successful
ftp> ls
200 PORT Command successful
150 ASCII Data Connection
CONTROLFILE
ONLINELOG
DATAFILE
TEMPFILE
spfiletest.ora
226 ASCII Transfer Complete
ftp: 60 bytes received in 0.32Seconds 0.19Kbytes/sec.
ftp> cd datafile
250 CWD Command successful
ftp> ls
200 PORT Command successful
150 ASCII Data Connection
SYSTEM.258.626547147
UNDOTBS1.257.626547167
SYSAUX.264.626547181
USERS.261.626547197
226 ASCII Transfer Complete
ftp: 89 bytes received in 0.05Seconds 1.78Kbytes/sec.
ftp> get sysaux.264.626547181
200 PORT Command successful
150 ASCII Data Connection
226 ASCII Transfer Complete
ftp: 167780352 bytes received in 22.19Seconds 7560.06Kbytes/sec.
ftp>

Command-line ASM management with ASMCMD requires no SQL. It also opens up possibilities for scripting ASM operations. The FTP and HTTP interfaces—available through Oracle XML DB—provide access to ASM files and the ability to copy them and use them as conventional OS files.

 

Leave a Reply