Thank you John Scott(@aejes) : I enjoyed your web socket session and that's the best session I ever attended in #ODTUG.
Dear Readers,
Views expressed in this blog are my personal opinion and not necessary reflect the Company I work/worked for.
Occasionally I invent something and most of the time I ask Google to help me solve my problems.
I enjoy reading tech articles when I find some time/during break.
Thanks for visiting my blog and Enjoy Reading!!
Wednesday, June 27, 2012
Monday, May 14, 2012
Apex 4.1 + RESULT_CACHE_MODE (FORCE) = Apex Bug
After banging my head with my Apex 4.1 upgraded laptop for a month, I finally invented the above equation.
Wondering what it means and how I found it, then you need to read the whole (real) story.
I was trying to upgrade my Apex 4.0 laptop to Apex 4.1 and after the upgrade everything seems to be fine. However when I tried to import an application, this is how my "File Character Set" drop down looked.
However I know some of my Post Apex upgrade steps are the one causing this error and I could not be able to believe the following statement is what actually causing this error/bug.
SQL> ALTER SYSTEM SET RESULT_CACHE_MODE = 'FORCE' SCOPE = BOTH;
After changing this back to System Default which is MANUAL, I got my File Character Set back.
SQL> ALTER SYSTEM SET RESULT_CACHE_MODE = 'MANUAL' SCOPE = BOTH;
Now my Application import screen looks like this.
Please check your RESULT_CACHE_MODE settings on your Database server especially if you use Apex 4.1.
I have been using RESULT_CACHE_MODE = 'FORCE' with Apex 4.0 and I never had issues with that.
Please leave a comment if you are experiencing the same issue.
Wondering what it means and how I found it, then you need to read the whole (real) story.
I was trying to upgrade my Apex 4.0 laptop to Apex 4.1 and after the upgrade everything seems to be fine. However when I tried to import an application, this is how my "File Character Set" drop down looked.
However I know some of my Post Apex upgrade steps are the one causing this error and I could not be able to believe the following statement is what actually causing this error/bug.
SQL> ALTER SYSTEM SET RESULT_CACHE_MODE = 'FORCE' SCOPE = BOTH;
After changing this back to System Default which is MANUAL, I got my File Character Set back.
SQL> ALTER SYSTEM SET RESULT_CACHE_MODE = 'MANUAL' SCOPE = BOTH;
Now my Application import screen looks like this.
Please check your RESULT_CACHE_MODE settings on your Database server especially if you use Apex 4.1.
I have been using RESULT_CACHE_MODE = 'FORCE' with Apex 4.0 and I never had issues with that.
Please leave a comment if you are experiencing the same issue.
Monday, April 16, 2012
Unix commands for Windows Users
I am not a great fan of Unix CUI and I prefer X-Windows to work with. I already blogged about enabling VNC Server for Linux.
However if you talk to Unix admins they are so passionate about Unix CUI and the power of Unix Scripting language, I don't disagree either.
I would strongly suggest reading some of the Unix books to unlock the full potential of Unix. If you occasionally login to Unix (like me) here are few of the commands you can use.
However if you talk to Unix admins they are so passionate about Unix CUI and the power of Unix Scripting language, I don't disagree either.
I would strongly suggest reading some of the Unix books to unlock the full potential of Unix. If you occasionally login to Unix (like me) here are few of the commands you can use.
- Secure Copy (scp). This command is useful if you want to copy file from one server to other.
- Update: Use rsync (given below)instead of scp
$scp foo.txt user@<destination server>:<destination folder/>foo.txt
if you want to copy entire directory
$scp -r foo user@<destination server>:foo
if you also wants to preserve file timestamp, so that it doesn't look like all the files are recently created / modified in the destination server use -p
$scp -r -p foo user@<destination server>:foo
- Soft Links. This is similar to windows shortcuts, however from the file system perspective it will look like a read directory. Even though you are creating a shortcut, you still need to have read access to the folder.
ln -s <destination folder name> <linkname>
- which - Helps you find the location of the file you will execute when you type the name from the command prompt. This will become handy especially when you have multiple version of same program (Like java) and you have no idea which one is being executed.
$which java
- Taking a peek at running processes
$ps -ef
- Unix has multiple utilities to automate tasks. I think most famous ones are Cron & Autosys. It's similar to Windows Task Scheduler, however there is no GUI. If you want to use crontab to schedule jobs here is the format.
Crontab
* * * * *
| | | | | +--- command to be executed
| | | | +------ day of week (0 - 6) (Sunday=0)
| | | +--------- month (1 - 12)
| | +------------ day of month (1 - 31)
| +---------------- hour (0 - 23)
+-------------------- min (0 - 59)
30 15 * * 1-5 /usr/bin/ksh <shell Script> --> This will run your script at 3.30 PM, Mon-Fri.
$crontab -l --> Will list scheduled tasks
$crontab -e --> Will let you edit the task in VI Editor.
Finally if you don't know how to use a particular command, Unix has powerful built in help called man (stands for manual). That's your "F1" key for Unix.
Update: 11/22/13
rsync
This is most powerful and my most favorite command for synchronizing directories across multiple servers or the same machine.
Format: Please go through man rsync to take a quick at all available options.
Most common format:
rsync -avzh <source> <destination>
source or destination can be in any of the following format
/home/balaji/mydata => mydata directory present locally
balaji@unix_server2:/home/balaji/mydata =>Connect to unix_server2 as balaji and synchronize my_data directory
For example if you want to synchronize mydata directory present under your home in unix_server1 with unix_server2 the command will look like.
Assuming you logged into unix_server1
[balaji@unix_server1 ~]$ rsync -avzh /home/balaji/mydata balaji@unix_server2:/home/balaji
Please note: you don't need to specify "mydata" again on the destination side and it will automatically create it. Also the above options retains the file modification time as well.
Now lets look at the options
a->archive (Included -rlptgoD)
r->recursive
l->copy symlinks as symlinks
p->preserve permissions
t->preserve modification times
v->verbose
z->Compress data during transfer
h->human readable
n-> Dry Run .. Nothing gets copied . It pretends as if it is copying but does nothing. Just add "n" to options if you not sure about your sync command.
Here is the nice part of it, if you run this command multiple times, it sends just the updated files since the last run and is super quick.
Update: 11/22/13
rsync
This is most powerful and my most favorite command for synchronizing directories across multiple servers or the same machine.
Format: Please go through man rsync to take a quick at all available options.
Most common format:
rsync -avzh <source> <destination>
source or destination can be in any of the following format
/home/balaji/mydata => mydata directory present locally
balaji@unix_server2:/home/balaji/mydata =>Connect to unix_server2 as balaji and synchronize my_data directory
For example if you want to synchronize mydata directory present under your home in unix_server1 with unix_server2 the command will look like.
Assuming you logged into unix_server1
[balaji@unix_server1 ~]$ rsync -avzh /home/balaji/mydata balaji@unix_server2:/home/balaji
Please note: you don't need to specify "mydata" again on the destination side and it will automatically create it. Also the above options retains the file modification time as well.
Now lets look at the options
a->archive (Included -rlptgoD)
r->recursive
l->copy symlinks as symlinks
p->preserve permissions
t->preserve modification times
v->verbose
z->Compress data during transfer
h->human readable
n-> Dry Run .. Nothing gets copied . It pretends as if it is copying but does nothing. Just add "n" to options if you not sure about your sync command.
Here is the nice part of it, if you run this command multiple times, it sends just the updated files since the last run and is super quick.
Directory size
To find the space left at the volume level us
$df - h
If you want to find the size of a directory for example, mydata then use
$du -skh /home/balaji/mydata
Sunday, April 15, 2012
Enabling VNC Server in Linux
Linux comes in lot of flavors and steps you need to follow to enable VNC Server may be slightly different. Google is your best friend.
Try these steps for Redhat and best of luck.
"ps -la" will list all user processes and you can find VNC processes and kill it using "kill -9 <VNC Process ID>"
Cleaning up VNC Files
rm ~home/.vnc/<hostname>*
rm /tmp/.X*lock
rm /tmp/.X11-unix
Try these steps for Redhat and best of luck.
- Review ~home/.vnc/xstartup file and you may have to uncomment first couple of lines to enable VNC Session manager
Stopping VNC
- Start VNC by executing /usr/bin/vncserver command . For the first time, you need to setup a password to protect your VNC Session.
"ps -la" will list all user processes and you can find VNC processes and kill it using "kill -9 <VNC Process ID>"
Cleaning up VNC Files
rm ~home/.vnc/<hostname>*
rm /tmp/.X*lock
rm /tmp/.X11-unix
Thursday, March 8, 2012
Microsoft Excel 2010 Tips
I got this link from Microsoft promotional email and I am so happy I did not ignore/delete this email.
Want to know why, click on the link and it has cool Excel tips.
Excel Skills Builder—Learn how to create spreadsheets and workbooks, use formulas, and perform data analysis - Office.com:
'via Blog this'
Want to know why, click on the link and it has cool Excel tips.
Excel Skills Builder—Learn how to create spreadsheets and workbooks, use formulas, and perform data analysis - Office.com:
'via Blog this'
Monday, November 14, 2011
Are we going to have jQueryMobile RC3 before 1.0?
This releases pushes Apex 4.2 since jQueryMobile is not production yet.
Sunday, November 13, 2011
Managing Apex Listener on Apache Tomcat
On my previous post I have blogged about installing Apex Listener on Apache Tomcat. In this post I will cover, creating Admin user for Apex Listener and managing it.
Reference: https://forums.oracle.com/forums/thread.jspa?threadID=2174509&start=15&tstart=0
Open up "tomcat-users.xml" file present in the <Tomcat Home>/conf location.
Add the following lines of code under tomcat-users element.
Restart Tomcat and now you can access Apex Listener using
http://localhost:8080/apex/listenerAdmin
You can as well access administer Tomcat using the same password and following URL
http://localhost:8080/manager/
Perhaps you can use the same to deploy war files
Note: You must access Tomcat directly to gain access. If you are trying to access Tomcat through Reverse Proxy server like ISA or if you have internet facing Apache infront of Tomcat, you will not be able to gain access to Admin module. I learned it in a hard way.
I will blog about connecting to multiple Databases from single Apex Listener seperately.
Reference: https://forums.oracle.com/forums/thread.jspa?threadID=2174509&start=15&tstart=0
Open up "tomcat-users.xml" file present in the <Tomcat Home>/conf location.
Add the following lines of code under tomcat-users element.
<tomcat-users>
<role rolename="Manager"/>
<role rolename="Admin"/>
<role rolename="manager-status"/>
<role rolename="manager-gui"/>
<role rolename="manager-script"/>
<role rolename="manager-jmx"/>
<user username="apexStatus" password="apex Status Password goes here" roles="Manager"/>
<user username="apexAdmin" password="apex Admin Password goes here" roles="Admin,manager-status,manager-gui,manager-script,manager-jmx"/>
</tomcat-users>
Restart Tomcat and now you can access Apex Listener using
http://localhost:8080/apex/listenerAdmin
You can as well access administer Tomcat using the same password and following URL
http://localhost:8080/manager/
Perhaps you can use the same to deploy war files
Note: You must access Tomcat directly to gain access. If you are trying to access Tomcat through Reverse Proxy server like ISA or if you have internet facing Apache infront of Tomcat, you will not be able to gain access to Admin module. I learned it in a hard way.
I will blog about connecting to multiple Databases from single Apex Listener seperately.
Thursday, November 10, 2011
Running Oracle Apex Listener on Apache Tomcat
WARNING: This configuration is NOT supported by Oracle. You are risking it on your own.
Even though Oracle doesn't support Tomcat as one of the supported platform for Apex Listener, nothing stops you from trying it. Here are the steps to make it work.
Before you try, I assume you already have an Oracle database running with Apex installed on it.
If not you can download Oracle 11g R2 Express Edition from
http://www.oracle.com/technetwork/database/express-edition/downloads/index.html
and Application Express from http://www.oracle.com/technetwork/developer-tools/apex/downloads/index.html
1. Download and install Apache Tomcat http://tomcat.apache.org/ I have used Tomcat 6.0 before and for this blog I am going to try it on Tomcat 7.0. I have installed it on "C:\Program Files\Apache Software Foundation\Tomcat 7.0" directory port 8080 on my PC. If you have installed successfully you should be able to access it from your browser using http://localhost:8080/
2. Download Apex Listener from Oracle OTN website. Latest production version available while writing this blog was Apex Listener V 1.1.3.
http://www.oracle.com/technetwork/developer-tools/apex-listener/downloads/index.html
3. Extract the Apex Listener and copy "apex.war" file to the <Tomcat Home>/webapps directory. In my case "C:\Program Files\Apache Software Foundation\Tomcat 7.0\webapps"
4. Open up your browser and start configuring Apex listener by accessing the URL listed below. Type in the password for APEX_PUBLIC_USER, verify database connection options and hit "Apply" button.
http://localhost:8080/apex/listenerConfigure
5. If everything goes well, you should be able to see a page similar to this. Don't freak out, Page is broken just because you haven't finished copying Apex images folder.
6. Tomcat webserver root folder is <Tomcat Home>\webapps\ROOT in my case "C:\Program Files\Apache Software Foundation\Tomcat 7.0\webapps\ROOT". I ended up copying Apex images folder to "i" folder under ROOT since "images" maps to "i" in apex. If you are trying it out in Unix/Linux you can avoid this step by creating a soft link to pointing to the images folder. After copying the images you should be able to access the same page with all the images successfully. If you got it correctly, CONGRATULATIONS, you have just configured Apex Listener on Apache Tomcat successfully.
I will cover Managing Apex Listener on my next blog post.
Even though Oracle doesn't support Tomcat as one of the supported platform for Apex Listener, nothing stops you from trying it. Here are the steps to make it work.
Before you try, I assume you already have an Oracle database running with Apex installed on it.
If not you can download Oracle 11g R2 Express Edition from
http://www.oracle.com/technetwork/database/express-edition/downloads/index.html
and Application Express from http://www.oracle.com/technetwork/developer-tools/apex/downloads/index.html
1. Download and install Apache Tomcat http://tomcat.apache.org/ I have used Tomcat 6.0 before and for this blog I am going to try it on Tomcat 7.0. I have installed it on "C:\Program Files\Apache Software Foundation\Tomcat 7.0" directory port 8080 on my PC. If you have installed successfully you should be able to access it from your browser using http://localhost:8080/
2. Download Apex Listener from Oracle OTN website. Latest production version available while writing this blog was Apex Listener V 1.1.3.
http://www.oracle.com/technetwork/developer-tools/apex-listener/downloads/index.html
3. Extract the Apex Listener and copy "apex.war" file to the <Tomcat Home>/webapps directory. In my case "C:\Program Files\Apache Software Foundation\Tomcat 7.0\webapps"
4. Open up your browser and start configuring Apex listener by accessing the URL listed below. Type in the password for APEX_PUBLIC_USER, verify database connection options and hit "Apply" button.
http://localhost:8080/apex/listenerConfigure
5. If everything goes well, you should be able to see a page similar to this. Don't freak out, Page is broken just because you haven't finished copying Apex images folder.
6. Tomcat webserver root folder is <Tomcat Home>\webapps\ROOT in my case "C:\Program Files\Apache Software Foundation\Tomcat 7.0\webapps\ROOT". I ended up copying Apex images folder to "i" folder under ROOT since "images" maps to "i" in apex. If you are trying it out in Unix/Linux you can avoid this step by creating a soft link to pointing to the images folder. After copying the images you should be able to access the same page with all the images successfully. If you got it correctly, CONGRATULATIONS, you have just configured Apex Listener on Apache Tomcat successfully.
I will cover Managing Apex Listener on my next blog post.
Tuesday, November 8, 2011
Open up Network access in Oracle 11g in 3 lines of code
If you want to quickly open up internet access to an Database User in Oracle 11g, here is the 3 lines of code you need to execute (Of course as SYSTEM or SYS)
BEGIN
DBMS_NETWORK_ACL_ADMIN.CREATE_ACL('allow_access.xml','Allows Users to access internet using UTL_HTTP', 'SCOTT', TRUE, 'connect');
DBMS_NETWORK_ACL_ADMIN.ADD_PRIVILEGE('allow_access.xml' ,' SCOTT', TRUE, 'resolve');
DBMS_NETWORK_ACL_ADMIN.ASSIGN_ACL('allow_access.xml','*');
COMMIT;
END;
/
This will allow DB User SCOTT to access any websites using UTL_HTTP.
Note: This is not advisable on a production and you may have to restrict access based on website and port.
More details at: http://download.oracle.com/docs/cd/B28359_01/appdev.111/b28419/d_networkacl_adm.htm
BEGIN
DBMS_NETWORK_ACL_ADMIN.CREATE_ACL('allow_access.xml','Allows Users to access internet using UTL_HTTP', 'SCOTT', TRUE, 'connect');
DBMS_NETWORK_ACL_ADMIN.ADD_PRIVILEGE('allow_access.xml' ,' SCOTT', TRUE, 'resolve');
DBMS_NETWORK_ACL_ADMIN.ASSIGN_ACL('allow_access.xml','*');
COMMIT;
END;
/
This will allow DB User SCOTT to access any websites using UTL_HTTP.
Note: This is not advisable on a production and you may have to restrict access based on website and port.
More details at: http://download.oracle.com/docs/cd/B28359_01/appdev.111/b28419/d_networkacl_adm.htm
Thursday, November 3, 2011
Passing User credentials for Web Proxy server in UTL_HTTP
All most all corporates uses Web proxy server to allow their employees to access internet. This way they have great control on who gets to see what site etc. When you try to access a web page using IE it doesn't ask for the network user id and password however Firefox and Safari may ask for the same to send it over to the Proxy server.
UTL_HTTP helps us to consume web resources through PL SQL, it can as well accept Web Proxy Server to connect to the internet. However you will get an access denied error message if your Proxy Server requires user authentication.
You can overcome this by allowing HTTP requests from Database server in your Web Proxy server or by simply passing your user credentials while specifying the Proxy server in UTL_HTTP request like this.
SELECT UTL_HTTP.REQUEST('http://www.google.com','http://<Your Network ID>:<Your Password>@webproxy.yourcompany.com:<Port>') from dual
PS: By default web access using UTL_HTTP access is denied in Oracle 11g onwards. You need to create an ACL to allow the traffic flow through Oracle database.
If you don't know the Web proxy server, contact your network administrator or you can find the same from Internet Explorer Tools->Internet Options->Connections->LAN Settings page. If you use automatic configuration script, type that address directly on your browser and look inside that file to locate your Proxy server.
Finally you have to pass the user credentials to the proxy server and no to the website you are browsing (I often do this mistake).
References: http://download.oracle.com/docs/cd/E11882_01/appdev.112/e25788/u_http.htm#ARPLS71019
UTL_HTTP helps us to consume web resources through PL SQL, it can as well accept Web Proxy Server to connect to the internet. However you will get an access denied error message if your Proxy Server requires user authentication.
You can overcome this by allowing HTTP requests from Database server in your Web Proxy server or by simply passing your user credentials while specifying the Proxy server in UTL_HTTP request like this.
SELECT UTL_HTTP.REQUEST('http://www.google.com','http://<Your Network ID>:<Your Password>@webproxy.yourcompany.com:<Port>') from dual
PS: By default web access using UTL_HTTP access is denied in Oracle 11g onwards. You need to create an ACL to allow the traffic flow through Oracle database.
If you don't know the Web proxy server, contact your network administrator or you can find the same from Internet Explorer Tools->Internet Options->Connections->LAN Settings page. If you use automatic configuration script, type that address directly on your browser and look inside that file to locate your Proxy server.
Finally you have to pass the user credentials to the proxy server and no to the website you are browsing (I often do this mistake).
References: http://download.oracle.com/docs/cd/E11882_01/appdev.112/e25788/u_http.htm#ARPLS71019
Subscribe to:
Posts (Atom)

