Monday, April 26, 2010
Do you think you are good in PL/SQL ?
http://plsqlchallenge.com
Regards,
ZB
Sunday, March 28, 2010
Creating Master-detail form in Oracle ADF
Posted new blog post How to create Master detail form in Oracle ADF using Jdeveloper 11g
Check here
Have a nice day,
ZB
Monday, March 15, 2010
Monday, March 8, 2010
Moving to Jdeveloper 11g Your First ADF Form
Just posted the simple tutorial how to create Simple ADF form on Jdeveloper 11g hope u guys like
Click here for more Info
Feel free to comment
Have a nice day,
ZB
Thursday, March 4, 2010
How to get Date in Hijrah calendar from Oracle
NLS_CALENDAR by default is GEORGIAN in the database so it displays date in Georgian calendar but on demand if u want HIJRI date in Calendar no worries using To_char we can achieve this
select to_char(sysdate,'fmdd month rrrr','nls_calendar=''arabic hijrah''') from dual
select to_char(sysdate,'fmdd month rrrr','nls_calendar=''english hijrah''') from dual
Output would be like
18 ربيع الأول 1431
18 Rabi' Awwal 1431
If we want our database to follow HIJRI calendar then NLS_CALENDAR parameter need to be change
more info about current database settings and valid values
select * from database_properties;
select * from v$nls_parameters;
select * from v$nls_valid_values;
This tip might helps our Middle-eastern and Saudian guys :)
Regards,
ZB
http://baigsorcl.blogspot.com/
Monday, March 1, 2010
Restore Table to Specific Point in Time without any headache
Sometimes it happens that we wrongly commit delete or update which makes our data logically corrupt before 10g its a time consuming job to restore table to specific point in time or re-import tables from backup etc etc with 10g u can restore it without any problem using FLASHBACK TABLE feature
Click here for more info
Cheers,
ZB
Friday, February 26, 2010
Tuning Oracle 10g AS Reports Server
We shall be focusing on the following aspects of reports engine/server
•Accepting the report request from various clients.
•Scheduling the jobs to run.
•Managing Oracle Reports engines
•Managing the cache
•Managing various destinations
•Security check
•Managing the jobstore (persistent job data)
Ok folks, here we go
1. Finding out the values for the following elements initEngine, maxEngine, and minEngine in the server configuration file:
Calculation and calculations and calculations :(
lets assume:
a) average time in seconds to run a report = 10
b) minimum and maximum numbers of requests to run reports per minute = 5 to 50
now lets convert average run time in minutes = 10/60 = 0.16666
•initEngine = ( average time to run report) * (minimum report requests input rate) = 0.16666 * 5 = 1
•maxEngine = (average time to run report) * (maximum report requests input rate) = .016666 * 50 = 8
•minEngine = Depending on the kind of load, anything between 0 to initEngine
minEngine=1 and maxEngine=8 ensures that whenever a job arrives, it gets an idle engine immediately.
Note:
If you are not using the URL engine, comment the engine element with ID="rwURLEng" in the server configuration file.
2.Lets talk about cacheSize, maxQueueSize, and the EXPIRATION.
EXPIRATION: Cache to hold jobs for certain number of minutes. If EXPIRATION=480, jobs will keep in cache for 4 hours (480 minutes). Therefore, maxQueueSize should be set to accommodate all the jobs for 4 hours. Thus, at a rate of 10 jobs per minute:
maxQueueSize = (report requests input rate) * (expiration period) = 480 * 10 =4800.
The value of cacheSize also should be set sufficiently high to accommodate 4800 jobs. Suppose the average size of each report is 100K:
cacheSize = (maxQueueSize) * (average size of report) = 4800*100/1000 = 480MB
3.Setting up the engineResponseTimeOut
callbackTimeOut="90000" engineResponseTimeOut="10">
The value of engineResponseTimeOut should be set to the maximum time a report takes in the set of reports you have. For example, if you have set of reports that takes 10 seconds to 10 minutes to run, you can set engineResponseTimeOut="10" (10 minutes).
Note:
It is always better to run batch reports on a separate server with different engineResponseTimeOut values. Do not submit interactive and batch reports to same server.
4.Set the maxConnect attribute of the connection element in the server configuration file;
Simple, make the value a little higher than simultaneous clients, say expected simultaneous clients are about 150, you can set maxConnect to any value above 150. You can use a safety factor of 10% to 20%, as follows:
maxConnect = 150 + 150 * 0.2 = 180
5.Set the HTTP timeout value (applicable to AS only).
The HTTP timeout value should be set based on the time required to run the longest report in the system. If longest-running report takes 20 minutes to run, HTTP timeout should be more than 20 minutes. Otherwise, an HTTP timeout error will display when the report is still running in the server. This parameter can be set in the ORACLE_HOME/Apache/Apache/conf/httpd.conf file.
Thanks to OTN
Monday, February 22, 2010
Get rid of quotes signs ' with Oracle 10g and 11g
Recently i have posted this topic on my blog with Oracle 10 and 11g you can avoid the use of additional quotes signs when creating any Literal string ...
Like in reports it is common for us to write something similar to this
e.g ' where hiredate between '||''''||p_from_date||''''||' and '||''''||p_to_date||''''
Click here for more info
Now u can follow me on Twitter as well
Have a nice day,
Baig
http://baigsorcl.blogspot.com/
View Data in Row
EMPID
DEPT
------------
1
A
B
C
Required
EMPID DEPT
------------
1 A, B, C
Can write SQL for above.
CREATE TYPE varchar2_table_t AS TABLE OF VARCHAR2(32767);SELECT empid, CAST(MULTISET(SELECT dept FROM emp WHERE empid = e.empid) ASvarchar2_table_t) FROM emp e GROUP BY empid;
Sunday, February 21, 2010
How to Store & Retrieve Images / Word / Excel / PDF and Movies in Oracle Database using Forms10g
Find out How to Store & Retrieve Images / Word / Excel / PDF and Movies in Oracle Database using Forms10g
I have uploaded working example as well
Have a nice day,
Baig
Thursday, February 18, 2010
ORACLE 10 G Webutil Configuration
WEBUTIL CONFIGURATION Pre-Requisite
ORACLE 10G R2 AS & DEV_SUITE (10.1.2.0.2 OR 10.1.2.3)
Follow this documentation only if you have AS / DEV_SUITE If you have another version of AS / DEV_SUITE backup each of the file referenced in this document before applying any modification.
Note: DEV_SUITE is used as an alias for your real Oracle 10g installation directory
Feel free to copy this note to a text editor, and do a global find/replace on
DEV_SUITE with your actual value (no trailing slash). Then it is easy to
copy/paste actual commands to be executed from the note copy.
DEV_SUITE is used as an alias for your real Oracle 10g Developer Suite installation directory.
----------------------------------------------------------------------------------------------------------------------
PRE-REQUISITE FOR APPLICATION SERVER (Usually Webutil is not installed with ORACLE 10G Application Server)
1- Copy webutil folder from DEV_SUITE/Forms to APP_SERVER/Forms
2- Copy frmwebutil.jar, forms_ie.js, forms_base_ie.js file from DEV_SUITE /Forms/Java folder to APP_SERVER/Forms/Java
3- Copy webutil.cfg, WebutilBase.htm, webutiljini.htm, webutiljpi.htm files from DEV_SUITE/Forms/Server folder to APP_SERVER/Forms/Server
4- Copy webutil.olb,Webutil.pll,webutil.plx files from DEV_SUITE/Forms folder to APP_SERVER/Forms
Webutil Configuration
How to get up and running with WebUtil included with Oracle Developer Suite 10.1.2.0.2 on a win32 platform, I also tested it on Linux and it works well (after of course taking care of the differences in PATH format)
Solution
Assuming a fresh "Complete" install of Oracle Developer Suite 10.1.2.0.2,
here are steps to get a small test form running
Download JACOB_!8.zip
and extract to a temporary staging area. Do not attempt to use 1.7 or 1.9.
1) Copy jacob.jar to DEV_SUITE\forms\java\
2) Copy jacob.dll to DEV_SUITE\forms\webutil\
3) Sign frmwebutil.jar and jacob.jar
Open a DOS command prompt.
Add DEV_SUITE \jdk\bin to the PATH:
set PATH=DEV_SUITE \jdk\bin
Sign the files, and check the output for success:
DEV_SUITE\forms\webutil\sign_webutil DEV_SUITE\forms\java\frmwebutil.jar
DEV_SUITE\forms\webutil\sign_webutil DEV_SUITE\forms\java\jacob.jar
4) If you already have a schema in your RDBMS which contains the WebUtil stored code,
you may skip this step. Otherwise,
Create a schema to hold the WebUtil stored code, and privileges needed to
connect and create a stored package. Schema name "WEBUTIL" is recommended
for no reason other than consistency over the user base.
Open DEV_SUITE\forms\create_webutil_db.sql in a text editor, and delete or comment
out the EXIT statement, to be able to see whether the objects were created witout
errors.
Start SQL*Plus as SYSTEM, and issue:
CREATE USER webutil IDENTIFIED BY a
DEFAULT TABLESPACE users
TEMPORARY TABLESPACE temp;
/
GRANT CONNECT, CREATE PROCEDURE, CREATE PUBLIC SYNONYM TO webutil;
/
CONNECT webutil/webutil@rcci
@DEV_SUITE \forms\create_webutil_db.sql
-- Inspect SQL*Plus output for errors, and then
CREATE PUBLIC SYNONYM webutil_db FOR webutil.webutil_db;
/
Reconnect as SYSTEM, and issue:
grant execute on webutil_db to public;
/
5) Modify DEV_SUITE \forms\server\default.env, and append
DEV_SUITE\jdk\jre\lib\rt.jar; DEV_SUITE\forms\java\jacob.jar;
to the CLASSPATH entry.
(If this entry not exists then add this)
WEBUTIL_CONFIG=/forms/server/webutil.cfg
6) Modify DEV_SUITE \forms\j2ee\orion-web.xml, and append
7) WebUtil needs a single virtual directory to be defined in order to operate. This virtual directory is used to locate various operating system-specific files that WebUtil may need to download.
DEV_SUITE/forms/server/forms.conf
Add the following line to the file
# Virtual path for webutil
AliasMatch ^/forms/webutil/(..*) DEV_SUITE /forms/webutil/$1"
8) Modify DEV_SUITE \forms\server\formsweb.cfg insde [default] add :
(Note these line should be in this order to run webutil properly)
[webutil]
WebUtilArchive=frmwebutil.jar,jacob.jar
WebUtilLogging=off
WebUtilLoggingDetail=normal
WebUtilErrorMode=Alert
WebUtilDispatchMonitorInterval=5
WebUtilTrustInternal=true
WebUtilMaxTransferSize=16384
#baseHTMLjinitiator=webutiljini.htm (UnMark this to use JINITIATOR instead of JRE)
baseHTMLjinitiator=webutiljpi.htm
baseHTMLjpi=webutiljpi.htm
baseHTML=webutilbase.htm
archive_jini=frmall_jinit.jar,icons.jar (For Jinitiator)
archive=frmall.jar,icons.jar (For JRE)
lookAndFeel=oracle
9) DEV_SUITE\forms\server\webutil.cfg
transfer.database.enabled=TRUE
transfer.appsrv.enabled=TRUE
10) Start the OC4J instance
11) Start Forms Builder and connect to a schema in the RDBMS used in step (4).
12) Copy frmWebUtil.fmb to DEV_SUITE \forms\ folder from this documents directory open it in the form builder then
Connect to webutil schema then webutil/webutil@connectstring
Compile the FMB to FMX, after doing a Compile-All (Shift-Control-K). If any runtime error occurs re-attach webutil.pll library then
Compile-All (Shift-Control-K).
Note: For Oracle Application Server, on all platforms, you must regenerate webutil.pll before using it; otherwise you’ll encounter error
ORA-06508 when running a form with the attached library. To recompile, use the following command:
frmcmp module=ORACLE_HOME\forms\webutil.pll
userid=
13) Under Edit->Preferences->Runtime in Forms Builder, click on "Reset to Default" if
the "Application Server URL" is empty.
Then append "?config=webutil" at the end, so you end up with a URL of the form
http://server:port/forms/frmservlet?config=webutil
14) Run your form.
If you want to use JRE instead of JINITIATOR follow these steps;
DEV_SUITE\forms\server\formsweb.cfg
Change this line
baseHTMLjinitiator=webutiljini.htm
to this
baseHTMLjinitiator=webutiljpi.htm
One more thing you cannot use webutil functions/procedure in pre-form and when-new-form-instance. Because library/java beans need to loaded before using. It can be accomplished by running timer until the bean loaded and calling the functions/procedure when timer expired.
To run Aplication from Intranet allow popup from intranet site.
Following are the steps
In Internet Exporer
Open Tools>Popup-Blocker>Popup-Blocker Settings
Add Both entries
http://192.168.0.1 (Application Server IP)
http://192.168.0.2 (DEV_Suite Developer IP)
Best Regards,
M. Wasi Uddin Qureshi
APEX tips for 10g rel 2 database using mod_plsql
Intro:
Oracle HTTP Server is a web server supplied by Oracle and is based on the Apache HTTP Server. The web server will receive all HTTP requests from the client (the browser) and forward them to the mod_plsql extension module, which then forwards the request to the Oracle Application Express engine within the Oracle database.
Point to be noted:
1. If you are installing ORACLE HTTP Server from Companion CD then the Oracle HTTP Server cannot be installed into an existing Oracle Home. You will need to create a new Oracle home name and location for the Oracle HTTP Server.
2. No need to install HTML DB
3. Create a separate tablespace to store the objects created by Oracle APEX. Otherwise these objects will be created in the SYSTEM tablespace.
4. You might have to rename some images directories into UPPER CASE, the images located at
OK folks, thats it for now..
takecare
Moiz
Wednesday, February 17, 2010
How to Encrypt a stored procedure/function
create or replace procedure test
as
begin
dbms_output.put_line( 'Hello world' );
end;
/
Save the above procedure code in test.sql on /bin directory of ORACLE home.
----------------------
2. Check the text from dictionary table:
select text from user_source where name= 'TEST';
It will show the procedure code or contents as created in step 1.
3. To encrypt the procedure contents there is a utility named 'wrap' in ORACLE installation home/bin:
Syntax: wrap iname= <source file name> oname= <output file name>
Login with oracle inventory user (usually oracle) and go to /bin directory of oracle home, then run:
wrap iname=test.sql oname=test_wrap.sql
The above command will create test_wrap.sql which will be having contents of test.sql in encrypted form. Run this script (test_wrap.sql) on sqlplus:
SQL> @test_wrap.sql
This will create the procedure in database but keep the code or contents encrypted into the dictionary table. Now, check the text from dictionary table again:
select text from user_source where name= 'TEST';
Now, it will show the procedure code or contents like:
procedure wrapped
0
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
3
7
8106000
1
4
0
4
2 :e:
1P:
4. MOST IMPORTANT:
Please save the original procedure test.sql somewhere as this is the readable (unencrypted) form of the procedure. The script test_warp.sql and the created procedure into the database are encrypted codes.
Cisco Router As A VPN Server
1) VPDN (Virtual Private Dialup Network)
This type of vpn is less secure because it uses MPPE (Microsoft Point to Point Encryption). It has lesser overheads and useful for peer to peer sharing purpose
2)IPSEC (IP Security)
This is a very secure vpn because it uses 3DES for data encryption with hashing algorithms and Session keys. This type of vpn is use in coorporate networks
LOG LOG LOG....
Well this is my first post for ORIXoom blog and i am going to advice all my peers that in your all tables specially the masters tables always give following columns
CREATED_BY .......The User who created the record
CREATED_DATE ......Date of Record creation
MODIFIED_BY......Last User who modified the record.
MODIFIED_DATE......Last date of modification in the record.
And if you can afford then always try to log deleted records in a log table. May be provide option of Logical deletion in tables for example table structure similar to this
e.g
Emp_Cd number,
Ename Varchar2(120 Char),
record_is_delete varchar2(1) defaults to N which means Record is active in database........stores Y when record is no longer needed.....
believe it or not this would definitely save u from trouble some day.
Dont forget to visit my personal blog also
Cheers,
ZB
http://baigsorcl.blogspot.com/