Archive for the ‘Tips’ Category

Source: https://sites.google.com/site/joeztechland/how-to–in-adf

ADF BC (Model)

ADF Faces (UI)
Bindings:
– DataProvider code example: here

VOs: Single, Shared VO Instance or Multiple?

Page Behavior:
– Prevent initial page render: adfFacesInitialContext Render Issues: here and here

Passing Data as Parameters (how to get data from point A to point B)
1. Data Bindings
– Value is set in bindings tab via NDValue property: This value can be EL and reference backing bean methods (that return a value), scopes (pageFlowScope, requestScope)
— this makes the value available to the resource that it is bound to and whose param has the NDValue. T

2. Task Flows
– URL Params: Capture in Task Flow properties. Move to a scope: ex: pageFlowScope.varname (tf param is copied to destination)
– Method Calls:
Created w/ TF Method Call: Method name entered manaully into Method call or through D&D onto TF method Call.
Params set in Property Window for Method
Can use return value for Navigation or not
— Create method call in TF and then associate method with it and then its params
– Method call via D&D from Data Control onto TF:
Params set in PageDef

3. SetCurrentRowWithKey (or KeyValue)
– With Command Link:
Set row – in bindings row.RowKeyStr (rowkey=row.rowKeyStr)
And link sends action for navigation
Command link action listener calls rowkey.execute – passes current row and navigate to destination and executes query from rowkey.execute

4. Page Params
– Add Params to Pagedef. Give Params a source (value = ex: pageFlowScope.xxx)
– then , can use params w/ service methods
Method: param1 NVDValue = bindings.paramname (note: bindings not pageFlowScope)

5. SetAction Listener to store values: main way to copy values using from: and to:

Use setCurrentRowWithKey/Value (video)
– use setCurrent to auto fire findbykey() – on entry to new page – keeps the new page current withthe current row
– can fire action so can be used (typically IS used ) for navigation
– task flow with search and edit forms and flows
– table in edit – add setcurr call. set its text value to column EL value and delete that value
– in bindings, setcurrr rowKey NDValue to value from column (key col)
— If key value is a string and can be viewed as normal data, use …WithKeyValue
— If key is obtained by getKey() on a VO , then it is sthe serialized string version of key and use …WithKey

Use ExecuteWithParams

Expose ADFbc as Web Service

Expose Web Service as Data Control

Query Component:
– Read only fields in query comp: open ER#10431603
– Capture internal components events/reference: ER or not possible
– Auto suggest on internal fields: ER#9797027
– Popup content headers not sizing correctly: Fixed in 11.1.1.4
– How to tell view criteria used by query comp: here
– Save Queries across sessions: here

Train Component:
– Validating train flow: here

Exception Handling:
– multiple callbacks to DCErrorHandlerImpl http://forums.oracle.com/forums/thread.jspa?threadID=1805073
– how to show multiple messages for a single exception http://forums.oracle.com/forums/thread.jspa?threadID=1805074
– how to configure logging for Utils buildFacesMessage http://forums.oracle.com/forums/thread.jspa?threadID=1805075
– HTML tags returned from DCErrorMessage.getHTMLText() http://forums.oracle.com/forums/thread.jspa?threadID=1805076
– DCErrorHandlerImpl sub-class super(true) or super(false)at http://forums.oracle.com/forums/thread.jspa?threadID=1805078
– DCErrorHandlerImpl.processMessage() method http://forums.oracle.com/forums/thread.jspa?threadID=1807859

and more
– the phase when exceptions are translated to JSF FacesMessage objects http://forums.oracle.com/forums/thread.jspa?threadID=2134598
– an EL expression that evaluates the type of exception http://forums.oracle.com/forums/thread.jspa?threadID=2151981
– abstract method handleException() cannot be accessed directly http://forums.oracle.com/forums/thread.jspa?threadID=2151982
– how to designate custom code as an exception handler http://forums.oracle.com/forums/thread.jspa?threadID=2151983
– ExceptionHandler implementation and activity marked as “Exception
– Handler” http://forums.oracle.com/forums/thread.jspa?threadID=2151984

Tips and Tricks:
LOVs:
Returning non key value: query lov col, as “code” make attribute a key attribute. In LOV usage on VO, return code into the desired text field

ViewCriteria
Can have VC criteria = literal with no value if bind vars will not be used.

sql>connect / as sysdba
sql>shutdown immediate;
sql>startup migrate;
sql> @$ORACLE_HOME/rdbms/admin/utlirp.sql
sql>shutdown immediate;
sql> startup
sql>
sql> @$ORACLE_HOME/rdbms/admin/utlrp.sql
sql> connect system/password

Happy times…

Problem Description
Drop undo tablespace fails with error Ora-01548 .
SQL> drop Tablespace UNDOTBS1;
drop Tablespace UNDOTBS1
*
ERROR at line 1:
ORA-01548: active rollback segment ‘_SYSSMU1$’ found, terminate dropping
tablespace

Cause of The Problem
An attempt was made to drop a tablespace that contains active rollback segments.

Solution of The Problem
In order to get rid of this error you have to follow following steps.
1)Create pfile if you started with database with spfile.
SQL>Create PFILE from SPFILE;

2)Edit pfile and set undo management to manual.
undo_management = manual

3)Put the entries of the undo segments in the pfile by using the following statement in the pfile:

_offline_rollback_segments=(_SYSSMU1$,_SYSSMU2$,_SYSSMU3$,…..)

4)Mount the database using new pfile.
Startup mount pfile=’fullpath to pfile’

5)Drop the datafiles,
sql>Alter Database datafile ‘&filename’ offline drop;

6)Open the database.
sql>Alter Database Open;

7)Drop the undo segments,

sql>Drop Rollback Segment “_SYSSMU1$”;
……
8)Drop Old undo tablespace.
sql>Drop Tablespace old_tablespace_name Including Contents;

9)Add the new undo tablespace.

10) Shutdown Immediate;

11) Change the pfile parameters back to Undo_management = AUTO and modify the parameter Undo_tablespace=new_undo_tablespace_name and remove the _offline_rollback_segments parameter.

12) Startup the Database.

Link: http://arjudba.blogspot.com

1. Dump a trace of the controlfile.
Use SQL*Plus (or Server Manager) and enter:
SQL> alter database backup controlfile to trace ;
2. Modify the created trace file (located in the user_dump_dest directory):
a) remove from the first line to the line before “STARTUP NOMOUNT”
b) remove line “ALTER DATABASE OPEN” to the end of the file
c) change value of maxdatafiles, maxlogfiles and other parameters as desired
d) rename the file to something .sql (such as cntl.sql)
3. Shutdown the database.
4. Backup the database.
5. Run Server Manager/SQLPLUS and do the following:
SVRMGR> connect internal or connect /as sysdba
SVRMGR> @cntl.sql (The SQL script that you created in step 2) or SQLPLUS>@cntl.sql
SVRMGR> alter database open noresetlogs ; or SQLPLUS> alter database open noresetlogs

SQLPLUS if you are using 9i SVRMGRL if you are using 8i or below.

Also Please read the following article from metalink…

Doc ID: Note:1012929.6
Subject: How to Recreate the Controlfile
Type: BULLETIN
Status: PUBLISHED
Content Type: TEXT/PLAIN
Creation Date: 04-OCT-1995
Last Revision Date: 14-JAN-2005

PURPOSE
This article describes how you can recreate your controlfile.

SCOPE & APPLICATION
For DBAs who need to recreate the controlfile.

WARNING:
——–

You should only need to recreate your control file under very special
circumstances:

– All current copies of the control file have been lost or are corrupted.

– You need to change a “hard” database parameter that was set when the
database was first created, such as MAXDATAFILES, MAXLOGFILES,
MAXLOGHISTORY, etc.

– You are restoring a backup in which the control file is corrupted or
missing.

– Oracle Customer Support advises you to do so.

– If you are moving your database to another machine which is
running the same operating system but the location of the datafiles,
logfiles is not the same.

ORA-00202: controlfile: ‘C:\ORACLE\ORADATA\ORACLE91\CONTROL02.CTL’

ORA-27091: skgfqio: unable to queue I/O

ORA-27070: skgfdisp: async read/write failed

OSD-04006: ReadFile() failure, unable to read from file

O/S-Error: (OS 23) Data error (cyclic redundancy check).

i find this problem on one of my server database. this problem will make oracle fail to mount and open. if you try to connect via sqlplus, you will get error message : Oracle is on initialization startup/shutdown. so you can not enter the database.

below is the step that i do, to resolve the problem.(oracle ver 9i and higher)

1. connect to database using sqlplus with SYS as SYSDBA

2. shutdown immediate the database.

3. create a backup copy of all control file(usually consist of 3 control file with extension CTL) on folder ORADATA\

4. rename CONTROL02.CTL (corrupt control file) to CONTROL02.bak

5. rename one of working control file to become CONTROL02.CTL and then copy this file to folder ORADATA\

6.then startup the database via sqlplus using SYS as SYSDBA

this step only working if one of controlfile is corrupt and need to be replace. and also your controlfile is multiplex. Make sure that the error message is exactly the same with what is written above.

^^

Minh Tran

When exporting data from Oracle DB 9i 9.2.0.5, encountered by the error:

. exporting pre-schema procedural objects and actions
. exporting foreign function library names for user QLNS
. exporting PUBLIC type synonyms
. exporting private type synonyms
. exporting object type definitions for user QLNS
EXP-00008: ORACLE error 942 encountered
ORA-00942: table or view does not exist
EXP-00024: Export views not installed, please notify your DBA
EXP-00000: Export terminated unsuccessfully

Solution:

Run catalog.sql,catproc.sql and catexp.sql ( logged in as sys).

Then you should export as normal.

Regards,

Minh Tran

1. To get currently used character set, issue:

SELECT * FROM nls_database_parameters WHERE parameter LIKE ‘%CHARACTERSET%’.

nls_database_parameters is a view.

2. Check and update, for example, to set nls_characterset = UTF8,nls_nchar_characterset = UTF8, use table props$:

UPDATE props$ SET value$ = ‘UTF8’ WHERE NAME LIKE ‘%CHARACTERSET%;

commit;

There you go…

Minh Tran