Wednesday, January 25, 2006

XE: Changing the default http port

Oracle XE uses the embedded http listener that comes with the XML DB (XDB) to serve http requests. The default port for HTTP access is 8080.

It also supports the WebDAV protocol just as well as FTP.

You can determine the current configuration using the following commands when you connect to XE as the oracle user SYSTEM (or any other DBA):

C:\WINDOWS\system32>sqlplus system@xe

SQL*Plus: Release 10.1.0.2.0 - Production on Mi Jan 25 11:44:33 2006

Copyright (c) 1982, 2004, Oracle. All rights reserved.

Enter password:

Connected to:
Oracle Database 10g Express Edition Release 10.2.0.1.0 - Beta

SQL> -- get current status
SQL> select dbms_xdb.gethttpport as "HTTP-Port"
, dbms_xdb.getftpport as "FTP-Port" from dual;

HTTP-Port FTP-Port
---------- ----------
8080 0

You can change the http port and the ftp port to whatever you like (keep in mind that you need special privileges for ports < 1024 on Unix/Linux systems).

SQL> -- set http port and ftp port
SQL> begin
2 dbms_xdb.sethttpport('80');
3 dbms_xdb.setftpport('2100');
4 end;
5 /

PL/SQL procedure successfully completed.

SQL> select dbms_xdb.gethttpport as "HTTP-Port"
, dbms_xdb.getftpport as "FTP-Port" from dual;

HTTP-Port FTP-Port
---------- ----------
80 2100

If you only want to use the database without allowing access via http or ftp then you can disable both:

SQL> -- disable http and ftp access
SQL> begin
2 dbms_xdb.sethttpport('0');
3 dbms_xdb.setftpport('0');
4 end;
5 /

PL/SQL procedure successfully completed.

SQL> -- get current status
SQL> select dbms_xdb.gethttpport as "HTTP-Port"
, dbms_xdb.getftpport as "FTP-Port" from dual;

HTTP-Port FTP-Port
---------- ----------
0 0

~Dietmar

72 comments:

Anonymous said...

Hi, Dietmar:

It is very nice of you to post some of the how-tos in your blog. I have a question related to this post:

How can I enable SSL on Oracle XE?

I already have the certificate for my site.

Thanks,

Thomas Zhang

email: tzhang@healthcapable.com

Narukung said...

Thank you : ]

Anonymous said...

Prima, Google liefert mir den Blog bei oracle + xe + http + port als allerersten.

Irgendwas hast du wohl richtig gemacht. Hat funktioniert, herzlichen Dank daf├╝r! ;-)

Anonymous said...

Hi, Dietmar:

I am trying to change http port to 80 from 8080.

I am not getting any error when i do the following

begin
dbms_xdb.sethttpport('8080');
end;
/

but when i check listener status i dont see anythig running on port 80.

I am running sethttport as sys and os user root.

Do i need to do anything different to change default port to 80.

Regards
SB

daust_de said...

Hi SB,

it seems like you are running on Linux (os user root). It is not easy to use a port below 1024 for Oracle, since you need the oracle process to run as root. This is not advisable.

The bottom line:
- You can easily change the port on Linux, but not below 1024!!!
- You can set up a plain Apache as a proxy to XE, this is advisable anyway.

For configuring Apache as a proxy to XE you can find more information here:
http://forums.oracle.com/forums/thread.jspa?messageID=1142169�
http://forums.oracle.com/forums/message.jspa?messageID=1146001#1146978

Regards,
~Dietmar.

Raghuveer Reddy said...

I installed both javawebserver, oracle 10xe.

Because both are listening to port 8080, i got some errors.

using the above menctioned technique i changed the oracle http port to 80.

The Problem has resolved.

Thanks to all....

ptspop said...

why do network administrators change their http port numbers

mudit vaidya said...

hello ,

i have installed 10g XE on my PC and i am using Windows XP SP2.

The firewall is turned off and i dont have any anti-virus installed.

The command select dbms_xdb.gethttpport() from dual;

gives the following output

DBMS_XDB.GETHTTPPORT()
----------------------
8080
This shows that the port 8080 is being used by oracle.
But when i try to open the homepage using http://127.0.0.1:8080/apex/ the page is not displayed.

Both the services OracleXE and OracleTNS are running.

No other service is using port 8080 which i figured out by using netstat -na command.

I use the command exec dbms_xdb.sethttpport(port no.); to change the port no. after which i get the following error

BEGIN dbms_xdb.sethttpport(8080); END;

*
ERROR at line 1:
ORA-31112: fail to unregister for HTTP port using xdb configuration
ORA-06512: at "XDB.DBMS_XDB", line 382
ORA-06512: at "XDB.DBMS_XDB", line 521
ORA-06512: at line 1

but when i restart and check the port using gethttpport() it shows the changed port number.

How to resolve the problem ?

Thanx in advance
Mudit
If possible reply at
muditvaidya@gmail.com

Anonymous said...

Hi Dietmar. I was wondering if you might be able to help me. I stupidly limited http access only to the localhost yesterday via a browser, and i really am not able to log in to a browser on the localhost now to once again allow http access from non-local hosts. Do you know where I can modify this permission command-line? Thank you very much.

Anonymous said...

Answered my own question for allowing remote http access command-line...log in and then...
EXEC DBMS_XDB.SETLISTENERLOCALACCESS(FALSE);

Anonymous said...

Hi Dietmar,

I've installed XDB on 10.2.0.1 manually. The ftp and http ports are also enabled.
But still listner does listen on these ports for XDB.
please see the outputs below :
-----------------------------------
xdb $ sqlplus '/ as sysdba';

SQL*Plus: Release 10.2.0.1.0 - Production on Wed Jul 18 08:14:27 2007

Copyright (c) 1982, 2005, Oracle. All rights reserved.


Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bit Production
With the Partitioning, OLAP and Data Mining options

SQL> select dbms_xdb.gethttpport as "HTTP-Port" , dbms_xdb.getftpport as "FTP-Port" from dual;

HTTP-Port FTP-Port
---------- ----------
8080 2100

SQL> exit
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bit Production
With the Partitioning, OLAP and Data Mining options
xdb $ lsnrctl status

LSNRCTL for Solaris: Version 10.2.0.1.0 - Production on 18-JUL-2007 08:19:53

Copyright (c) 1991, 2005, Oracle. All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Solaris: Version 10.2.0.1.0 - Production
Start Date 18-JUL-2007 07:53:28
Uptime 0 days 0 hr. 26 min. 25 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/app/oracle/product/10.2.0/network/admin/listener.ora
Listener Log File /u01/app/oracle/product/10.2.0/network/log/listener.log
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=127.0.0.1)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=127.0.0.1)(PORT=2481))(PROTOCOL_STACK=(PRESENTATION=GIOP)(SESSION=RAW)))
Services Summary...
Service "AGW.WORLD" has 1 instance(s).
Instance "AGW", status UNKNOWN, has 1 handler(s) for this service...
Service "PLSExtProc" has 1 instance(s).
Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully
xdb $

-----------------------------------

please advise.

thanks in advance, Sugandha

Anonymous said...

can you please explain the aditional step to do xe work on port 80 linux root permisions etc

Rohan said...

Thank You. Worked perfectly.

Anonymous said...

Hi,

I've a silly quiestion.

I've a working Oracle 10.1.0.2 Server running.

I want to use XE to map to my 10.1.0.2 Std/Enpt Server. I want to set the DB of XE, so that I can work with Std/Enpt Server DB, because I like the interface of XE.

Do you have any such information, or where can I get such information.

Kindly help me.

daust_de said...

Hi,

I don't fully understand your question.

Oracle XE comes bundled with Oracle Application Express ( http://www.oracle.com/technology/apex/index.html ) .

Since XE doesn't come with a management gui like the Enterprise Manager frontend, Oracle has provided a minimal application to manage your XE instance. This is in effect a Oracle Application Express application itself.

But this will only work on XE.

You can install Apex into a regular Oracle instance (>9.2.0.3), it already comes preinstalled with 11g.

Does that answer your question? Or did you have something different in mind?

Regards,
~Dietmar.

Anonymous said...

The above post and the subsequent comments form other readers was very helpful, thank you

Anonymous said...

this was helpful, very good and thank you

Anonymous said...

Hi, Dietmar,

I have Oracle XE installed on a laptop and I am using PL SQL to develop an application. When I use the htp.p syntax it display my html pages well except for graphics. I have tried using the graphics paths eg Z:\Icons\, I have tried virtual paths but it points to a folder that I know does not exist at http://127.0.0.1:8080/Z:\Icons.

Can you help with two things:
1. How do I configure my PL SQL app to see the file system path
2. Where do I locate http://127.0.0.1:8080/ root directory.

Thanks

Ice
email:rider_ice@yahoo.com

daust_de said...

Hi Ice,

please, don't use the owa_toolkit directly, to build a new application from scratch.

You can do it a lot easier with Oracle APEX, it comes preinstalled with Oracle XE.
Here is the online XE documentation:
http://www.oracle.com/pls/xe102/homepage

and here is the link to the APEX developers guide:
http://download.oracle.com/docs/cd/B25329_01/doc/appdev.102/b25310/toc.htm

Even better, you should upgrade APEX to the most current version, 3.1.2:
http://www.oracle.com/technology/products/database/application_express/html/why_upgrade_xe.html

For the other questions, please see my post here:
http://daust.blogspot.com/2006/03/where-are-images-of-application.html

It explains where the images can be found. They are not in the filesystem but in the XML database.

Regards,
~Dietmar.

Anonymous said...

Hey wow, thanks a lot, it works perfectly (XE: Changing the default http port)

I needed to change the Port from 8080 to 3080 because of my TomCat webserver witch usere Port 8080.

Thanks guys.
Greetz

Lukas Lowartz

Sreekanth Melam said...

Thanks a lot, Provided info in the blog is very useful for me....

Regards,
Sreekanth

Anonymous said...

Thank you. It worked

Anonymous said...

thanks a lot!

Anonymous said...

Thanks! That's exactly what I needed to know.

Wayne K said...

Instructions work well! Thanks for the help!

Malk said...

worked well...

But now i dont have a Webinterface anymore.
The only thing i see now is a Agreement Contract...

I tried to change it back...
But it doesnt work.

I'm using the XE 10g btw.

Malk

daust_de said...

Hi Malk,

what did you EXACTLY do and what does not work anymore?

*) which port did you change to exactly, was it 8081?

*) which url do you use that doesn't work anymore : http://localhost:8081/apex ?

Cheers,
~Dietmar.

Tine said...

I think it is important to mention that Firewall on the server machine should be opened for newly setup port (eg: 8080( or we might spend too much time on figuring out why this setup is not working. ;)

daust_de said...

Hi tine,

>I think it is important to mention that Firewall on the server machine should be opened for newly setup
>port (eg: 8080( or we might spend too much time on figuring out why this setup is not working. ;)

Which you have just done ;). Thanks for the advice.

Cheers,
Dietmar.

Anonymous said...

Thank you!! =]

AMIR said...

Hi Daust_de,
Could u send me please a complete process of deploying an application made in Apex 4.0 ?
Danke

Ehsun said...

Very clear and helpful.
Thanks

Anonymous said...

This is exactly what I wanted! Thanks a million!

Anonymous said...

thanks bro u really help me

raoulsson said...

Thank you! I come back to this page all couple of months :-)

Jagadeesh said...

Very nice and useful to so many people, Keep it up and share your knowledge

arulnarayanan said...

thank you :)

Anonymous said...

hey, how do we change th shortcut httpport on start menu?
it's still refer on 8080, though i've already change the port

thx in advance

daust_de said...

Hi anonymous,

I would need more information on that. Are you running Oracle XE in Version 10 or Version 11?

Are you running on Linux or Windows?

On Windows running Oracle Database Express Edition 11g Release 2 I would go to the directory D:\oraclexe\app\oracle\product\11.2.0\server and edit the file "get_started".

The contents is:
[InternetShortcut]
URL=http://127.0.0.1:8080/apex/f?p=4950

... so just modify the port and you should be done.

How did I figure this out? I have looked at the corresponding entry in the Windows start menu and did a right click to show the properties. In there it was referring the file mentioned above.

Cheers and good luck,
Dietmar.

Anonymous said...

owh, i use oracle 10XE
is that same as 11XE ?

daust_de said...

Well, 11gXE is the latest release, but the concept for changing the url should be the same. Either you have to modify the entry in the Start > All programs > Oracle Express Edition > ...

or change the file in the filesystem that calls the url.

I assume you are running on Windows although I don't know since you didn't answer my questions. The more specific you ask ... the better the answer ;)

~Dietmar

Anonymous said...

ah, yes, i'm sorry
i'm indeed using windows

daust_de said...

and ... did it work?

cheers,
Dietmar.

Anonymous said...

'Get_Started' was linked on documentation file, so i'd try on 'Database_homepage'
and i change the port written there, but when i klick the link in start menu, it's still directing me on '8080' port
any suggestion ?

daust_de said...

can you make a screenshot of your exact change?

Anonymous said...

something like this ?
http://dl.dropbox.com/u/18335170/IMAGE/oracle.png

daust_de said...

hhhm, that's weird.

I have downloaded and reinstalled the old 10xe version.

You would have to do the following:

Do a right click on the file "Database_homepage", then select "properties". There you will find the url as well.

Surprisingly, this is the url that is called when you double click the file. Don't know why but it is the case on my system.

Does it work on your's, too?

Cheers,
Dietmar.

Anonymous said...

oh, yes..
it works
maybe it just need few times to 'refresh', or something like that
anyway, thx a lot
may i bothering you again sometimes, haha
if you dont mind

Seb said...

Thanks a lot! It worked great!

Anonymous said...

Thanks mate, it was really nice to find some post like this one. Cheers mate

Anonymous said...

i had oracle 10g xe running and also installed tomcat whose server refused to run because oracle was running on port 8080 which is tomcat default port no. also.I changed the port no for oracle using your post.it worked.thanks a lot.

Anonymous said...

Thank you very much. no problem what so ever.
Akhil Malik

Anton said...

Hi, Dietmar
I just install orcle xe 10 g. When i go to database homepge while i not connected to internet with my modem, i successfully open the database homepage
But, when i connected to internet with my modem, the browser won't open the database homepage ,and show this error "Firefox can't establish a connection to the server at 127.0.0.1.".
How can a use oracle xe while connect to then net?

Thanks

Regards
Anton

Shyam said...

Thank you...

salman said...

Oracle XMLDB uses the ports 2100/8080 by default. Sometimes there are problem with other webservers (e.g. JBOSS) running on the same port.

Even if the package dbms_xdb is granted to PUBLIC you need DBA privileges to change the ports.

-- change HTTP port from 8080 to 8083
call dbms_xdb.cfg_update(updateXML(dbms_xdb.cfg_get(), '/xdbconfig/sysconfig/protocolconfig/httpconfig/http-port/text()', 8083));

-- change FTP port from 2100 to 2111
call dbms_xdb.cfg_update(updateXML( dbms_xdb.cfg_get(), '/xdbconfig/sysconfig/protocolconfig/ftpconfig/ftp-port/text()' , 2111));

-- refresh settings
exec dbms_xdb.cfg_refresh;

salman said...

Oracle XMLDB uses the ports 2100/8080 by default. Sometimes there are problem with other webservers (e.g. JBOSS) running on the same port.

Even if the package dbms_xdb is granted to PUBLIC you need DBA privileges to change the ports.

-- change HTTP port from 8080 to 8083

sql>call dbms_xdb.cfg_update(updateXML(dbms_xdb.cfg_get(), '/xdbconfig/sysconfig/protocolconfig/httpconfig/http-port/text()', 8083));

-- change FTP port from 2100 to 2111

sql>call dbms_xdb.cfg_update(updateXML( dbms_xdb.cfg_get(), '/xdbconfig/sysconfig/protocolconfig/ftpconfig/ftp-port/text()' , 2111));



-- refresh settings

sql>exec dbms_xdb.cfg_refresh;

salman said...

exec dbms_xdb.sethttpport(80);

or



sql>begin
2 dbms_xdb.sethttpport('8080');
3 end;
4 /


returns error codes for some un previledge user databases...
refer

http://stackoverflow.com/questions/10840876/how-to-change-port-number-of-http-server-in-either-oracle10g-or-tomcat

Dietmar Aust said...

Hi Anton,

seems like you are having problems with DHCP: http://docs.oracle.com/cd/B19306_01/install.102/b14316/reqs.htm#BABBDGBI

Does that help?

Cheers,
~Dietmar.

Dietmar Aust said...

Hi salman,

can you please post the exact error message?

Also, if you are running on Linux/Unix, then you cannot easily use ports <= 1024.

Cheers,
~Dietmar.

Anantha Narayanan said...

Thanks a lot for the information. It works.

Federico said...

It works perfectly!
Thanks a lot, bye.

F.

Anonymous said...

I tried to follow the instructions on this blog post (using Oracle XE 11.2) and after doing so I can no longer login to APEX, even after switching the port back to 8080. Netstat tells me that the port changes and is listening but I get a 400 error from the server. I am going to have to re-install Oracle XE.

Dietmar Aust said...

This is strange. Very likely due to some other issue.

What did you do exactly?

You also need to provide more information on the operating system.

Sometimes people run into the problem, that they didn't configure the loopback adapter on the box before installing Oracle XE and doing it while being in a network with a DHCP ip address.

Cheers,
~Dietmar.

Erich said...

Dietmar, I don't know how many times I've come back to this page - I guess every time I install OracleXE somewhere. Anyway, if I haven't said it before: thank you very much!

Until next time!

Dietmar Aust said...

Thanks Erich,

yes, even myself I look up this post sometimes ... it serves me as a notebook, too ;).

Cheers,
~Dietmar.

Simone Mondiali said...

thank you very much!

Simone Mondiali said...

thank you very much!

Mike said...

Thank you - this was very helpful!

PRASHANT GAURAV said...

anyone is having idea how to change the port number of oracle 10 g after installation....i installed wordpress bt after installing it my oracle 10g stopped working :(

Dietmar Aust said...

This is too little information.

Here I am providing information on how to change default http port for Oracle XE which is typically set to 8080.

If you have more general questions about XE, you can post them here: https://forums.oracle.com/community/developer/english/oracle_database/oracle_database_express_edition_%28xe%29

Or more general questions about the Oracle database itself, you can post them here: https://forums.oracle.com/community/developer/english/oracle_database/general_questions

Cheers,
~Dietmar.

Anonymous said...

thanks ... worked well ...

Anonymous said...

Thanks a lot. Now, I can run my tomcat freely. Really, thanks a lot