ORA-04016
Hi,
I am getting an ORA-04016 (ORA-04016: sequence <name> no longer exists).
These are the statements:
1. CREATE SEQUENCE <seq> START WITH 1 INCREMENT BY 1 CACHE 1000 NOCYCLE
2. INSERT INTO <table1> (<columns>) SELECT <seq>.NEXTVAL, <columns> FROM <table2>
3. DROP SEQUENCE <seq>
I often call these statements without error, but suddenly the error occures in line 2. and after that time the error always comes up. I have to reconnect to the db to get rid of it.
There is only 1 session on that DB and the caller is single threaded. So concurrency is not an issue.
My question is: What does the error mean and how can I avoid it? I found nothing on the web about this.
Thanks,
Albrecht
Thanks for your time and thoughts.
To Raj: I'm inserting as many records as in table2 not just one. And I'm dropping the seq after using it because I have to recreate it when passing these lines of code next time.
To Jens: Do I have to be a paying member of something to view those bugs? (I am not - you guessed it). But regarding the title of the bug I think: no, I'm not dropping any users.
To all: Is there any programmer who hacked something like this into the oracle kernel: "IF USER=="albrecht" THEN THROW ORA-04016 SPORADICALLY"? I mean line 2 is a transaction and who if not the system can drop a sequence inside a transaction that uses it? I do not understand the real meaning of this error. What code do I have to provide to force the error running tha code first time?
TIA,
Albrecht
Similar Messages
-
ORA-04016 - Sequence no longer exists
Hi,
In the below scenario
1. All the sequences are dropped
2. When a process requires a value from a sequence and the sequence is not available, it is created and then a sequence.nextval is executed.
This statement is returning a ORA-04016 - Sequence <XXX> no longer exists.
Based on the following Metalink 1300837.1, we tried putting a sleep(5) between the sequence creation and fetch. The problem still occurs intermittently.
DB Version is 11.2.0.2 on Exadata with 6 nodes.
Even after an extensive search on the web, I could not find anything.
Is there any workaround for this or is there some DB patch to be applied?
ThanksHave you tried sleeping for longer?
Alternative approaches that spring to mind are:
1) Ensure that the statements that create the sequence and those that subsequently use it are executed on the same node when executed in close succession.
2) Trap the error and retry in your code.
I'd be inclined to favour suggestion 1 if possible in your environment.
Is your code in PL/SQL? -
hi
I am getting this ora error:
ORA-04016: sequence xxx no longer exists.
the sequence exists in "DBA_SEQUENCES" and the owner is the correct one.
what am I missing ?
thank youI logged in as the username:
SQL> SELECT last_value from SEQ1;
SELECT last_value from SEQ1
ERROR at line 1:
ORA-02201: sequence not allowed here
SQL> select * from dba_sequences where SEQUENCE_NAME like 'SEQ1';
SEQUENCE_OWNER SEQUENCE_NAME MIN_VALUE MAX_VALUE INCREMENT_BY C O CACHE_SIZE LAST_NUMBER
USER1 SEQ1 1 1.0000E+27 1 N N 20 40001
thank you -
ive created a sequence and ran the query against it as below
SQL> PROMPT Creating Sequence 'emp_seq'
Creating Sequence 'emp_seq'
SQL> CREATE SEQUENCE emp_seq
2 MINVALUE 200
3 MAXVALUE 9999999
4 START WITH 201
5 INCREMENT BY 1
6 CACHE 20;
Sequence created.
SQL>
SQL> insert into employee (emp_id, emp_name, emp_hiredate, ou_id)
2 select emp_seq.nextval,emp_name, emp_hiredate, ou_id
3 from employee;
select emp_seq.nextval,emp_name, emp_hiredate, ou_id
ERROR at line 2:
ORA-04016: sequence EMP_SEQ no longer exists
and this error occurs it all looks ok to me quite strange ive dropped and re created the sequence any ideas???its ok dropping the sequence and logging back into sql plus fixed it for some reason????????
-
ORA-00333: redo log read error block
ORA-01033: ORACLE initialization or shutdown in progress ...
/ as sysdba
SQL> shutdown immediate;
SQL> startup nomount;
SQL> alter database mount;
SQL> alter database open;
ORA-00333: redo log read error block 8299 count 8192
SQL> SELECT * FROM V$VERSION;
BANNER
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Product
PL/SQL Release 10.2.0.1.0 - Production
CORE 10.2.0.1.0 Production
TNS for 32-bit Windows: Version 10.2.0.1.0 - Production
NLSRTL Version 10.2.0.1.0 - Production
SQL> select group#,members,THREAD, STATUS,ARCHIVED,BYTES,FIRST_TIME,FIRST_CHAGE#,SEQUENCE# from v$log;
GROUP# MEMBERS,THREAD,STATUS,ARCHIVED,BYTES,FIRST_TIME,FIRST_CHAGE#,SEQUENCE#
1 1 1 CURRENT NO 52428800 29-FEB-12 1597643 57
2 1 1 INACTIVE NO 52428800 29-FEB-12 1573462 56
Dump file c:\oraclexe\app\oracle\admin\xe\bdump\alert_xe.log
Wed Feb 29 19:46:38 2012
Recovery of Online Redo Log: Thread 1 Group 1 Seq 56 Reading mem 0
Mem# 0 errs 0: C:\ORACLEXE\APP\ORACLE\FLASH_RECOVERY_AREA\XE\ONLINELOG\O1_MF_1_7LZYZK8S_.LOG
Wed Feb 29 19:46:40 2012
Completed redo application
Wed Feb 29 19:46:40 2012
Completed crash recovery at
Thread 1: logseq 56, block 6568, scn 1597642
270 data blocks read, 270 data blocks written, 1460 redo blocks read
Wed Feb 29 19:46:43 2012
Thread 1 advanced to log sequence 57
Thread 1 opened at log sequence 57
Current log# 2 seq# 57 mem# 0: C:\ORACLEXE\APP\ORACLE\FLASH_RECOVERY_AREA\XE\ONLINELOG\O1_MF_2_7LZYZL5V_.LOG
Successful open of redo thread 1
Wed Feb 29 19:46:43 2012
SMON: enabling cache recovery
Wed Feb 29 19:46:55 2012
Successfully onlined Undo Tablespace 1.
Wed Feb 29 19:46:55 2012
SMON: enabling tx recovery
Wed Feb 29 19:46:56 2012
Database Characterset is AL32UTF8
replication_dependency_tracking turned off (no async multimaster replication found)
Starting background process QMNC
QMNC started with pid=19, OS id=3024
Wed Feb 29 19:47:09 2012
Completed: alter database open
Wed Feb 29 19:47:14 2012
db_recovery_file_dest_size of 10240 MB is 0.98% used. This is a
user-specified limit on the amount of space that will be used by this
database for recovery-related files, and does not reflect the amount of
space available in the underlying filesystem or ASM diskgroup.
Wed Feb 29 20:33:30 2012
MMNL absent for 1537 secs; Foregrounds taking over
Wed Feb 29 20:33:31 2012
MMNL absent for 1540 secs; Foregrounds taking over
Wed Feb 29 20:33:31 2012
MMNL absent for 1540 secs; Foregrounds taking over
MMNL absent for 1540 secs; Foregrounds taking over
Wed Feb 29 20:33:32 2012
MMNL absent for 1540 secs; Foregrounds taking over
Wed Feb 29 20:33:33 2012
MMNL absent for 1540 secs; Foregrounds taking over
Wed Feb 29 21:45:24 2012
MMNL absent for 4318 secs; Foregrounds taking over
MMNL absent for 4318 secs; Foregrounds taking over
MMNL absent for 4322 secs; Foregrounds taking over
Dump file c:\oraclexe\app\oracle\admin\xe\bdump\alert_xe.log
Wed Feb 29 22:30:01 2012
ORACLE V10.2.0.1.0 - Production vsnsta=0
vsnsql=14 vsnxtr=3
Windows XP Version V5.1 Service Pack 3, v.3244
CPU : 2 - type 586, 2 Physical Cores
Process Affinity : 0x00000000
Memory (Avail/Total): Ph:3097M/3546M, Ph+PgF:5143M/5429M, VA:1943M/2047M
Wed Feb 29 22:30:01 2012
Starting ORACLE instance (normal)
LICENSE_MAX_SESSION = 0
LICENSE_SESSIONS_WARNING = 0
Picked latch-free SCN scheme 2
Using LOG_ARCHIVE_DEST_10 parameter default value as USE_DB_RECOVERY_FILE_DEST
Autotune of undo retention is turned on.
IMODE=BR
ILAT =10
LICENSE_MAX_USERS = 0
SYS auditing is disabled
ksdpec: called for event 13740 prior to event group initialization
Starting up ORACLE RDBMS Version: 10.2.0.1.0.
System parameters with non-default values:
sessions = 49
__shared_pool_size = 201326592
__large_pool_size = 8388608
__java_pool_size = 4194304
__streams_pool_size = 0
spfile = C:\ORACLEXE\APP\ORACLE\PRODUCT\10.2.0\SERVER\DBS\SPFILEXE.ORA
sga_target = 805306368
control_files = C:\ORACLEXE\ORADATA\XE\CONTROL.DBF
__db_cache_size = 587202560
compatible = 10.2.0.1.0
db_recovery_file_dest = C:\oraclexe\app\oracle\flash_recovery_area
db_recovery_file_dest_size= 10737418240
undo_management = AUTO
undo_tablespace = UNDO
remote_login_passwordfile= EXCLUSIVE
dispatchers = (PROTOCOL=TCP) (SERVICE=XEXDB)
shared_servers = 4
local_listener = (ADDRESS=(PROTOCOL=TCP)(HOST=winsp3ue)(PORT=1522))
job_queue_processes = 4
audit_file_dest = C:\ORACLEXE\APP\ORACLE\ADMIN\XE\ADUMP
background_dump_dest = C:\ORACLEXE\APP\ORACLE\ADMIN\XE\BDUMP
user_dump_dest = C:\ORACLEXE\APP\ORACLE\ADMIN\XE\UDUMP
core_dump_dest = C:\ORACLEXE\APP\ORACLE\ADMIN\XE\CDUMP
db_name = XE
open_cursors = 300
os_authent_prefix =
pga_aggregate_target = 268435456
PMON started with pid=2, OS id=2176
PSP0 started with pid=3, OS id=2204
MMAN started with pid=4, OS id=2208
DBW0 started with pid=5, OS id=2212
LGWR started with pid=6, OS id=2220
CKPT started with pid=7, OS id=2240
SMON started with pid=8, OS id=2460
RECO started with pid=9, OS id=2464
CJQ0 started with pid=10, OS id=2480
MMON started with pid=11, OS id=2484
Wed Feb 29 22:30:02 2012
starting up 1 dispatcher(s) for network address '(ADDRESS=(PARTIAL=YES)(PROTOCOL=TCP))'...
MMNL started with pid=12, OS id=2492
Wed Feb 29 22:30:02 2012
starting up 4 shared server(s) ...
Oracle Data Guard is not available in this edition of Oracle.
Wed Feb 29 22:30:02 2012
alter database mount exclusive
Wed Feb 29 22:30:06 2012
Setting recovery target incarnation to 2
Wed Feb 29 22:30:06 2012
Successful mount of redo thread 1, with mount id 2657657770
Wed Feb 29 22:30:06 2012
Database mounted in Exclusive Mode
Completed: alter database mount exclusive
Wed Feb 29 22:30:07 2012
alter database open
Wed Feb 29 22:30:07 2012
Beginning crash recovery of 1 threads
Wed Feb 29 22:30:07 2012
Started redo scan
Wed Feb 29 22:30:15 2012
Errors in file c:\oraclexe\app\oracle\admin\xe\udump\xe_ora_2544.trc:
ORA-00333: redo log read error block 10347 count 6144
ORA-00312: online log 2 thread 1: 'C:\ORACLEXE\APP\ORACLE\FLASH_RECOVERY_AREA\XE\ONLINELOG\O1_MF_2_7LZYZL5V_.LOG'
ORA-27070: async read/write failed
OSD-04016: Error queuing an asynchronous I/O request.
O/S-Error: (OS 23) Data error (cyclic redundancy check).
Waiting for Help
RegardsErrors in file c:\oraclexe\app\oracle\admin\xe\udump\xe_ora_2544.trc:
ORA-00333: redo log read error block 10347 count 6144
ORA-00312: online log 2 thread 1: 'C:\ORACLEXE\APP\ORACLE\FLASH_RECOVERY_AREA\XE\ONLINELOG\O1_MF_2_7LZYZL5V_.LOG'
ORA-27070: async read/write failed
OSD-04016: Error queuing an asynchronous I/O request.
O/S-Error: (OS 23) Data error (cyclic redundancy check).Might your redo log file is corrupted or not exist, check physically. -> C:\ORACLEXE\APP\ORACLE\FLASH_RECOVERY_AREA\XE\ONLINELOG\O1_MF_2_7LZYZL5V_.LOG
is it archivelog mode?
perform fake recovery and open resetlogs. -
Error ora-01033 initialization or shutdown in progress Oracle 10g
Hello !
I am a young Gabonese student and I need your help , it turns out that I have an Oracle database 10g and I am facing the same problem for a month already
Indeed, my database shows me
The instance of the database that my application connects (SID = MyApp) fails has started, due to an error with the code:
ora-01033 initialization or shutdown in progress.
And here is the list of other error messages that SQLPLUS console displays:
ORA - 01115: for I / O error reading block from file 2 <# block 926>
ORA - 01110: data file 2:
C: \ MyApp \ DATABASE \ ORACLE \ ORADATA \ MyApp \ UNDOTBS01.DBF
ORA - 27070: Failed to read / write asynchronous
OSD - 04016: Error queuing of pending asynchronous I / O request.
O / S - Error: <OS 1117> unable to meet demand due to an error O peripheral I /
ORA - 01115: I / O error reading block from file 2 <Block # 983>
ORA - 01110 data file 2
C: \ MyApp \ DATABASE \ ORACLE \ ORADATA \ MyApp \ UNDOTBS01.DBF
ORA - 27070: failure to read / write asynchronous
it 's been days since I research different forum a clear solution for this type of problem but I can not find anything satisfactory and definitive any help for me is precious ... thank you in advancec8884db4-2595-4c5e-bd57-a33002f6d13c wrote:
Hello !
I am a young Gabonese student and I need your help , it turns out that I have an Oracle database 10g and I am facing the same problem for a month already
Indeed, my database shows me
The instance of the database that my application connects (SID = MyApp) fails has started, due to an error with the code:
ora-01033 initialization or shutdown in progress.
And here is the list of other error messages that SQLPLUS console displays:
ORA - 01115: for I / O error reading block from file 2 <# block 926>
ORA - 01110: data file 2:
C: \ MyApp \ DATABASE \ ORACLE \ ORADATA \ MyApp \ UNDOTBS01.DBF
ORA - 27070: Failed to read / write asynchronous
OSD - 04016: Error queuing of pending asynchronous I / O request.
O / S - Error: <OS 1117> unable to meet demand due to an error O peripheral I /
ORA - 01115: I / O error reading block from file 2 <Block # 983>
ORA - 01110 data file 2
C: \ MyApp \ DATABASE \ ORACLE \ ORADATA \ MyApp \ UNDOTBS01.DBF
ORA - 27070: failure to read / write asynchronous
it 's been days since I research different forum a clear solution for this type of problem but I can not find anything satisfactory and definitive any help for me is precious ... thank you in advance
OS/Disk failure external to Oracle.
Oracle is victim; not the culprit.
After the disk throwing error is replaced, you will need to restore the DB from most recent backup. -
ORA-01033 Error Coming Continuosly
When I am trying to connect to the database the error is coming "Oracle shutdown or intilialization is in process". I am not able to do anything.
My database is on some other computer and i am trying to connect using host string. I am using Oracle version10.1.0.4.2 (10G)
I checked the trace file and got the error below:
ORA-00333: redo log read error block 31464 count 8192
ORA-00312: online log 2 thread 1: 'D:\ORACLE\ORADATA\ORCL\REDO02.LOG'
ORA-27070: async read/write failed
OSD-04016: Error queuing an asynchronous I/O request.
O/S-Error: (OS 23) Data error (cyclic redundancy check).
ORA-00333: redo log read error block 31464 count 8192
ORA-00312: online log 2 thread 1: 'D:\ORACLE\ORADATA\ORCL\REDO02.LOG'
ORA-27091: unable to queue I/O
ORA-27070: async read/write failed
OSD-04006: ReadFile() failure, unable to read from file
O/S-Error: (OS 23) Data error (cyclic redundancy check).
*** 2008-05-13 18:14:50.934
ORA-00333: redo log read error block 31464 count 8192
Please suggest the needful asap or mail @ [email protected]ORA-01033: ORACLE initialization or shutdown in progress
Cause: An attempt was made to log on while Oracle is being started up or shutdown.
Action: Wait a few minutes. Then retry the operation. -
ORA-01033: Recovering database
Hi,
I have 2 database running on my local system ( Windows-XP, Oracle 10g ).
After abrupt shutdown of the system, one of my DB is throwing an error ORA-01033 ORACLE initialization or shutdown in progress.
So I tried with below given things to fix the error.
c:\sqlplus /nolog
SQL> connect sys as sysdba
SQL> shutdown
SQL> startup
It gave an error..
ORA-12528:TNS:Listener:All Appropriate instances are blocking new connections
SQL> select status from v$instance;
ORA-03114: not connected to ORACLE
So I tried stopping and restarting the Listener.
LSNRCTL> stop
LSNRCTL> start
Then again tried to startup the database
SQL> startup
ORA-01041: internal error. hostdef extension doesn't exist
SQL> alter database mount;
SQL> alter database open;
Alertlog file shows....
Recovery of Online Redo Log: Thread 1 Group 3 Seq 373 Reading mem 0
Mem# 0 errs 0: E:\ORACLE\PRODUCT\10.2.0\ORADATA\GALAXY\REDO03.LOG
Mon Aug 09 17:17:40 2010
Aborting crash recovery due to error 1115
Mon Aug 09 17:17:41 2010
Errors in file e:\oracle\product\10.2.0\admin\galaxy\udump\galaxy_ora_3152.trc:
ORA-01115: IO error reading block from file 3 (block # 51483)
ORA-01110: data file 3: 'E:\ORACLE\PRODUCT\10.2.0\ORADATA\GALAXY\SYSAUX01.DBF'
ORA-27070: async read/write failed
OSD-04016: Error queuing an asynchronous I/O request.
O/S-Error: (OS 23) Data error (cyclic redundancy check).
It looks like block corruption in the sysaux tablespace file.
Please help me, in recovering the database. ( in detail / steps is very much appreciated )
Thanks & Regards,
LokeshIt would be important to know what kind of backups do you have.
Do you have offline backup?
Do you have archive mode turned on?
See another thread of this forum (or you can even search for others)
dbf file missing
to get some experience in similar issues... -
RMAN备份报错ORA-19501,DBV验证报错DBV-00102
存储发现有异常,厂商决定要重做raid
现在要进行数据备份,exp已备份无异常
rman备份时报错:
RMAN> backup validate datafile 53;
启动 backup 于 2012.11.05 14:41:26
分配的通道: ORA_DISK_1
通道 ORA_DISK_1: sid=524 devtype=DISK
通道 ORA_DISK_1: 启动全部数据文件备份集
通道 ORA_DISK_1: 正在指定备份集中的数据文件
输入数据文件 fno=00053 name=E:\TOEC01.DBF
RMAN-03009: backup 命令 (ORA_DISK_1 通道上, 在 11/05/2012 14:41:29 上) 失败
ORA-19501: 文件 "E:\TOEC01.DBF", 块编号 12545 读错误 (块大小 = 8192)
ORA-27070: 异步读取/写入失败
OSD-04016: 异步 I/O 请求排队时出错。
O/S-Error: (OS 1) 函数不正确。
关闭异步I/O同步
alter system set disk_asynch_io=FALSE scope=spfile;
重启实例
RMAN> backup validate datafile 53;
启动 backup 于 2012.11.05 15:24:53
使用通道 ORA_DISK_1
通道 ORA_DISK_1: 启动全部数据文件备份集
通道 ORA_DISK_1: 正在指定备份集中的数据文件
输入数据文件 fno=00053 name=E:\TOEC01.DBF
RMAN-03009: backup 命令 (ORA_DISK_1 通道上, 在 11/05/2012 15:24:57 上) 失败
ORA-19501: 文件 "E:\TOEC01.DBF", 块编号 11905 读错误 (块大小 = 8192)
ORA-27070: 异步读取/写入失败
OSD-04006: ReadFile() 失败, 无法读取文件
O/S-Error: (OS 1) 函数不正确。
E:\>dbv file=TOEC01.DBF blocksize=8192
DBVERIFY: Release 10.2.0.1.0 - Production on 星期一 11月 5 15:29:23 2012
Copyright (c) 1982, 2005, Oracle. All rights reserved.
DBVERIFY - 开始验证: FILE = TOEC01.DBF
DBV-00102: FILE (TOEC01.DBF) 在 verification read 操作 (-2) 期间出现文件 I/O 错误
os:Windows2003 x64
db:oracle10.2.0.1.0 x64
求解,怎样能使rman继续完成备份?ORA-19501: 文件 "E:\TOEC01.DBF", 块编号 11905 读错误 (块大小 = 8192)
ORA-27070: 异步读取/写入失败
OSD-04006: ReadFile() 失败, 无法读取文件
O/S-Error: (OS 1) 函数不正确。
DBV-00102: FILE (TOEC01.DBF) 在 verification read 操作 (-2) 期间出现文件 I/O 错误
说明该 数据文件的 11905 block存在 物理上的损坏,无法被读取
advise:
1. 尝试cp 该文件到其他位置 看是否能修复问题
2. 若步骤1 无效则在步骤1的基础上 对该数据块 做blockrecover,当然这需要该数据文件的全量备份和归档日志
3. 若没有备份考虑用 dbms_repair 包对该块标记为 corruption
建议你先查一下是否只有这样一个 物理坏块,这个块具体属于什么segment,就EXP看应当是TABLE,
那么可以考虑用 10231 event + CTAS 重建该表,并DROP 原表后再 exp
改造Oracle中文技术生态环境!
*<font color="red" size="2" face="courier">如果觉得本回复有意义,请点击本条回复右手边的Correct按钮,谢谢!</font>*
如何在OTN中文技术论坛提一个问题?
论坛礼仪需知及学习oracle的方法论
Maclean Liu
Oracle Database Administrator
Oracle Certified 10g/11g Master
www.askmaclean.com
请把需要上传的文件发给我
有问题请去OTN中文论坛开个帖子 我会回复 地址:http://www.otncn.org
如果需要发送附件,可以直接发邮件到 [email protected] -
Hi,
I'am in need of some help.
We are experience the following error:
*** SESSION ID:(33.4) 2005-07-18 21:05:17.062
*** 2005-07-18 21:05:17.062
ksedmp: internal or fatal error
ORA-01114: IO-fejl ved skrivning af blok i filen 608 (blok # 4172972)
ORA-27070: skgfdisp: asynkron læsening/skrivning fejlede
OSD-04016: Fejl ved kø til asynkron I/O-anmodning.
O/S-Error: (OS 2) The system cannot find the file specified.
ORA-01114: IO-fejl ved skrivning af blok i filen 608 (blok # 4172972)
ORA-27070: skgfdisp: asynkron læsening/skrivning fejlede
OSD-04016: Fejl ved kø til asynkron I/O-anmodning.
O/S-Error: (OS 2) The system cannot find the file specified.
ORA-01114: IO-fejl ved skrivning af blok i filen 608 (blok # 4172972)
ORA-27070: skgfdisp: asynkron læsening/skrivning fejlede
OSD-04016: Fejl ved kø til asynkron I/O-anmodning.
O/S-Error: (OS 2) The system cannot find the file specified.
Current SQL statement for this session:
INSERT /*+ APPEND */ INTO "EDW_STAGE"."Y_OBJ_RISK_SLAVE"("SEQ_NO","RISK_NO") SELECT C0,C1 FROM :Q1390402000
Sorry for the danish words, but I hope you can use the ORA errors, and that you can give me a hand here and tell me what the problem is.
The problems started with a disk break down a days ago.
The system setup is:
OS: W2K
Ora: 9.2.0.6.0
The database is a part of a datawarehouse solution.
Regards,
MikkelHi,
as i tried to understand your errors.i only came to know that the device on which the file is riside is probebley offline,or if this is your temporary file then it might be the case that your device has run out of space.or disk space for your temporary file is not necessarily allocated at the file creation.
remedy :- you can remove unnecessary space from the disk by cleaning unnecessary files.
thanks. -
PL/SQL report errors: ORA-01422
Hi all,
(before i you read i would like to say i have searched the net for this error code but nothing shows up like this problem..)
I am getting an error problem when i select certain Schemas from a list on an apex app. page, it only works for some schemas not all..
When i select one schema, it is supposed to display one row.. when i select [ALL] it is supposed to show them all.
It does work if i select '[ALL]' from the select list (p3_schema_name), just not for every single individual one.
the error code:
ORA-01422: exact fetch returns more than requested number of rows
declare
vSchema varchar2(20);
vStmt varchar2(1000);
vVersion number(5);
vDBName varchar2(20);
vHostName varchar2(80);
vStmt2 varchar2(1000);
vVersion2 number(5);
vDBName2 varchar2(20);
vServer2 varchar2(80);
vSchema2 varchar2(80);
CURSOR c_schemas IS
select owner from dba_tables@P3_DB_NAME.db_link where table_name = 'DDL_LOG' and num_rows > 0 order by owner;
begin
IF :P3_SCHEMA_NAME != '[ALL]' AND :P3_DB_NAME IS NOT NULL AND :P3_SERVER_NAME IS NOT NULL THEN
vServer2 := :P3_SERVER_NAME;
vSchema2 := :P3_SCHEMA_NAME;
vStmt2 := 'select distinct DDH_DB_NM, max(DDH_SCHEMA_NR)keep(dense_rank last order by ddh_runstart_td) AS "PATCH" from &P3_SCHEMA_NAME..ddl_log@&P3_DB_NAME.db_link GROUP BY DDH_DB_NM';
Execute Immediate vStmt2 into vDBName2, vVersion2;
htp.p('<br>');
htp.p('<table border="1">');
htp.p('<tr>');
htp.p('<th bgcolor="#FFCC99">SERVER NAME</th>');
htp.p('<th bgcolor="#FFCC99">DB NAME</th>');
htp.p('<th bgcolor="#FFCC99">SCHEMA NAME</th>');
htp.p('<th bgcolor="#FFCC99">PATCH</th>');
htp.p('</tr>');
htp.p('<tr>');
htp.p('<td>');
htp.p(vServer2);
htp.p('</td>');
htp.p('<td>');
htp.p(vDBName2);
htp.p('</td>');
htp.p('<td>');
htp.p(vSchema2);
htp.p('</td>');
htp.p('<td>');
htp.p(vVersion2);
htp.p('</td>');
htp.p('<td>');
htp.p('<BR>');
htp.p('</td>');
htp.p('</tr>');
htp.p('</tr>');
htp.p('</table>');
ELSE IF :P3_SCHEMA_NAME = '[ALL]' AND :P3_DB_NAME IS NOT NULL AND :P3_SERVER_NAME IS NOT NULL THEN
vHostName := :P3_SERVER_NAME;
vDBName := :P3_DB_NAME;
open c_schemas;
htp.p('<br>');
htp.p('<table border="1">');
htp.p('<tr>');
htp.p('<th bgcolor="#FFCC99">SERVER NAME</th>');
htp.p('<th bgcolor="#FFCC99">DB NAME</th>');
htp.p('<th bgcolor="#FFCC99">SCHEMA NAME</th>');
htp.p('<th bgcolor="#FFCC99">PATCH</th>');
htp.p('</tr>');
LOOP
FETCH c_schemas INTO vSchema;
EXIT WHEN c_schemas%NOTFOUND;
vStmt := 'select max(DDH_SCHEMA_NR)keep(dense_rank last order by ddh_runstart_td) AS "PATCH" from '||vSchema||'.ddl_log@&P3_DB_NAME.db_link where DDH_SCHEMA_NR = (select max(DDH_SCHEMA_NR) from '||vSchema||'.ddl_log@&P3_DB_NAME.db_link) and rownum < 2' ;
Execute Immediate vStmt into vVersion ;
htp.p('<tr>');
htp.p('<td>');
htp.p(vHostName);
htp.p('</td>');
htp.p('<td>');
htp.p(vDBName);
htp.p('</td>');
htp.p('<td>');
htp.p(vSchema);
htp.p('</td>');
htp.p('<td>');
htp.p(vVersion);
htp.p('</td>');
htp.p('<td>');
htp.p('<BR>');
htp.p('</td>');
htp.p('</tr>');
END LOOP;
htp.p('</tr>');
htp.p('</table>');
CLOSE c_schemas;
END IF;
END IF;
END;I have checked the DDH_SCHEMA_NR for repeating entries of the highest number.. some of the ones that dont work do have repeating entries some don't.
Sorry if this is confusing, i have tried to explain it as best as i can.
Thanks in advance for any help.
AshleighHello Ashleigh,
Based on your code, I'd start by running this piece of SQL via command-line (thru SQL Workshop, SQL*Plus, Toad, etc.), replacing &P3_SCHEMA_NAME. and &P3_DB_NAME. with values that are currently causing the routine to fail and see if it returns more than one row. I don't know your data, but DISTINCT and GROUP BY are typically used to return multiple (though grouped/summarized) rows. It appears to be the only statement that would cause the error your seeing (more than one row being returned into single variables).
select distinct DDH_DB_NM, max(DDH_SCHEMA_NR)keep(dense_rank last order by ddh_runstart_td) AS "PATCH" from &P3_SCHEMA_NAME..ddl_log@&P3_DB_NAME.db_link GROUP BY DDH_DB_NM;I'm actually surprised that the code runs at all. I didn't think 'execute immediate' would know what to do with substitutions indicated as "&something." (I've typically seen that when substituting in dynamic HTML/Javascript code but maybe I'm learning something new). But since you already have vServer2 and vSchema2, I'd be more apt to code it as:
vStmt2 := 'select distinct DDH_DB_NM, max(DDH_SCHEMA_NR)keep(dense_rank last order by ddh_runstart_td) AS "PATCH" from ' ||
vSchema2 || '.ddl_log@' || vServer2 || '.db_link GROUP BY DDH_DB_NM';Hope this helps,
John -
Ora-00604 error and ora 01000 error while report generation.
hi all,
I am trying to generate the multiple reports of same template through a program.
While this job is running, i get the following error at the BIP console and the reports don't get generated.
[101711_044115578][][EXCEPTION] java.sql.SQLException: ORA-00604: error occurred
at recursive SQL level 1
ORA-01000: maximum open cursors exceeded
ORA-00604: error occurred at recursive SQL level 1
ORA-01000: maximum open cursors exceeded
ORA-01000: maximum open cursors exceeded
Kindly help.
Thanks.Lots of resources with a simple search to see what this is about, for example:
http://www.orafaq.com/wiki/ORA-01000
ORA-01000: maximum open cursors exceeded
Cause: A host language program attempted to open too many cursors. The initialization parameter OPEN_CURSORS determines the maximum number of cursors per user.
Action: Modify the program to use fewer cursors. If this error occurs often, shut down Oracle, increase the value of OPEN_CURSORS, and then restart Oracle.
open_cursors parameter
http://download.oracle.com/docs/cd/E11882_01/server.112/e25513/initparams160.htm#REFRN10137
Oracle support note:
OERR: ORA-1000 maximum open cursors exceeded (Doc ID 18591.1) -
EA2: ORA-01427 clicking on a view in the navigator
SQLDev: 1.5.0.52.03
Java: 1.6.0_04
Oracle: 9.2.0.7.0
I'm getting the following error when I click on a view in the navigator pane:
An error was encountered performing the requested operation:
ORA-01427: single-row subquery returns more than one row 01427. 00000 - "single-row subquery returns more than one row"I'm not seeing any errors in the shell window.
After clicking on <OK> in the error dialog, the normal tabs (Columns, Data, Grants, Dependencies, Details, SQL) are displayed, but there is no content in the Columns tab.
All the other tabs seem to function normally.
Here is the DDL from the SQL tab
CREATE OR REPLACE VIEW "SUBSCRIPTIONS"
"ORDER_ID", "SUNBURST_ORDER_ID", "SIEBEL_ORDER_ID", "ACCOUNT_ID",
"COMP_ID", "SUBACCOUNT_ID", "START_DATE", "END_DATE", "PULL_DATE",
"SUBSCRIPTION_TYPE", "PRICE_CLASS", "DESCRIPTION", "SEAT_COUNT",
"ORDER_DURATION", "CALLBACK_INTERVAL", "UPDATE_DATE", "UPDATE_USERNAME",
"AFFILIATE"
AS
SELECT order_id,
sunburst_order_id,
siebel_order_id,
account_id,
comp_id,
subaccount_id,
start_date,
end_date,
pull_date,
product_id,
price_class,
product_name,
add_users,
order_duration,
callback_interval,
last_mdfy_date,
last_mdfy_emp,
affiliate
FROM csbcrossworlds.subscriptions;We have 15 views in this schema, 3 of them fail this way but the other 12 display the columns just fine. So far I am unable to detect any commonality.
Any ideas?Ok, I think I found the problem. The view in question (SUBSCRIPTIONS) is owned by 'PHILC' and it references a table named 'SUBSCRIPTIONS' owned by 'CSBCROSSWORLDS'. There are two other development schemas that also own tables named 'SUBSCRIPTIONS'.
I believe the 'Columns' tab is executing the query below. The subquery in this SQL tries to identify the primary key columns for the 'SUBSCRIPTIONS' view in my schema (PHILC):
SELECT
c.column_name,
DECODE(
data_type,
'CHAR', data_type||'('||c.data_length||')',
'VARCHAR', data_type||'('||c.data_length||')',
'VARCHAR2', data_type||'('||c.data_length||')',
'NCHAR' , data_type||'('||c.data_length||')',
'NUMBER' , DECODE(c.data_precision,null,'NUMBER', data_type||'('||c.data_precision||','||c.data_SCALE||')'),
'NVARCHAR', data_type||'('||c.data_length||')',
'NVARCHAR2', data_type||'('||c.data_length||')',
data_type) data_type,
DECODE(nullable, 'Y', 'Yes', 'No') nullable,
c.DATA_DEFAULT,
column_id,
com.comments,
(SELECT 1 FROM all_constraints, all_cons_columns
WHERE all_constraints.constraint_type = 'P' AND
all_constraints.constraint_name = all_cons_columns.constraint_name AND
all_constraints.owner = all_cons_columns.owner AND
all_cons_columns.table_name = c.table_name AND
c.column_name = all_cons_columns.column_name) Primary_Key,
c_update.insertable,
c_update.updatable,
c_update.deletable
FROM
sys.all_tab_Columns c, sys.all_col_comments com, sys.user_updatable_columns c_update
WHERE
c.owner = :OBJECT_OWNER AND
c.table_name = :OBJECT_NAME AND
c.table_name = com.table_name AND
c.owner = com.owner AND
c.column_name = com.column_name AND
c_update.column_name = com.column_name AND
c_update.table_name = com.table_name
;Extracting the subquery into this:
SELECT
all_constraints.owner,
all_constraints.table_name,
all_constraints.constraint_name
FROM all_constraints, all_cons_columns
WHERE
all_constraints.constraint_type = 'P' AND
all_constraints.constraint_name = all_cons_columns.constraint_name AND
all_constraints.owner = all_cons_columns.owner and
all_cons_columns.table_name = 'SUBSCRIPTIONS' and
'ORDER_ID' = all_cons_columns.column_name;I got this output:
owner table_name constraint_name
CUTOVER SUBSCRIPTIONS SUBSCRIPTIONS_PK
CROSSWORLDS SUBSCRIPTIONS SUBSCRIPTIONS_PK
CSBCROSSWORLDS SUBSCRIPTIONS SUBSCRIPTIONS_PKLooking at the DDL for the view, the row we really want is for owner 'CSBCROSSWORLDS'. Unfortunately, that means having to somehow parse the SQL text to extract the owner name...
Phil -
Using database-link in view to get around ORA-01031 error
I have been granted select rights on a users table. I am therefore able to select from his table. If however I try create a view against his table I run into the ORA-01031 problem. I have worked around this problem by creating a database-link to myself and then adding that to the view creation and it works. What are the downsides of using the database-link in this way?
The only down side I have been able to identify is that a extra session is created and that the CPU has a little extra work due to the LOOP BACK that takes place. I need to ensure the network is not unnessesarly used and therefore will need to ensure that 127.0.0.1 (local host) is used in the database connection discription. e.g.
create database link my_db_link connect to scott identified by tiger using '(description=(address=(protocol=tcp)(host=127.0.0.1) (Port = 1521) ) (connect_data= (sid=ora10g)))'; -
Getting ora:00904 invalid indentifier error while running i query
Hi,
I have a remote database and local database both are oracle 10gR2.Now i have written the below mentioned query in my local database and is working fine,but in case remote database it is throughing error ora:00904 invalid indentifier.
I had export the dump from remote db and import it on my local db and i tried the same and it is working fine on local after that also.
As i believe that this error usually come for column name not exist or column name or it's length or for any special character in column name of the table.But as i said it is working fine on local db but not in remote db though i am using the same dump for local and remote.
Though when i am querying the table i can able to fetch data for the any record but when i am using the below mentioned query for the same i am getting the error.As i am doing this to fecth the data for child parent related relationship.
Can any one suggest is there anything related to configaration or something else.
Please do let me know if you do want some more information on the query what i am doing inside of it.
Rgds,
Anit
Edited by: Anit A. on Sep 1, 2008 2:32 AM
Edited by: Anit A. on Sep 1, 2008 2:33 AMWITH t
AS
SELECT decode(t.spnlevel
,3,t.u_quotesdtlid
,2,decode((select count(*)
from u_quotesdtl t2
where t2.u_quotesdtlid = t.u_quotesdtlid
and t2.parentspn = (t2.jobgroupid||':'||t2.jobtype)
),0,(select t1.u_quotesdtlid
from u_quotesdtl t1
where t1.spnitemcode = t.parentspn
and t1.spnlevel = '3'
and t1.jobtype = t.jobtype
and t1.jobgroupid = t.jobgroupid
and t1.QUOTEID = t.QUOTEID
),t.u_quotesdtlid
,1,decode((select count(*)
from u_quotesdtl t2
where t2.QUOTEID = t.QUOTEID
and t2.parentspn = (t2.jobgroupid||':'||t2.jobtype)
),0,t.u_quotesdtlid,decode((select count(*)
from u_quotesdtl t3
where t3.QUOTEID = t.QUOTEID
and t3.parentspn = (t3.jobgroupid||':'||t3.jobtype)
and t3.u_quotesdtlid in (select t1.u_quotesdtlid
from u_quotesdtl t1
where t1.spnitemcode = t.parentspn
and t1.spnlevel = '2'
and t1.jobtype = t.jobtype
and t1.jobgroupid = t.jobgroupid
and t1.QUOTEID = t.QUOTEID
),0,(select t4.u_quotesdtlid
from u_quotesdtl t4
,(select t1.parentspn
,t1.jobtype
,t1.jobgroupid
from u_quotesdtl t1
where t1.spnitemcode = t.parentspn
and t1.spnlevel = '2'
and t1.jobtype = t.jobtype
and t1.jobgroupid = t.jobgroupid
and t1.QUOTEID = t.QUOTEID
) t5
where t4.spnitemcode = t5.parentspn
and t4.spnlevel = '3'
and t4.jobtype = t5.jobtype
and t4.jobgroupid = t5.jobgroupid
and t4.QUOTEID = t.QUOTEID
(select t1.u_quotesdtlid
from u_quotesdtl t1
where t1.spnitemcode = t.parentspn
and t1.spnlevel = '2'
and t1.jobtype = t.jobtype
and t1.jobgroupid = t.jobgroupid
and t1.QUOTEID = t.QUOTEID
,null,t.u_quotesdtlid) as parentquoteid
,t.u_quotesdtlid as quotesdtlid
,t.spnlevel as spnlevel
FROM u_quotesdtl t
WHERE t.QUOTEID ='som key id'
ORDER BY parentquoteid,t.spnlevel desc
select * from t;
Maybe you are looking for
-
1.4.2 JRE auto-download signature problem
Hi, When I try to use the 1.4.2 cab file for auto-download, I find that there is a certificate signature problem when it installs. It comes up with a message: "Warning: The authenticity of this content cannot be verified, therefore it cannot be trust
-
Cannot Run aperture 2.1.4 with Yosemite
Unfortunately after updating to Yosemite found that Aperture 2.1.4 that was running OK with Maverick is now an unsupported Software. How can Apple do this? The installation process was not quick so I think that the developers should have a bit of the
-
I'm using logic with little knowledge of the program. I have 1 audio track with samples, then i needed more audio tracks for more samples and vocals, however it seems that every individual audio track plays all the other audio tracks thru it at the s
-
New Thread() throws NullPointerException, what happens inside ?
In a multi threaded program, the following line causes a NullPointerException: Thread tt = new Thread(); Only one thread at a time accesses this line. I use 'inner classes', inheritance and many threads. Is there a subtle side effect that causes the
-
Sysprep problems with Default User profile
I've read the previous posts in this forum about using Sysprep with Windows XP SP3 and I have followed the instructions in MS Article 959753. I applied my customizations to the local Administrator account and included UpdateServerProfileDirectory=1 i