Saturday, March 26, 2011

How to manually create an ASM Instance

This article will show you step by step guide about how to manually create an ASM instance from scratch instead of using DBCA.

Step 01:
Before starting you should remember that ASM instance should be installed in a separate home than Oracle database software. If you do so, it would be useful in the case of applying patches and upgrade. For example you can upgrade ASM home from 10.2.0.2 to 10.2.0.3 while database home still on 10.2.0.2.

Before manually create an ASM instance be sure that CSS must be running. You can check the status of css by issuing,

[grid@DC-DB-01 ~]$ crsctl check css
CRS-4529: Cluster Synchronization Services is online

If it is not running, you should configure CSS process by running $ORACLE_HOME/bin/localconfig script:

# $ORACLE_HOME/bin/localconfig all

Step 02:
Create the init+ASM.ora file in $ORACLE_HOME/dbs (this ORACLE_HOME being the newly created one).
ASM_DISKSTRING=''
INSTANCE_TYPE='ASM'
LARGE_POOL_SIZE=40M
REMOTE_LOGIN_PASSWORDFILE='EXCLUSIVE'
USER_DUMP_DEST=$ORACLE_HOME/admin/+ASM/udump
BACKGROUND_DUMP_DEST=$ORACLE_HOME/admin/+ASM/bdump
CORE_DUMP_DEST=$ORACLE_HOME/admin/+ASM/cdump


Step 03:
Creating ADMIN directories:
$ cd $ORACLE_HOME
$ mkdir dbs
$ mkdir admin
$ cd admin
$ mkdir +ASM
$ cd +ASM
$mkdir udump
$mkdir bdump
$mkdir cdump

Step 04:
Start the ASM Instance

For UNIX platforms:
# su - oracle
$ ORACLE_SID=+ASM; export ORACLE_SID
$ sqlplus "/ as sysdba"
SQL> startup
For microsoft platforms using oradim service creation is necessary.
C:\> oradim -new -asmsid +ASM -syspwd oracle
-pfile D:\oracle\product\10.2.0\admin\+ASM\pfile\init.ora -spfile
-startmode manual -shutmode immediate

Instance created.

C:\> oradim -edit -asmsid +ASM -startmode a
C:\> set oracle_sid=+ASM
C:\> sqlplus "/ as sysdba"

SQL> startup pfile='C:\oracle\product\10.1.0\admin\+ASM\pfile\init.ora';

Step 05:
Create SPFILE from PFILE:

SQL> create spfile='+ASM' from pfile;

Step 06:
For Unix platform, put an entry in the oratab file for the ASM intance:
+ASM:<ASM Oracle Home>:Y
Note that you may get the following error on first start:

ORA-15110: no diskgroups mounted

This error can be safely ignored, when creating a new diskgroup, the diskgroup name will be
added automatically to the asm_diskgroups parameter and you will not get this error again.

Diagnosis Oracle Logical Standby Data Guard Configuration

-- NAME: DG_Logical_Standby_Diagnosis.sql
-- ------------------------------------------------------------------------
-- AUTHOR: Mohammad Abdul Momin Arju
-- January 2010.
-- ------------------------------------------------------------------------
-- PURPOSE:
-- This script is used to troubleshoot Oracle Data Guard issues for
-- Logical standby database.
-- ------------------------------------------------------------------------
-- DISCLAIMER:
-- This script is provided for educational purposes only.
-- Test it before you run in your production database.
-- ------------------------------------------------------------------------
-- Content of the Script

set echo off 
set feedback off 
column timecol new_value timestamp 
column spool_extension new_value suffix 
select to_char(sysdate,'Mondd_hhmi') timecol, 
'.out' spool_extension from sys.dual; 
column output new_value dbname 
select value || '_' output 
from v$parameter where name = 'db_name'; 
spool DG_Logical_Standby_&&dbname&×tamp&&suffix 

set linesize 79
set pagesize 180
set long 1000
set trim on 
set trims on 
alter session set nls_date_format = 'MM-DD-YYYY HH24:MI:SS'; 
set feedback on 
select to_char(sysdate) time from dual; 

set echo on 

-- The following select will give us the generic information about how
-- this standby is setup.  The database_role should be logical standby as
-- that is what this script is intended to be ran on.

column ROLE format a7 tru 
column NAME format a8 wrap
select name,database_role,log_mode,protection_mode
from v$database; 

-- ARCHIVER can be (STOPPED | STARTED | FAILED). FAILED means that the
-- archiver failed to archive a log last time, but will try again within 5
-- minutes. LOG_SWITCH_WAIT The ARCHIVE LOG/CLEAR LOG/CHECKPOINT event log
-- switching is waiting for. Note that if ALTER SYSTEM SWITCH LOGFILE is
-- hung, but there is room in the current online redo log, then value is
-- NULL

column host_name format a20 tru 
column version format a9 tru 
select instance_name,host_name,version,archiver,log_switch_wait 
from v$instance; 

-- The following query give us information about catpatch.
-- This way we can tell if the procedure doesn't match the image.

select version, modified, status from dba_registry 
where comp_id = 'CATPROC';

-- Force logging and supplemental logging are not mandatory but are
-- recommended if you plan to switchover.  During normal operations it is
-- acceptable for SWITCHOVER_STATUS to be SESSIONS ACTIVE or NOT ALLOWED.

column force_logging format a13 tru 
column remote_archive format a14 tru 
column dataguard_broker format a16 tru 

select force_logging,remote_archive,supplemental_log_data_pk,
supplemental_log_data_ui,switchover_status,dataguard_broker 
from v$database;  

-- This query produces a list of all archive destinations.  It shows if
-- they are enabled, what process is servicing that destination, if the
-- destination is local or remote, and if remote what the current mount ID
-- is.

column destination format a35 wrap 
column process format a7 
column archiver format a8 
column ID format 99 
column mid format 99

select dest_id "ID",destination,status,target,
schedule,process,mountid  mid
from v$archive_dest order by dest_id;

-- This select will give further detail on the destinations as to what
-- options have been set.  Register indicates whether or not the archived
-- redo log is registered in the remote destination control file.

set numwidth 8
column ID format 99 

select dest_id "ID",archiver,transmit_mode,affirm,async_blocks async,
net_timeout net_time,delay_mins delay,reopen_secs reopen,
register,binding 
from v$archive_dest order by dest_id;

-- Determine if any error conditions have been reached by querying the
-- v$dataguard_status view (view only available in 9.2.0 and above):

column message format a80 

select message, timestamp 
from v$dataguard_status 
where severity in ('Error','Fatal') 
order by timestamp; 

-- Query v$managed_standby to see the status of processes involved in
-- the shipping redo on this system.  Does not include processes needed to
-- apply redo.

select process,status,client_process,sequence#
from v$managed_standby;

-- Verify that log apply services on the standby are currently
-- running. If the query against V$LOGSTDBY returns no rows then logical
-- apply is not running.

column status format a50 wrap
column type format a11
set numwidth 15

SELECT TYPE, STATUS, HIGH_SCN               
FROM V$LOGSTDBY;

-- The DBA_LOGSTDBY_PROGRESS view describes the progress of SQL apply
-- operations on the logical standby databases.  The APPLIED_SCN indicates
-- that committed transactions at or below that SCN have been applied. The
-- NEWEST_SCN is the maximum SCN to which data could be applied if no more
-- logs were received. This is usually the MAX(NEXT_CHANGE#)-1 from
-- DBA_LOGSTDBY_LOG.  When the value of NEWEST_SCN and APPLIED_SCN are the
-- equal then all available changes have been applied.  If your
-- APPLIED_SCN is below NEWEST_SCN and is increasing then SQL apply is
-- currently processing changes.

set numwidth 15

select 
(case 
when newest_scn = applied_scn then 'Done'
when newest_scn <= applied_scn + 9 then 'Done?'
    when newest_scn > (select max(next_change#) from dba_logstdby_log)
then 'Near done'
when (select count(*) from dba_logstdby_log 
where (next_change#, thread#) not in 
(select first_change#, thread# from dba_logstdby_log)) > 1
then 'Gap'
when newest_scn > applied_scn then 'Not Done'
else '---' end) "Fin?",
newest_scn, applied_scn, read_scn from dba_logstdby_progress;

select newest_time, applied_time, read_time from dba_logstdby_progress;

-- Determine if apply is lagging behind and by how much.  Missing
-- sequence#'s in a range indicate that a gap exists.

set numwidth 15
column trd format 99

select thread# trd, sequence#,
first_change#, next_change#,
dict_begin beg, dict_end end, 
to_char(timestamp, 'hh:mi:ss') timestamp,
(case when l.next_change# < p.read_scn then 'YES'
when l.first_change# < p.applied_scn then 'CURRENT'
else 'NO' end) applied
from dba_logstdby_log l, dba_logstdby_progress p
order by thread#, first_change#;

-- Get a history on logical standby apply activity.

set numwidth 15

select to_char(event_time, 'MM/DD HH24:MI:SS') time, 
commit_scn, current_scn, event, status 
from dba_logstdby_events
order by event_time, commit_scn, current_scn;

-- Dump logical standby stats

column name format a40
column value format a20

select * from v$logstdby_stats;

-- Dump logical standby parameters

column name format a33 wrap
column value format a33 wrap
column type format 99

select name, value, type from system.logstdby$parameters 
order by type, name;

-- Gather log miner session and dictionary information.

set numwidth 15 

select * from system.logmnr_session$;
select * from system.logmnr_dictionary$;
select * from system.logmnr_dictstate$;
select * from v$logmnr_session;

-- Query the log miner dictionary for key tables necessary to process
-- changes for logical standby Label security will move AUD$ from SYS to
-- SYSTEM.  A synonym will remain in SYS but Logical Standby does not
-- support this.

set numwidth 5
column name format a9 wrap
column owner format a6 wrap

select o.logmnr_uid, o.obj#, o.objv#, u.name owner, o.name
from system.logmnr_obj$ o, system.logmnr_user$ u 
where 
o.logmnr_uid = u.logmnr_uid and 
o.owner# = u.user# and 
o.name in ('JOB$','JOBSEQ','SEQ$','AUD$',
'FGA_LOG$','IND$','COL$','LOGSTDBY$PARAMETER')
order by u.name;

-- Non-default init parameters. 

column name format a30 tru 
column value format a48 wra 
select name, value 
from v$parameter 
where isdefault = 'FALSE';

spool off

ORA-13503: Creating SYSAUX tablespace with invalid attributes

Problem Description
While creating SYSAUX tablespace manually it fails with error ORA-13503.

SQL> CREATE TABLESPACE SYSAUX DATAFILE '/oradata/TRGDB/sysaux01.dbf' SIZE 5M AUTOEXTEND ON MAXSIZE UNLIMITED;
CREATE TABLESPACE SYSAUX DATAFILE '/oradata/TRGDB/sysaux01.dbf' SIZE 5M AUTOEXTEND ON MAXSIZE UNLIMITED
*
ERROR at line 1:
ORA-13503: Creating SYSAUX tablespace with invalid attributes

Cause of the Problem
You can create a SYSAUX tablespace normally like other tablespaces. While creating SYSAUX tablespace you need to mention several mandatory parameter like EXTENT MANAGEMENT LOCAL. From the Oracle error message Action it is said "Create SYSAUX tablespace with ONLINE, PERMANENT, EXTENT MANAGEMENT LOCAL, SEGMENT SPACE MANAGEMENT AUTO attributes."

Solution of the Problem
Correct your statement like below.

SQL> CREATE TABLESPACE SYSAUX DATAFILE '/oradata/TRGDB/sysaux01.dbf' SIZE 5M AUTOEXTEND ON MAXSIZE UNLIMITED EXTENT MANAGEMENT LOCAL SEGMENT SPACE MANAGEMENT AUTO;

Troubleshoot TNS-12535 or ORA-12535 or ORA-12170 Errors

Once you hit TNS-12535 or ORA-12535 you should immediate look for alert log to know details about what happened. Followings are some entry from my database alert log whenever I hit TNS-12535 or ORA-12535 or ORA-12170 Errors.

***********************************************************************

Fatal NI connect error 12170.

  VERSION INFORMATION:
        TNS for Linux: Version 11.2.0.1.0 - Production
        TCP/IP NT Protocol Adapter for Linux: Version 11.2.0.1.0 - Production
  Time: 16-SEP-2010 13:51:32
  Tracing not turned on.
  Tns error struct:
    ns main err code: 12535

TNS-12535: TNS:operation timed out
    ns secondary err code: 12560
    nt main err code: 505

TNS-00505: Operation timed out
    nt secondary err code: 0
    nt OS err code: 0
  Client address: <unknown>
Thu Sep 16 13:53:17 2010


***********************************************************************
Here is another form of error,

Fatal NI connect error 12170.

  VERSION INFORMATION:
        TNS for Linux: Version 11.2.0.1.0 - Production
        TCP/IP NT Protocol Adapter for Linux: Version 11.2.0.1.0 - Production
  Time: 22-SEP-2010 10:48:38
  Tracing not turned on.
  Tns error struct:
    ns main err code: 12535

TNS-12535: TNS:operation timed out
    ns secondary err code: 12560
    nt main err code: 505

TNS-00505: Operation timed out
    nt secondary err code: 110
    nt OS err code: 0
  Client address: (ADDRESS=(PROTOCOL=tcp)(HOST=192.168.105.101)(PORT=1522))
Wed Sep 22 10:48:49 2010
Error 1031 received logging on to the standby
Errors in file /u01/app/oracle/diag/rdbms/bddipdc/bddipdc1/trace/bddipdc1_pz99_18127.trc:
ORA-01031: insufficient privileges
PING[ARCH]: Heartbeat failed to connect to standby 'bddipdrs'. Error is 1031.
Errors in file /u01/app/oracle/diag/rdbms/bddipdc/bddipdc1/trace/bddipdc1_pz99_18127.trc:
ORA-10389: parallel query server interrupt (cleanup)
Errors in file /u01/app/oracle/diag/rdbms/bddipdc/bddipdc1/trace/bddipdc1_pz99_18127.trc:
ORA-10389: parallel query server interrupt (cleanup)
Errors in file /u01/app/oracle/diag/rdbms/bddipdc/bddipdc1/trace/bddipdc1_pz99_18127.trc:
ORA-10389: parallel query server interrupt (cleanup)
Wed Sep 22 13:29:18 2010
Here is another form of TNS-12535 error:

***********************************************************************

Fatal NI connect error 12170.

  VERSION INFORMATION:
        TNS for Linux: Version 11.2.0.1.0 - Production
        Oracle Bequeath NT Protocol Adapter for Linux: Version 11.2.0.1.0 - Production
        TCP/IP NT Protocol Adapter for Linux: Version 11.2.0.1.0 - Production
  Time: 26-MAR-2011 18:20:11
  Tracing not turned on.
  Tns error struct:
    ns main err code: 12535

TNS-12535: TNS:operation timed out
    ns secondary err code: 12560
    nt main err code: 505

TNS-00505: Operation timed out
    nt secondary err code: 110
    nt OS err code: 0
  Client address: (ADDRESS=(PROTOCOL=tcp)(HOST=192.168.8.40)(PORT=50594))
Sat Mar 26 18:27:02 2011


***********************************************************************

More about TNS-12535 or ORA-12535 or ORA-12170 Errors
- ORA-12535/TNS-12535 is a timing issue between the client and server. It means client/server fail to connect each other within the time mentioned by parameter INBOUND_CONNECT_TIMEOUT which specify the time, in seconds, for a client to connect with the database server.

- Note that ORA-12535/TNS-12535 is common error in case of Firewall enabled network as well as slow network. Be 100% assure that Oracle listener port is not blocked or any traffic filtering enabled by your network router. Try changing listener port instead of common port 1521. Many routers including Juniper handles Oracle default listener port 1521 specially and thus might impose traffic limit.

- In server machine within listener.ora set INBOUND_CONNECT_TIMEOUT_{listener_name} to a greater value. You can set it to 0, which means wait indefinitely. In client machine within sqlnet.ora set SQLNET.INBOUND_CONNECT_TIMEOUT to a greater value or set to zero.

- If you are running Oracle Names Server (9i and prior), then setup a temporary tnsnames.ora file and edit the sqlnet.ora file to have NAMES.DIRECTORY_PATH = (TNSNAMES)

- If you are running Shared Server (formerly Multi Threaded Server or MTS), then try the same connection with (SERVER=DEDICATED) in the tnsnames.ora alias.

Step by step Troubleshooting
1. Check whether your client to server connection is going through any Firewalls or Routers. You can ping the ip address or hostname from the client to server and check whether the timing response is acceptable.

Also from client to server pc you do scp and try to transfer a file. If client is windows then download putty and login to server. Be connected for 10 minutes and run common commands like ls, pwd, cd, scp and see whether you can run those smoothly.


If you are going through a Firewall, and your server platforms are UNIX, then you must ensure that the port being listened on is open, unless you are running the Firewall vendor's Proxy Server, in which case this will allow connectivity.

If you are not running the Firewall vendor's Proxy, and the port is not open, then you will have a refusal from the outside into the Firewall zone. In the network check client to server connection without firewall. If that happens successfully there must be issue with the router or firewall.


If you are going through a Firewall connecting to a RAC Database, and your Server platforms are UNIX, then you must ensure that the port being listened on by the listeners in the nodes is open, as well as the long and short versions of all possible hostnames (VIP and physical) are allowed by the Firewall.

If you are getting either of these errors going through a firewall, then please get the System Administrator to make certain that the following settings are disabled and then test:
- SQLNet fixup protocol
- Deep Packet Inspection (DPI)
- SQLNet packet inspection
- SQL Fixup
- SQL ALG (Juniper firewall)

2. With 10.1 and 10.2, an ORA-12535 or ORA-12170 can be received by the client if the time to connect is too slow. This can be true if the listener's parameter INBOUND_CONNECT_TIMEOUT_{listener_name} and/or Server's sqlnet.ora parameter SQLNET.INBOUND_CONNECT_TIMEOUT are set too low. The corresponding error on the Server side may be an ORA-3136 in the alert log and the sqlnet.log may contain an ORA-12170. So try increasing INBOUND_CONNECT_TIMEOUT_{listener_name} to a greater value inside server listener.ora file and set SQLNET.INBOUND_CONNECT_TIMEOUT to a greater value in client machine.

3. With 11g the database alert log may also contain a combination of 12535 and/or 12170 errors. Check to see what problems are being experienced by the CLIENT end of communications as these errors can be caused by excessive connections and the database not being able to handle such storms in the time allowed.

Thursday, March 24, 2011

Taylor’s Professional Services (TPS) eCommerce Web Site

Case Project—Statement of Work
Taylor’s Professional Services (TPS)
eCommerce Web Site

1.     System Description

Taylor’s Professional Services is a technical and engineering staffing service.  When a TPS client company determines that it will need a temporary professional or scientific employee, it issues a staffing request against the contract it previously negotiated with TPS. 
TPS wants to provide a web site so that their clients can complete a staffing request over the internet.  In addition, TPS wants to provide their clients with a list of potential candidates based on experience, education, salary, and location.  A client will be able to select up to three potential staff members along with the location of work, type of work, and salary and submit the request to the contract manager. Once a client issues a staffing request, the system shall provide an automated response stating that the contract manager will validate their request within 24 hours of receipt. 
Once a staffing request has been issued, the client will be able to log into the site and search for a staff request by number.  The staff request query will result in a page that contains all staff request information along with a field that states whether the staff request is valid, invalid, unable to fill, or filled.
In addition, TPS staff members should be able update their resumes and picture through the web site. 
The two areas of the website will be partitioned so that only clients with valid contract numbers and password are able to enter the client area and staff members with only valid employee numbers and password will be able to enter the staff area.  Only the contract manager has full access to both locations.

2.     Software Deliverables

2.1.    Description of Functionality

The application will provide the following functionality:
1.  Creation, modification, storage, and retrieval of staffing request information
2.  Creation, modification, storage, and retrieval of contract information.
3.  Creation, modification, storage, and retrieval of staff information.
4.  Creation, modification, storage, and retrieval of user access information.
5.  Allows a client to enter a staffing request into the database.
6.  Allows a client to retrieve staffing request information.
7.  Allows the contract manager to retrieve a staffing request from the database
8.  Allows the contract manager to retrieve contract information
9.  Allows the contract manager to validate the staffing request
10. Allows the contract manager to close out the staffing request.
11. Allows a staff member to update their personal information, resume, availability, and picture.

2.2.    List of major software components

  1. Access Control
  2. Database Management
  3. Client Interface
  4. Contract Manager Interface and Business Rules

3.     Equipment and Hardware Requirements

  1. Small business network, with no more than 20 nodes
  2. Standard Windows 2000/XP workstations.
  3. MS Office 2000/XP, with MS Access
  4. MS Outlook 2000/XP

4.     Documentation

4.1.    User Documentation

The contractor shall supply basic training user manuals describing each of the operations in a MS Word document.

4.2.    Development Documentation

The contractor shall supply all Planning, Requirements, Design, and Source code.

5.     Testing

5.1.    Test Plan and Procedures

The contractor shall supply a test plan and procedures for each level of testing.

5.2.    Unit Test Case Results

The contractor shall supply the results of the unit tests.

5.3.    Integration Test Case Results

The contractor shall supply the results of the integration test.

5.4.    Acceptance Test Case Results

The contractor shall supply the results of the acceptance test. 

If you need all documents of this website you can contact at arjuiut at gmail.com

Drop user hangs or it returns ORA-01940

Problem Description
Today we have an horror day with buggy Oracle product. Well, the task was very simple job which was to drop a user. I just issued DROP USER command and I see command is taking time hours after hours and it seems it is hanged. I cancelled the operation, issued again and I see again it is waiting hours without any progress at all. I don't see anything in Oracle alert log file.

Note that, before dropping the user I already locked the user, checked whether any active session exist for this user as I have demonstrated in ORA-01940: Cannot drop a user that is currently connected. But it does not help any. Still I see it hangs. In fact there was an Oracle bug 6915130 which was responsible for this hang operation. In another document it is said it is due to Oracle Unpublished Bug 7022875: SESSION HANGS WHEN TRYING TO DROP A USER which is duplicate of Unpublished Bug 5686407: INSTANCE IS CRASHING WITH ORA-600 [17163], fixed in 10.2.0.5 and 11.1.0.7. But my database is 11.2.0.1 and I am facing same issue.

So I have made a script and then run the script in order to delete all objects under the schema. I have then issued DROP USER statement. I see now it says ORA-01940: cannot drop a user that is currently connected though user was locked and no one is using the schema. From my command prompt window,

SQL> drop user dbbfcc cascade;
drop user dbbfcc cascade
*
ERROR at line 1:
ORA-01940: cannot drop a user that is currently connected

SQL> select sid, serial# from v$session where username ='DBBFCC';

no rows selected

This is absurd thing about Oracle. I researched a bit about this issue in Oracle support and came to know that I am hitting a Bug 9979778: (LRG#4794013) ORA-01940: CANNOT DROP A USER THAT IS CURRENTLY CONNECTED.

In order to investigate further about this problem I had to enable trace for the database.
SQL> alter session set events '1940 trace name ERRORSTACK level 3';
SQL> alter session set events '10046 trace name context forever, level 12';
SQL> drop user xxx cascade;

From the generated trace file, I found the following entries:

PARSING IN CURSOR #1 len=515 dep=1 uid=0 oct=47 lid=0 tim=1627146077554 hv=2219505151 ad='c00000002b4a3690' sqlid='ct6c4h224pxgz'
BEGIN
  BEGIN
    IF (sys.is_vpd_enabled(sys.dictionary_obj_owner, sys.dictionary_obj_name, xdb.DBMS_XDBZ.IS_ENABLED_CONTENTS)) THEN
      xdb.XDB_PITRIG_PKG.pitrig_truncate(sys.dictionary_obj_owner, sys.dictionary_obj_name);
    ELSIF (sys.is_vpd_enabled(sys.dictionary_obj_owner, sys.dictionary_obj_name, xdb.DBMS_XDBZ.IS_ENABLED_RESMETADATA)) THEN
      xdb.XDB_PITRIG_PKG.pitrig_dropmetadata(sys.dictionary_obj_owner, sys.dictionary_obj_name);
    END IF;
  EXCEPTION
    WHEN OTHERS THEN
     null;
  END;
END;
END OF STMT
PARSE #1:c=0,e=71,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=0,tim=1627146077553

From the trace I also found the wait event as,


WAIT #2: nam='log buffer space' ela= 51 p1=0 p2=0 p3=0 obj#=-1 tim=1627152224508
WAIT #2: nam='Disk file operations I/O' ela= 104 FileOperation=2 fileno=0 filetype=1 obj#=-1 tim=1627152253427
WAIT #2: nam='Disk file operations I/O' ela= 39 FileOperation=2 fileno=1 filetype=1 obj#=-1 tim=1627152253518
WAIT #2: nam='control file sequential read' ela= 42 file#=0 block#=1 blocks=1 obj#=-1 tim=1627152253764
WAIT #2: nam='control file sequential read' ela= 10 file#=0 block#=15 blocks=1 obj#=-1 tim=1627152253806
WAIT #2: nam='control file sequential read' ela= 10 file#=0 block#=17 blocks=1 obj#=-1 tim=1627152253835
WAIT #2: nam='control file sequential read' ela= 24 file#=0 block#=282 blocks=1 obj#=-1 tim=1627152253885
WAIT #2: nam='control file sequential read' ela= 5456 file#=0 block#=283 blocks=1 obj#=-1 tim=1627152259368
WAIT #2: nam='control file sequential read' ela= 9 file#=0 block#=1 blocks=1 obj#=-1 tim=1627152259409
WAIT #2: nam='control file sequential read' ela= 7 file#=0 block#=15 blocks=1 obj#=-1 tim=1627152259436
WAIT #2: nam='control file sequential read' ela= 6 file#=0 block#=17 blocks=1 obj#=-1 tim=1627152259460
WAIT #2: nam='control file sequential read' ela= 11 file#=0 block#=1 blocks=1 obj#=-1 tim=1627152271311
WAIT #2: nam='control file sequential read' ela= 8 file#=0 block#=15 blocks=1 obj#=-1 tim=1627152271356
WAIT #2: nam='control file sequential read' ela= 7 file#=0 block#=17 blocks=1 obj#=-1 tim=1627152271381
WAIT #2: nam='control file sequential read' ela= 10 file#=0 block#=22 blocks=1 obj#=-1 tim=1627152271415
WAIT #2: nam='control file sequential read' ela= 8 file#=0 block#=1 blocks=1 obj#=-1 tim=1627152277341
WAIT #2: nam='control file sequential read' ela= 7 file#=0 block#=15 blocks=1 obj#=-1 tim=1627152277370
WAIT #2: nam='control file sequential read' ela= 7 file#=0 block#=17 blocks=1 obj#=-1 tim=1627152277395
WAIT #2: nam='control file sequential read' ela= 20 file#=0 block#=20 blocks=1 obj#=-1 tim=1627152277436
WAIT #2: nam='control file sequential read' ela= 7 file#=0 block#=22 blocks=1 obj#=-1 tim=1627152277466
WAIT #2: nam='control file sequential read' ela= 10 file#=0 block#=31 blocks=1 obj#=-1 tim=1627152277496
WAIT #2: nam='Disk file operations I/O' ela= 142 FileOperation=2 fileno=0 filetype=3 obj#=-1 tim=1627152277732
WAIT #2: nam='Disk file operations I/O' ela= 81 FileOperation=2 fileno=1 filetype=3 obj#=-1 tim=1627152277870
WAIT #2: nam='log file sequential read' ela= 9 log#=0 block#=1 blocks=1 obj#=-1 tim=1627152277899
WAIT #2: nam='log file sequential read' ela= 9 log#=1 block#=1 blocks=1 obj#=-1 tim=1627152277927
WAIT #2: nam='Disk file operations I/O' ela= 6349 FileOperation=5 fileno=0 filetype=3 obj#=-1 tim=1627152284299
WAIT #2: nam='Disk file operations I/O' ela= 5 FileOperation=5 fileno=1 filetype=3 obj#=-1 tim=1627152284323
WAIT #2: nam='control file sequential read' ela= 8 file#=0 block#=1 blocks=1 obj#=-1 tim=1627152284353
WAIT #2: nam='control file sequential read' ela= 7 file#=0 block#=15 blocks=1 obj#=-1 tim=1627152284380
WAIT #2: nam='control file sequential read' ela= 7 file#=0 block#=17 blocks=1 obj#=-1 tim=1627152284405
WAIT #2: nam='control file sequential read' ela= 7 file#=0 block#=22 blocks=1 obj#=-1 tim=1627152284446
WAIT #2: nam='control file sequential read' ela= 8 file#=0 block#=1 blocks=1 obj#=-1 tim=1627152284979
WAIT #2: nam='control file sequential read' ela= 7 file#=0 block#=15 blocks=1 obj#=-1 tim=1627152285007
WAIT #2: nam='control file sequential read' ela= 7 file#=0 block#=17 blocks=1 obj#=-1 tim=1627152285031
WAIT #2: nam='control file sequential read' ela= 6 file#=0 block#=20 blocks=1 obj#=-1 tim=1627152285056
WAIT #2: nam='control file sequential read' ela= 6 file#=0 block#=22 blocks=1 obj#=-1 tim=1627152285082
WAIT #2: nam='control file sequential read' ela= 7 file#=0 block#=31 blocks=1 obj#=-1 tim=1627152285109
WAIT #2: nam='Disk file operations I/O' ela= 81 FileOperation=2 fileno=0 filetype=3 obj#=-1 tim=1627152285244
WAIT #2: nam='Disk file operations I/O' ela= 79 FileOperation=2 fileno=1 filetype=3 obj#=-1 tim=1627152285373
WAIT #2: nam='log file sequential read' ela= 8 log#=0 block#=1 blocks=1 obj#=-1 tim=1627152285398
WAIT #2: nam='log file sequential read' ela= 8 log#=1 block#=1 blocks=1 obj#=-1 tim=1627152285422
WAIT #2: nam='Disk file operations I/O' ela= 4592 FileOperation=5 fileno=0 filetype=3 obj#=-1 tim=1627152290032
WAIT #2: nam='Disk file operations I/O' ela= 6117 FileOperation=5 fileno=1 filetype=3 obj#=-1 tim=1627152296167
WAIT #2: nam='control file sequential read' ela= 10 file#=0 block#=1 blocks=1 obj#=-1 tim=1627152296212
WAIT #2: nam='control file sequential read' ela= 7 file#=0 block#=15 blocks=1 obj#=-1 tim=1627152296240
WAIT #2: nam='control file sequential read' ela= 7 file#=0 block#=17 blocks=1 obj#=-1 tim=1627152296265
SCN Start Scan Point: scn: 0x0000.023a7a42 (37386818)
WAIT #2: nam='control file sequential read' ela= 8 file#=0 block#=1 blocks=1 obj#=-1 tim=1627152307399
WAIT #2: nam='control file sequential read' ela= 7 file#=0 block#=15 blocks=1 obj#=-1 tim=1627152307426
WAIT #2: nam='control file sequential read' ela= 6 file#=0 block#=17 blocks=1 obj#=-1 tim=1627152307450
WAIT #2: nam='control file sequential read' ela= 7 file#=0 block#=20 blocks=1 obj#=-1 tim=1627152307476

The thing is dropping a user internally Calling XDB function to Update the sys.dictionary_obj_owner table but it is unable to progress further due to some code bug. I don't have a single invalid objects under XDB schema. Now imagine what Oracle coders have done!?

The only solution up to now is to restart Oracle instance until Oracle is changing their developers to make the product bug free.



Oracle support is telling me to Deinstall and Reinstall XML Database (XDB) in the database but I don't agree with their solution because I don't have invalid objects under XDB schema as I check via following statements.

SQL> select substr(comp_id,1,15) comp_id, substr(comp_name,1,30) comp_name, substr(version,1,10) version, status from dba_registry order by modified;

SQL> select owner,object_type,count(*) from dba_objects where status='INVALID' group by owner,object_type order by owner,object_type ;

Drop user cascade takes more than 1 day

Problem Description
Dropping a simple user takes hour after hours and after 1 day it is not completed yet. So, I cancelled the drop user operation.

SQL> DROP USER DBAC CASCADE;

... Takes unlimited time

From the database end using following query, it is check no one is connected to the database using this database user.

SQL> select sid, serial# from v$session where username = 'DBAC';

I have also locked the user before issuing drop command.

alter user DBAC account lock;

Cause of the Problem
The problem is caused by the issue identified in Enhancement Bug 6915130 Drop User Cascade Slow.

Solution of the Problem

Oracle has not yet solved this bug.
However there is workaround available.

1. Drop the objects owned by the schema first.
2. Then drop the user afterward.

You can at first drop the objects that is owned by the use. For example in order to drop all tables under a schema you can find by following query,

set headings off
set pages 0
set feedback off
set echo on
spool /u03/dump/drop.sql
select 'drop table dbac.'||table_name||';' from dba_tables where owner='DBAC';

spool off
@/u03/dump/drop.sql

or simply,
SQL> set headings off
SQL> spool drop_command.sql
SQL> select 'drop ' || object_type || ' ' || object_name || ';' from dba_objects where owner='DBAC';
SQL> spool off

Wednesday, March 23, 2011

LRM-00123: invalid character 0 found in the input file

Problem Description
While starting the database instance it fails with LRM-00123 like below.

SQL> startup nomount
ORA-01078: failure in processing system parameters
LRM-00123: invalid character 0 found in the input file

Note that this post is specifically for LRM-00123. If you get "ORA-01078: failure in processing system parameters" then you should look for a more generic error which is mentioned in http://arjudba.blogspot.com/2008/05/database-startup-fails-with-errors-ora.html and in http://arjudba.blogspot.com/2008/05/startup-fails-with-oracle-error-ora.html.

Cause of the Problem
The problem happened due to oracle initialization parameter specifically pfile (init.ora). Either the pfile is not a correct pfile or the character set used inside pfile contains some special characters which does not covered by NLS_LANG environmental variable. Note that, Oracle reads the PFILE/SPFILE information from the internal character set identified with PL/SQL and not the database created character set.

If some special characters like "á", "é", "ñ" used inside pfile and NLS_LANG environmental variable is set to US7ASCII, it is very possible you will hit this problem.

Also if your pfile is wrong file, say it is your password file which you wrongly copied as pfile then while startup mount you will also face same LRM-00123 problem.

Solution of the Problem
Open the pfile for your database with any text editor or viewer. Check its contents. All contents must be readable, if somehow you can't see the content of your pfile then possibly you need to create pfile or replace by correct one from your backup.

Set NLS_LANG to something different than US7ASCII if you have NLS_LANG set to US7ASCII.

The reason why it works with NLS_LANG set to something different than US7ASCII, even if is single byte, is because US7ASCII does not cover special characters such as "á", "é", "ñ". These characters are covered by we8iso8859p1 for example.

Use spfile instead of initSID.ora file.

This works because the functions used to scan the pfile are different. Some are used to start the database and others to create the spfile. The functions that make the scan to the spfile does not have any problem if non-US7ASCII is used.

Tuesday, March 22, 2011

SQL*Plus shows error SP2-0575 use of Oracle sql feature not in sql92 entry level

Problem Description
While connecting to sql*plus the following error occurred.
SP2-0575: Use of Oracle SQL feature not in SQL92 Entry Level.
Even after re-running the /rdbms/admin/catproc.sql script, the error still reproduces.

Cause of the Problem
The public synonym for DUAL Table is not present. The following is expected for a normal database.

SQL> select owner, object_type from all_objects where object_name='DUAL';

OWNER                          OBJECT_TYPE
------------------------------ -------------------
SYS                            TABLE
PUBLIC                         SYNONYM

However, in case of problematic database we found the following rows.
SQL> select owner, object_type from all_objects where object_name='DUAL';

OWNER                          OBJECT_TYPE
------------------------------ -------------------
SYS                            TABLE
ARJU                           TABLE

Solution of the Problem
1. Drop the DUAL table from other account beside the SYS.
For example, in this case connect to database as Arju user and execute the command:

SQL> drop table DUAL;

2. Connect as SYS, execute the following command:

SQL> create public synonym dual for dual;

3. Run the following SQL statement::

SQL> select owner, object_type from all_objects where object_name='DUAL'

Be sure you have expected output as it is shown earlier in this post.

4. Try connecting again using SQL*Plus, and the error should now be resolved.

Scripts to Monitor a Data Guard Environment

From Oracle documentation followings are the list of views which can be used to monitor in Oracle Data Guard Environment. Based on these views you can get monitoring script that is mentioned in Diagnosis Oracle Physical Standby Data Guard Configuration and in Diagnosis Oracle Data Guard Primary Site Configuration. At the end of this topic I have also mentioned some script which you can run in your environment.

ViewDatabaseDescription
DBA_LOGSTDBY_EVENTS
Logical only
Contains information about the activity of a logical standby database. It can be used to determine the cause of failures that occur when SQL Apply is applying redo to a logical standby database.
DBA_LOGSTDBY_HISTORY
Logical only
Displays the history of switchovers and failovers for logical standby databases in a Data Guard configuration. It does this by showing the complete sequence of redo log streams processed or created on the local system, across all role transitions. (After a role transition, a new log stream is started and the log stream sequence number is incremented by the new primary database.)
DBA_LOGSTDBY_LOG
Logical only
Shows the log files registered for logical standby databases.
DBA_LOGSTDBY_NOT_UNIQUE
Logical only
Identifies tables that have no primary and no non-null unique indexes.
DBA_LOGSTDBY_PARAMETERS
Logical only
Contains the list of parameters used by SQL Apply.
DBA_LOGSTDBY_SKIP
Logical only
Lists the tables that will be skipped by SQL Apply.
DBA_LOGSTDBY_SKIP_TRANSACTION
Logical only
Lists the skip settings chosen.
DBA_LOGSTDBY_UNSUPPORTED
Logical only
Identifies the schemas and tables (and columns in those tables) that contain unsupported data types. Use this view when you are preparing to create a logical standby database.
V$ARCHIVE_DEST
Primary, physical, snapshot, and logical
Describes all of the destinations in the Data Guard configuration, including each destination's current value, mode, and status.
Note: The information in this view does not persist across an instance shutdown.
V$ARCHIVE_DEST_STATUS
Primary, physical, snapshot, and logical
Displays runtime and configuration information for the archived redo log destinations.
Note: The information in this view does not persist across an instance shutdown.
V$ARCHIVE_GAP
Physical, snapshot, and logical
Displays information to help you identify a gap in the archived redo log files.
V$ARCHIVED_LOG
Primary, physical, snapshot, and logical
Displays archive redo log information from the control file, including names of the archived redo log files.
V$DATABASE
Primary, physical, snapshot, and logical
Provides database information from the control file. Includes information about fast-start failover (available only with the Data Guard broker).
V$DATABASE_INCARNATION
Primary, physical, snapshot, and logical
Displays information about all database incarnations. Oracle Database creates a new incarnation whenever a database is opened with the RESETLOGS option. Records about the current and the previous incarnation are also contained in the V$DATABASE view.
V$DATAFILE
Primary, physical, snapshot, and logical
Provides datafile information from the control file.
V$DATAGUARD_CONFIG
Primary, physical, snapshot, and logical
Lists the unique database names defined with the DB_UNIQUE_NAME and LOG_ARCHIVE_CONFIGinitialization parameters.
V$DATAGUARD_STATS
Primary, physical, snapshot, and logical
Displays various Data Guard statistics, including apply lag and transport lag. This view can be queried on any instance of a standby database. No rows are returned if queried on a primary database. n.
V$DATAGUARD_STATUS
Primary, physical, snapshot, and logical
Displays and records events that would typically be triggered by any message to the alert log or server process trace files.
V$FS_FAILOVER_STATS
Primary
Displays statistics about fast-start failover occurring on the system.
V$LOG
Primary, physical, snapshot, and logical
Contains log file information from the online redo log files.
V$LOGFILE
Primary, physical, snapshot, and logical
Contains information about the online redo log files and standby redo log files.
V$LOG_HISTORY
Primary, physical, snapshot, and logical
Contains log history information from the control file.
V$LOGSTDBY_PROCESS
Logical only
Provides dynamic information about what is happening with SQL Apply. This view is very helpful when you are diagnosing performance problems during SQL Apply on the logical standby database, and it can be helpful for other problems.
V$LOGSTDBY_PROGRESS
Logical only
Displays the progress of SQL Apply on the logical standby database.
V$LOGSTDBY_STATE
Logical only
Consolidates information from the V$LOGSTDBY_PROCESS and V$LOGSTDBY_STATS views about the running state of SQL Apply and the logical standby database.
V$LOGSTDBY_STATS
Logical only
Displays LogMiner statistics, current state, and status information for a logical standby database during SQL Apply. If SQL Apply is not running, the values for the statistics are cleared.
V$LOGSTDBY_TRANSACTION
Logical only
Displays information about all active transactions being processed by SQL Apply on the logical standby database.
V$MANAGED_STANDBY
Physical and snapshot
Displays current status information for Oracle database processes related to physical standby databases.
Note: The information in this view does not persist across an instance shutdown.
V$REDO_DEST_RESP_HISTOGRAM
Primary
Contains the response time information for destinations that are configured for SYNC transport.
Note: The information in this view does not persist across an instance shutdown.
V$STANDBY_EVENT_HISTOGRAM
Physical
Contains a histogram of apply lag values for the physical standby. An entry is made in the corresponding apply lag bucket by the Redo Apply process every second. (This view returns rows only on a physical standby database that has been open in real-time query mode.)
Note: The information in this view does not persist across an instance shutdown.
V$STANDBY_LOG
Physical, snapshot, and logical
Contains log file information from the standby redo log files.

Run the following queries in your standby database in order to know details about your Data Guard environment.

1) In order to know when your log last applied as well as last received log time issue following query:
select 'Last Applied  : ' Logs, to_char(next_time,'DD-MON-YY:HH24:MI:SS') Time
  from v$archived_log
   where sequence# = (select max(sequence#) from v$archived_log where applied='YES')
  union
   select 'Last Received : ' Logs, to_char(next_time,'DD-MON-YY:HH24:MI:SS') Time
  from v$archived_log
   where sequence# = (select max(sequence#) from v$archived_log);

Example output:

SQL> select 'Last Applied  : ' Logs, to_char(next_time,'DD-MON-YY:HH24:MI:SS') Time
  2             from v$archived_log
  3                     where sequence# = (select max(sequence#) from v$archived_log where applied='YES')
  4             union
  5                     select 'Last Received : ' Logs, to_char(next_time,'DD-MON-YY:HH24:MI:SS') Time
  6             from v$archived_log
  7                     where sequence# = (select max(sequence#) from v$archived_log);

LOGS             TIME
---------------- ------------------
Last Applied  :  08-MAR-11:19:18:30
Last Received :  22-MAR-11:14:20:28

2) Verify the last sequence# received and the last sequence# applied to standby database by following query:
select al.thrd "Thread", almax "Last Seq Received", lhmax "Last Seq Applied"
from (select thread# thrd, max(sequence#) almax
from v$archived_log
where resetlogs_change#=(select resetlogs_change# from v$database)
group by thread#) al,
(select thread# thrd, max(sequence#) lhmax
from v$log_history
where first_time=(select max(first_time) from v$log_history)
group by thread#) lh
where al.thrd = lh.thrd;
Example output:

SQL> select al.thrd "Thread", almax "Last Seq Received", lhmax "Last Seq Applied"
  2  from (select thread# thrd, max(sequence#) almax
  3  from v$archived_log
  4  where resetlogs_change#=(select resetlogs_change# from v$database)
  5  group by thread#) al,
  6  (select thread# thrd, max(sequence#) lhmax
  7  from v$log_history
  8  where first_time=(select max(first_time) from v$log_history)
  9  group by thread#) lh
 10  where al.thrd = lh.thrd;

    Thread Last Seq Received Last Seq Applied
---------- ----------------- ----------------
         1             33978             2074


3)In order to know about transport lag time, apply lag and apply finish time issue,
set lines 180
   col name for a40
   col value for a40
   col unit for a40
   select
    NAME,
    VALUE,
    UNIT 
    from v$dataguard_stats
    union
    select null,null,' ' from dual
    union
    select null,null,'Time Computed: '||MIN(TIME_COMPUTED)
   from v$dataguard_stats;

Example output:

SQL>    set lines 180
SQL>    col name for a40
SQL>    col value for a40
SQL>    col unit for a40
SQL>    select
  2      NAME,
  3      VALUE,
  4      UNIT
  5      from v$dataguard_stats
  6      union
  7      select null,null,' ' from dual
  8      union
  9      select null,null,'Time Computed: '||MIN(TIME_COMPUTED)
 10     from v$dataguard_stats;

NAME                                     VALUE                                    UNIT
---------------------------------------- ---------------------------------------- ----------------------------------------
apply finish time                                                                 day(2) to second(3) interval
apply lag                                +13 16:29:57                             day(2) to second(0) interval
estimated startup time                   45                                       second
transport lag                                                                     day(2) to second(0) interval

                                                                                  Time Computed: 03/22/2011 14:24:26

6 rows selected.

4)In order to know the status of the processes involved in Data Guard configuration issue following query,
select process,status,client_process,sequence#,block#,active_agents,known_agents
from v$managed_standby;
Example output:

SQL> select process,status,client_process,sequence#,block#,active_agents,known_agents
from v$managed_standby;  

PROCESS   STATUS       CLIENT_P  SEQUENCE#     BLOCK# ACTIVE_AGENTS KNOWN_AGENTS
--------- ------------ -------- ---------- ---------- ------------- ------------
ARCH      CLOSING      ARCH          33979      61441             0            0
ARCH      CLOSING      ARCH          33976      61441             0            0
ARCH      CONNECTED    ARCH              0          0             0            0
ARCH      CLOSING      ARCH          33977      61441             0            0
ARCH      CLOSING      ARCH          33978      61441             0            0
RFS       IDLE         LGWR          33980      42566             0            0
MRP0      WAIT_FOR_LOG N/A           24128          0            25           25
RFS       IDLE         UNKNOWN           0          0             0            0

8 rows selected.


Where the types of PROCESS may be,
- RFS - Remote file server
- MRP0 - Detached recovery server process
- MR(fg) - Foreground recovery session
- ARCH - Archiver process
- FGRD
- LGWR
- RFS(FAL)
- RFS(NEXP)
- LNS - Network server process

The process status may be,
UNUSED - No active process
ALLOCATED - Process is active but not currently connected to a primary database
CONNECTED - Network connection established to a primary database
ATTACHED - Process is actively attached and communicating to a primary database
IDLE - Process is not performing any activities
ERROR - Process has failed
OPENING - Process is opening the archived redo log
CLOSING - Process has completed archival and is closing the archived redo log
WRITING - Process is actively writing redo data to the archived redo log
RECEIVING - Process is receiving network communication
ANNOUNCING - Process is announcing the existence of a potential dependent archived redo log
REGISTERING - Process is registering the existence of a completed dependent archived redo log
WAIT_FOR_LOG - Process is waiting for the archived redo log to be completed
WAIT_FOR_GAP - Process is waiting for the archive gap to be resolved
APPLYING_LOG - Process is actively applying the archived redo log to the standby database

The client process may be,
Archival - Foreground (manual) archival process (SQL)
ARCH - Background ARCn process
LGWR - Background LGWR process

5) In the primary database ensure that everything is fine by issuing following commands. In case of RAC database ensure that these output is ok across all the instances.

select status,error from v$archive_dest where status <>'INACTIVE';
select * from v$archive_processes where status <> 'STOPPED';
show parameter dest_2
show parameter state_2
alter system set log_archive_dest_state_2=enable scope=both sid='*';
alter system switch logfile;
alter system switch logfile;
select status,error from v$archive_dest where status <>'INACTIVE';

Monday, March 21, 2011

Oracle 9i Form OCP Quizzes

In this quiz the following things are covered.

A) Forms Developer Environment
B) Modes of Operation
C) Query/Where Dialog Box
D) Data blocks
E) Layout Wizard
F) Modifying Layout
G) Reentrant Mode
H) Master-Detail Relationship
I) Control Block
J) Item Properties
K) Input Items
L) Combo Box
M) Radio Group
N) Navigation Trap
O) Transaction Processing
P) Check Box
Q) List Items
R) Visual Attribute
S) LOVs
T) Non Input Items
U) Canvas
V) Windows
W) Trigger Execution Hierarchy

1. An OC4J instance was started on a development PC and then a form was run from the Forms Builder. Which of the following statements describes the behavior of OC4J?
a. It appears in the Forms Builder window that can be minimized once OC4J starts
b. It appears in a separate window that can be closed once OC4J starts
c. It appears in the Forms Builder window that can be closed once OC4J starts
d. It appears in a separate window that should not be closed as the OC4J instance will abort

2. In which ways is an OC4 J instance shutdown neatly?
a. Make Exit selection Runtime Web form menu
b. Close Form Builder which would automatically close the Instance
c. Execute a batch file that is included with the Oracle9iDS
d. Close the Window from which OC4J started
e. Start the OC4J shutdown Instance

3. An Application was created based on the Employees Personal Information
and the Department in which they work. It consists of two blocks. The first one
is the Database Data block based on the Employees Personal Information like Name and Address and the other is non database data block based on the Employees Department Information. At runtime, the cursor is initially in the non database data block, the user clicks the Enter Query toolbar button and tries to search the Personal Information record of Employee whose Name is TOM. What would be the result?
a. Query would execute and the Record providing the Department Information of the employee matching the criteria would be Displayed.
b. Query would execute and the Record providing the Personal Information of the Employee matching the criteria would be displayed
c. Query would not execute as in the Enter query mode user is not allowed to navigate to other block so user cant even provide the search criteria of Employee Name in the Database data block

4. A Stock Maintenance Application maintaining information about the Automobiles was created. When the web form was interacted by the user, the
user wanted to search a record of either Automobile having Id as 'A001' or
'A002'. Which of the following methods would successfully open the Query/Where Dialog Box?
a. Enter an Alphabet with a colon (: a) in the Automobile id item then press Execute Button
b. Enter a Number with a colon (: 1) in the Automobile id item then press Execute Button
c. Enter any Alphabet in the Automobile Id item then press Execute Button
d. Enter a colon (:) in the Automobile Id item then press Execute Button

5. An Application needs a Department Module to be created. A Developer creates a Database data Block using the Data Block Wizard, after creating the Block based on the Departments table, while creating the Layout wizard, various items were placed on the canvas. The user wants to change the Employee_id Text Item to Display Item. How would it be possible?
a. It is not possible to change the Item type once its been created
b. The item type can be changed while placing the item on the canvas using layout wizard
c. Create a new Display Item and name it as Employee_id
d. None of the above

6. A number column called STATUS has been added to the ORDERS table. The SQL script was run to populate that column.
The Orders form should be updated to display the additional data. Currently, there is a non-base table display item in the Orders block called Total that is no longer desired. The Total item is located on the canvas in the position where the Status item should appear. The Property Palette for Total was opened, its name was changed to Status, and its Item Type was changed to Text Item. The form was run, but when a query was executed on the block, no data was displayed in the Status item. What should be done to correct this problem?
a. Set the Database Item property to Yes for the Status item
b. Use the form to populate the Status item, since the SQL script that was run obviously did not work
c. Set the Name property for the Status item to STATUS, because it must be uppercase to match the column name in the database
d. Use the Data Block Wizard in reentrant mode to add the item, because add a base table item cannot be added by changing the item type of an existing item

7. Three possible credit ratings are assigned to customers: Poor, Good, and Excellent (represented numerically by 1, 2, and 3). A RATING column was added to the CUSTOMERS table and the DBA was asked to add an item to the form so that data entry clerk can populate the RATING column. To restrict data entry clerks to one of these three values, the DBA decided to create a radio group for the Rating item. With the Customers block selected in the Layout Editor, he used the radio button to create three radio buttons on the canvas. He then set the labels (Poor, Good, and Excellent) and values (1, 2, and 3) for the radio buttons. He set the name of the radio group to RATING, its Data Type to Number, and its Database column to Rating. He then ran the form to test it. When he executed a query, however, no records were returned, although there were many customer records in the database. What can he do to make the query return the records?
a. Set the Mapping of Other Values property for the radio group to Null
b. Create a fourth radio button for an undetermined credit rating and leave its value blank
c. Create a fourth radio button for an undetermined credit rating and explicitly set its value to Null
d. Choose a different type of input, because radio groups do not allow query of Null values
e. None of the above

8. Which of the following statement is correct with regard to Data properties of a text item?
a. If the Maximum Length of an item is set to a value that is greater than the value for Width, the item will not be displayed at run time
b. The Initial Value for an item can be set outside the range of values specified by the Lowest Allowed Value and the Highest Allowed Value properties because Initial Value defines an exception to that range
c. If the Required property is set to Yes for an item whose corresponding database column does not have a NOT NULL constraint, an error will occur at run time
d. If Data Length Semantics property is set to BYTE, the Maximum Length property may have to be manually adjusted depending on the character set that is being used

9. The DBA added a STATE column defined as VARCHAR2(2) to the State table. This column will contain two-letter state abbreviations; because the State table is quite large, storing complete state names would waste space in the database. The DBA asks JOHN to add a corresponding State item to the State block of the Geographical Management form.
JOHN opened the Layout Editor of the Geographical Management form and created a list item on the canvas in the State block. In the Property Palette for the list item, he changed the Name property to State and the Database Item property to Yes. He then open the Elements in List property and add some state abbreviations and names to the list, as shown in the exhibit. When he ran the form to test it, after selecting a value from the list and clicking Commit, he received an FRM error. Its corresponding database error is the following: ORA-01401: inserted value too large for column
What should he do to correct this problem?
a. Have the DBA increase the column width in the database
b. Change the List Style property for the State item to T-list
c. Change the List Style property for the State item to Combo Box
d. Set Initial Value for the State item to one of the elements in the list
e. Set Mapping of Other Values for the State item to a two-letter state abbreviation
f. Change the elements in the list of the State item so that the list elements are the state names and the list element values are the state abbreviations

10. a Visual Attribute called VA was created to standardize the appearance of certain text items in a particular form, and values for all of its properties were defined. Which properties can be set by applying VA to the items?
a. Width
b. Height
c. Prompt
d. Font Weight
e. Fill Pattern
f. Foreground Color

11. There is an EMP block in the Employee.fmb module, which is currently on a content canvas. Items from the EMP block should be displayed on a new tab canvas. What are the ways to achieve this?
a. Create a tab canvas in the Layout Editor
For each item, associate the tab canvas by specifying the Canvas property
Set the Rendered property of each item to Yes
b. Create a Tab page in the Layout Editor
Associate the content canvas with each item by specifying the Item Canvas property
For each item, associate the tab page by specifying the Tab Page property
Set the Visible property of each item to Yes
c. Create a tab canvas in the Layout Editor
For each item, associate the tab canvas by specifying the Canvas property
For each item, associate the tab page by specifying the Tab Page property
d. Create a canvas in the Object Navigator
Set the Canvas Type property to Content
For each item, associate the new canvas by specifying the Item Canvas property
e. Create a new canvas in the Object Navigator
Set the Canvas Type property to Tab
For each item, associate the new canvas by specifying the Item Canvas property
For each item, associate the tab page by specifying the Tab Page property

12. An Application was created in which the various triggers were defined at the Form level, Block level, Item level. The Execution Hierarchy property of the Trigger defined at the Form level was set to Before, For the Block level trigger it was set to Before, For the Item level Trigger it was set to after. How would the various triggers fire, based on the execution Hierarchy?
a. Firstly Block level then Form and in the last Item level trigger would fire
b. Firstly Item level then Block level and in the last Form level
c. Firstly Block level then Form level and in the last Item level.

Oracle 9i Form OCP Test for Exercise

It covers following topics -

- Variables in Triggers
- Using Triggers
- Debugging
- Message Levels
- Menus
- Record Group
- Object Groups
- Message Handling
- PL/SQL Library
- Alerts
- Validation
- Data Sources
- MultiForm Application
- Navigation
- Form Trigger Failure
- Property Classes
- Query Triggers
- Error Handling

1. SMITH was running a form in the debug mode and begins to step through the code of a lengthy subprogram. After stepping through a few lines of its code, he realized that the error came not from the code in that particular subprogram but from code that is executed after it. At this point, how can he jump to the next line of code after the call to the subprogram?
a. Clicking Step Over to step over the execution of the subprogram
b. Opening the Stack panel, selecting the previous stack frame, and clicking Go
c. Clicking Step Out to resume stepping through code after the subprogram is called
d. HE cannot do this in the same debug session. He should click Stop, set a breakpoint immediately after the subprogram code is called, and run the form in debug mode again

2. What type of message indicates a Forms message that cannot be suppressed?
a. A Busy message
b. A level 0 message
c. A Working message
d. A level 25 message
e. A level 50 message
f. A message with a level less than 0
g. A message with a level greater than 25

3. An application uses a menu that contains a Check type Menu Item. Which built-in should be used to programmatically toggle the checked/unchecked state of the Check item.
a. FIND_MENU_ITEM
b. GET_ITEM_PROPERTY
c. SET_ITEM_PROPERTY
d. SET_MENU_ITEM_PROPERTY
e. GET_MENU_ITEM_PROPERTY

4. A menu was created for the Summit Office Supply applications that was attached to its main form. The menu, whose Menu Editor, contains the following submenus:

Applications, displaying a choice of forms to invoke
Customers, displaying menu items for the Customers form
Orders, displaying menu items for the Orders form
HR, displaying menu items for the HR form
The Main Menu property for the menu is set to Applications.

When the user chooses from the Applications submenu to invoke another form, which built-in can be used to display the appropriate menu items for that form?
a. FIND_MENU
b. REPLACE_MENU
c. FIND_MENU_ITEM
d. SET_FORM_PROPERTY
e. SET_MENU_ITEM_PROPERTY

5. A form was being developed that serves as a front end to access the Order Entry application. Within the form, the usernames of those users should be stored who have permissions to run the application. This information is accessed when the form starts up to determine if the user is authorized. The list of usernames is not stored in the database and should not be visible to users. How should this information be stored?
a. In a list item
b. In a list of values
c. In a set of parameters
d. In a record group

6. Which of the following statements are correct with regard to Query Record Group?
a. The Record Group is associated with a query
b. The Record Group can be created only at run time
c. The Record Group can be created and modified only at design time
d. The Record Group can be created and modified at design time or at run time
e. The query associated with this Record Group can be defined only at design time

7. A query Record Group was created at design time. Which built-in can be used to execute the query defined in the Record Group object?
a. ADD_GROUP_ROW
b. POPULATE_GROUP
c. ADD_GROUP_COLUMN
d. SET_GROUP_SELECTION

8. Which of the following helps in programmatically determining the button a user pressed to respond to an alert?
a. Use the GET_ALERT_PROPERTY function
b. Use the GET_ALERT_BUTTON_PROPERTY function
c. Check the value returned by the SHOW_ALERT function to see if it is 1, 2, or 3
d. Check the value returned by the SHOW_ALERT function to see if it is ALERT_BUTTON1, ALERT_BUTTON2, or ALERT_BUTTON3

9. There is a requirement to invoke the Orders form from the Customers form. Which of the following suggestions names a built-in that will meet the requirements and also offers a correct reason?
a. CALL_FORM because NEW_FORM is no longer valid for Web-deployed forms due to the extra network traffic that is causes
b. CALL_FORM because it can be issued in Enter-Query mode and can be constrained to be Query only
c. CALL_FORM because the second form is invoked in a modeless state and it saves on memory resources
d. NEW_FORM because the second form is invoked in a modeless state and the user can navigate freely between the two running forms

10. The database EMPLOYEES table has a foreign key constraint referencing the DEPARTMENTS table. A Human Resource application is being developed. HR clerks use the Employees form to query, update, and insert employee records. They occasionally attempt to add an employee who is in a new department that has not yet been entered into the database. When this happens, they receive an error indicating that the parent record cannot be found, so they cannot commit the employee record. The HR clerks have requested that a button be placed on the form to enable them to invoke the Departments form to enter the new department and save it independently. They want to be able to return to the Employees form and decide whether or not to save the new employee record. How should the When-Button-Pressed trigger be coded to achieve this?
a. CALL_FORM('Departments);
b. CALL_FORM('Departments',NO_HIDE);
c. OPEN_FORM('Departments');
d. OPEN_FORM('Departments', ACTIVATE, SESSION);
e. OPEN_FORM('Departments', NO_ACTIVATE, NO_SESSION);

11. Consider the following scenario: In a multiform application, the user started in FormA.

From FormA, the user invoked FormB using CALL_FORM.
From FormB, the user invoked FormC using OPEN_FORM.
From FormC, the user invoked FormD using OPEN_FORM.
From FormB, the user invoked FormE using CALL_FORM.

There is an additional form in the application, called FormF. Which statement is true?
a. FormF can be invoked from FormC using CALL_FORM.
b. FormF can be invoked from FormA using OPEN_FORM.
c. FormF can be invoked from FormD using CALL_FORM.
d. FormF can be invoked from FormE using CALL_FORM.
e. FormF can be invoked from FormB using OPEN_FORM.

12. Which of the following statement is correct with regard to client-side validation?
a. It requires a network round trip
b. It does not require any middle-tier configuration
c. It requires setting an item's Implementation Class property
d. It is implemented with the When-Validate-Item and When-Validate-Record triggers

Oracle OCP 10g Upgradation Questions and Answers

1. Which data dictionary view should be used to get a list of object privileges for all database users?
a. DBA_TAB_PRIVS
b. ALL_TAB_PRIVS
c. USER_TAB_PRIVS
d. ALL_TAB_PRIVS_MADE


2. Which data dictionary view(s) do are needed to query to find the following information about a user?
- Whether the user's account has expired
- The user's default tablespace name
- The user's profile name
a. DBA_USERS only
b. DBA_USERS and DBA_PROFILES
c. DBA_USERS and DBA_TABLESPACES
d. DBA_USERS, DBA_TS_QUOTAS, and DBA_PROFILES


3. Which of the following is true about alerts?
a. A maximum of one undo alert is received per every 12-hour period.
b. A maximum of one undo alert is received during a 24-hour period.
c. A maximum of one tablespace alert is received during a 124-hour period.
d. A maximum of one tablespace alert is received during a 24-hour period.


4. The DBA issues the following command:
SQL< alter table ORDER SHRINK SPACE
What be the result of this statement?
a. There would be only a compacting of the data, not a release of data
b. There would be no impact on DML operations in the database
c. There would be immediate release of the free space
d. There would be an impact on the DML operations in the database


5. What does the initialization parameter FAST_START_MTTR_TARGET determine?
a. The instance recovery time
b. The undo retention period
c. The database restore time
d. The number of redo log groups


6. To avoid a large number of extents for big file tablespaces in very large databases, what does Oracle recommend?
a. Use the AUTOALLOCATE clause for allocating new extents and set a very high extent size
b. Use the UNIFORM clause and simply let Oracle take care of the extent sizing
c. Use the UNIFORM clause for allocating new extents and set a very high extent size
d. Use the AUTOALLOCATE clause and simply let Oracle take care of the extent sizing


7. What is the equivalent of the old DROP TABLE command in Oracle Database 10g?
a. DROP TABLE NO PURGE
b. DROP TABLE works exactly the way it did in previous versions.
c. DROP TABLE … PURGE
d. DROP TABLE … TO BEFORE DROP


8. Which type of commands are used to copy ASM files?
a. RMAN commands
b. OMF commands
c. Operating system commands
d. Logical Volume Manager commands


9. What do ASM disk groups provide?
a. Redundancy through striping
b. Performance through mirroring.
c. Redundancy through mirroring
d. Performance through striping


10. For which types of tablespaces can proactive tablespace alerts be set?
a. Locally managed
b. Dictionary-managed
c. Read-only
d. Online


11. Which of the following conditions must be met, if tablespace is to be made read only?
a. The tablespace must contain an active rollback segments
b. The tablespace must be online
c. The tablespace must not contain any active rollback segments
d. The tablespace must not be involved in an open backup
e. The tablespace must be involved in an open backup


12. What are the three ways in which an addm report can be obtained?
a. Use the DBA_ADVISOR.GET_TASK_REPORT procedure
b. Use the DBMS_ADVISOR.REPORT_TASK PROCEDURE
c. Use the DBMS_ADVISOR.GET_TASK_REPORT Procedure
d. Use the addmrpt.sql script
e. Use the awrrpt.sql script
f. Use the OEM Database Control