SQL runs fine on DB11.2.0.1.0 but fails on DB9.2.0.8.0 with errors.
The below SQL runs fine on DB11.2.0.1.0 but fails on DB9.2.0.8.0 with error:
WITH users_with_dba_privs AS
ERROR at line 1:
ORA-00604: error occurred at recursive SQL level 1
ORA-00904: "from$_subquery$_005"."PARENT": invalid identifier
SQL
WITH users_with_dba_privs AS
(select distinct child user_name
from (select null parent, 'DBA' child from dual
union all
select granted_role parent, grantee child
from dba_role_privs)
where child in (select username from dba_users)
start with parent is null connect by parent = prior child )
select 'select_any_table',
substr(SYS_CONNECT_BY_PATH(c, '->'),3,512) path, c
from (select null p, name c
from system_privilege_map
where name = 'SELECT ANY TABLE'
union all
select -- users/roles and roles granted
granted_role p,
grantee c
from dba_role_privs
where granted_role != 'DBA'
union all
select -- users/roles with select any table
privilege p, grantee c
from dba_sys_privs
where privilege = 'SELECT ANY TABLE')
where (c = 'PUBLIC' OR c in (select username from dba_users))
AND c NOT IN('MDSYS','DMSYS','CTXSYS','WMSYS','ORDSYS','OLAPSYS','DBSNMP')
and c NOT IN (select user_name from users_with_dba_privs)
start with p is null connect by p = prior c
union all
select 'select_privilege',
substr(SYS_CONNECT_BY_PATH(c, '->'),3,512) path, c
from (select null p, view_name c
from dba_views
where view_name like 'DBA_%'
union all
select -- users/roles and roles granted
granted_role p,
grantee c
from dba_role_privs
where granted_role != 'DBA'
union all
select -- users/roles with select on DBA views
table_name p, grantee c
from dba_tab_privs
where privilege = 'SELECT'
and table_name like 'DBA_%')
where (c = 'PUBLIC' OR c in (select username from dba_users))
AND c NOT IN('MDSYS','DMSYS','CTXSYS','WMSYS','ORDSYS','OLAPSYS','DBSNMP')
and c NOT IN (select user_name from users_with_dba_privs)
start with p is null connect by p = prior c
Thanks in advance.
~Hozy
hoek,
Why do you think this WITH clause is special?
I've taken the liberty of formatting the code, and can't see what's wrong. (Maybe I'm just too tired)
I believe 9i did have subquery factoring.
with users_with_dba_privs
as ( select distinct child user_name
from ( select null parent, 'DBA' child from dual
union all
select granted_role parent, grantee child
from dba_role_privs)
where child in ( select username from dba_users)
start with parent is null
connect by parent = prior child)
select 'select_any_table', substr(sys_connect_by_path(c, '->'), 3, 512) path, c
from (select null p, name c
from system_privilege_map
where name = 'SELECT ANY TABLE'
union all
select -- users/roles and roles granted
granted_role p, grantee c
from dba_role_privs
where granted_role != 'DBA'
union all
select -- users/roles with select any table
privilege p, grantee c
from dba_sys_privs
where privilege = 'SELECT ANY TABLE')
where (c = 'PUBLIC'
or c in ( select username from dba_users))
and c not in
('MDSYS'
,'DMSYS'
,'CTXSYS'
,'WMSYS'
,'ORDSYS'
,'OLAPSYS'
,'DBSNMP')
and c not in ( select user_name from users_with_dba_privs)
start with p is null
connect by p = prior c
union all
select 'select_privilege', substr(sys_connect_by_path(c, '->'), 3, 512) path, c
from (select null p, view_name c
from dba_views
where view_name like 'DBA_%'
union all
select -- users/roles and roles granted
granted_role p, grantee c
from dba_role_privs
where granted_role != 'DBA'
union all
select -- users/roles with select on DBA views
table_name p, grantee c
from dba_tab_privs
where privilege = 'SELECT'
and table_name like 'DBA_%')
where (c = 'PUBLIC'
or c in ( select username from dba_users))
and c not in
('MDSYS'
,'DMSYS'
,'CTXSYS'
,'WMSYS'
,'ORDSYS'
,'OLAPSYS'
,'DBSNMP')
and c not in ( select user_name from users_with_dba_privs)
start with p is null
connect by p = prior cRegards
Peter
Similar Messages
-
I have a php module which runs fine in Firefox and all other browsers but not Safari. It always run twice - I see a small ? in upper right corner which is causing it to run twice but NO idea why? I read it MAY have something to do with am image it cannot load but I see them all loaded. Help - thank you
Could you share a link to the page?
Seeing it in context and in our browsers is much easier to debug.
If not, make sure to run the validator here The W3C Markup Validation Service and clear out any problems. HTML errors, especially structural ones, will cause all kinds of display problems in various browsers/versions/platforms. -
YouTube will not work on safari for me on the ipad. Is there anyway to fix this? I can go anywhere else on the internet fine and it works on google chrome, but on safari it shows a blank screen with the bar on top after it loads, if it's even loading at all.
I do not know if it's relevant or not, but I got a message on my ipad while on safari saying that my iPhone has a virus. I looked it up and it seems it might have just been an ad from the website I was on, but it happened around the same time YouTube stopped working.You will find that using the YouTube app will provide a better viewing experience for YouTube videos.
-
PowerShell runs on Windows 8.1 PS v4.0, but fails on 2008R2 PS v2.0
I developed a PS script to run on my server to discover if certain files exist*. I developed the code on Win 8.1 64-bit which has PS version 4.0 installed. It works perfectly. I copied the files to my Win 2008R2 SP1 64-bit server with PS version 2.0 (script
is called from a .bat file which just loads the script and allows it run).
Both computers use Comcast as the ISP, but are in different locations. The code fails on the server with an Invalid HELO name from the mail server coming from the very last line of code below. This mail server does require SMTP_AUTH, but as noted above it
works just fine from the Win 8 machine.
I believe the code is all PS v2.0, but could be wrong about that.
*I replaced the lookup logic for testing so my configuration is irrelevant (code shown just gets today's date instead of looking up specific data).
Any suggestions for a fix?
$todaysDate = (Get-Date -UFormat "%m-%d-%Y")
#irrelevant code removed/modified
$content = $todaysDate
$emailFrom = "[email protected]"
$emailTo = "[email protected], [email protected]"
$subject = "Batch Files for " + $todaysDate
$body = "Found the following Batch files dated: " + $todaysDate + "`n" + $content
$smtpServer = "smtp.mydomain.com"
$mypass = "password"
# use a SecureString for $mypass which you can save to disk via Export-Clixml or ConvertFrom-SecureString
$SMTPMessage = New-Object System.Net.Mail.MailMessage($EmailFrom,$EmailTo,$Subject,$Body)
$SMTPClient = New-Object Net.Mail.SmtpClient($SmtpServer, 587)
$SMTPClient.EnableSsl = $false
$SMTPClient.Credentials = New-Object System.Net.NetworkCredential($emailFrom, $mypass)
$SMTPClient.Send($SMTPMessage)
The failure error msg (line 22 is the last line of code with lookup logic in place):
C:\rmwin\BATCHES>REM marks comments
C:\rmwin\BATCHES>REM NO ECHO
C:\rmwin\BATCHES>cd c:\rmwin\BATCHES\
C:\rmwin\BATCHES>PowerShell.exe -NoProfile -ExecutionPolicy Bypass -Command "& '
C:\rmwin\BATCHES\BatchesSent.ps1'"
Exception calling "Send" with "1" argument(s): "Mailbox unavailable. The server
response was: Access denied - Invalid HELO name (See RFC2821 4.1.1.1)"
At C:\rmwin\BATCHES\BatchesSent.ps1:22 char:17
+ $SMTPClient.Send <<<< ($SMTPMessage)
+ CategoryInfo
: NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : DotNetMethodExceptionYou are authenticating:
$SMTPClient = New-Object
Net.Mail.SmtpClient($SmtpServer,
587)
$SMTPClient.EnableSsl = $false
$SMTPClient.Credentials =
New-Object
System.Net.NetworkCredential($emailFrom,$mypass)
$SMTPClient.Send($SMTPMessage)
I suspect you have other issues.
¯\_(ツ)_/¯ -
SSIS custom execute sql task : Failed with error
I am developing a custom SSIS task for running sql task. But it fails with error - I'm trying to set the resultsetbinding to be used by next task in workflow.
Error: 0xC0014054 at CustomSSISTask: Failed to lock variable "User::id" for read access with error 0xC0010001 "The variable cannot be found. This occurs when an attempt is made to retrieve a variable from the Variables collection on a container
during execution of the package, and the variable is not there. The variable name may have changed or the variable is not being created.".
Error: 0xC002F210 at CustomSSISTask, Execute SQL Task: Executing the query "SELECT id FROM sysobjects WHERE name = 'sysrowsets..." failed with the following error: "Failed to lock variable "User::id" for read access with error 0xC0010001
"The variable cannot be found. This occurs when an attempt is made to retrieve a variable from the Variables collection on a container during execution of the package, and the variable is not there. The variable name may have changed or the variable is
not being created.".
". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly.
Warning: 0x80019002 at CustomSSISTask: SSIS Warning Code DTS_W_MAXIMUMERRORCOUNTREACHED. The Execution method succeeded, but the number of errors raised (3) reached the maximum allowed (1); resulting in failure. This occurs when the number of errors reaches
the number specified in MaximumErrorCount. Change the MaximumErrorCount or fix the errors.
Task failed: CustomSSISTask
Here is the code sample I'm trying ,
public override DTSExecResult Execute(Connections connections, VariableDispenser variableDispenser,
IDTSComponentEvents componentEvents, IDTSLogging log, object transaction)
MessageBox.Show("testing:");
try
// Add the SQL Task
Package package = new Package();
package.Executables.Add("STOCK:SQLTask");
Microsoft.SqlServer.Dts.Runtime.Variable variable = package.Variables.Add("id", false, "User", 0);
// Get the task host wrapper
TaskHost taskHost = package.Executables[0] as TaskHost;
// Get the task object
ExecuteSQLTask task = taskHost.InnerObject as ExecuteSQLTask;
// Set core properties
task.Connection = connections[0].Name;
task.SqlStatementSource = "SELECT id FROM sysobjects WHERE name = 'sysrowsets'";
//task.SqlStatementSource =
// "SELECT PersonID from [AmalgaSpeedTableData].[SpeedTable].[DimPerson] where PersonIntID = '1'";
task.SqlStatementSourceType = SqlStatementSourceType.DirectInput;
// Add result set binding, map the id column to variable
IDTSResultBinding resultBinding = task.ResultSetBindings.Add();
//IDTSResultBinding resultBinding = task.ResultSetBindings.GetBinding(0);
resultBinding.ResultName = "variable";
resultBinding.DtsVariableName = variable.QualifiedName; //"User::id";
task.Execute(connections, variableDispenser, componentEvents, log, transaction);
catch (Exception ex)
throw new ArgumentException(ex.Message);
return DTSExecResult.Success;
It doesnt throw any exception but custom task fails.
Later I will be also using parametersetbindings to pass some input parameters to this task , since I'm stuck for out param - blocked moving ahead.
Any help would be greatly appreciated.
Thanks
SangHi, could you check whether the following threads help:
http://stackoverflow.com/questions/5787621/ssis-package-failed-to-locak-variable-for-read-access-with-error-0xc0010001
http://social.msdn.microsoft.com/Forums/sqlserver/en-US/40ee7eff-5ec1-426f-a1a8-ab85b40b51aa/error-variable-can-not-be-found-while-executing-package-from-the-net-code?forum=sqlintegrationservices
Regards, Leo -
In my Process Flow I have a SQL Plus activity that calls a custom DML Express program. How would I trigger the End with Errors activity if my custom DML program errrors out? Currently my SQL Plus activity is as follows:
--SET SERVEROUTPUT ON
-- PL/SQL
DECLARE
v_cmd VARCHAR2(500);
BEGIN
DBMS_AW.AW_ATTACH('AW', true);
DBMS_AW.EXECUTE('cda logfiles_dir');
v_cmd := 'Call CUSTOM_DML_PROG';
DBMS_AW.EXECUTE(v_cmd);
DBMS_AW.AW_DETACH('AW');
end;
quit
Is there a way to pass a parameter from my DML Express program to the SQL Plus activity that could somehow trigger End with Errors?
KristineHi David,
I have been able to run this process flow that calls my DML program several times however, I am now receiving the following errors:
RPE-01003: An infrastructure condition prevented the request from completing.
RPE-01038: Failed to evaluate expression declare "$LOOP_DETECT$" NUMBER := 0;function...
My function returns a Number and my transformation in the process flow has been defined as having Integer as the Data Type and by default the Literal value is True.
The complex condition has been defined as the following:
"CALL_GS_MTH_END_GL_ACT1"."CALL_GS_MTH_END_GL_ACT1" =0
Any ideas as to why all of a sudden I receive this error? I have been able to workaround this issue by deleting the transformation from the process flow, adding it back and re-deploying the process flow however this is not ideal.
Kristine -
I had successfully installed sql server 2008 Developer edition on a win7 pro workstation about a year ago. I has been running fine for the last year (locally and running .Net 4.5 framework). All services (RS, Analysis) running fine.
Then today someone decided to enable tcpIP and went to services to restart the server on my workstation but it would not restart. I ran repair from the sql server installation center x64 - still nothing - the server wont restart. But Analysis server and Reporting
services work fine -- these services can restart fine ... Just not the main server. I'm also running Sql Server express. that runs OK too. But I need my sql server 2008 Developer to run. I looked at the system event viewer -- it said this:
The SQL Server (SQLDEVELOPER) service terminated with service-specific error The specified module could not be found..
I went to Control panel ... services and looked at the properties for Sql Server Developer -- the path was listed as:
C:\Program Files\Microsoft SQL Server\MSSQL10_50.SQLDEVELOPER\MSSQL\Binn\sqlservr.exe" -sSQLDEVELOPER
Everything in windows explorer appears to be in order. How can I restart the server? Do I need to uninstall it and then reinstall it? Any suggestions appreciated.
I rebooted the entire workstation a few times already also, but still server won't restart. What to do?
Rich PThere were several Error Logs (for today) since I tried restart several times. They appear to say the same thing:
2014-07-14 12:57:31.27 Server Microsoft SQL Server 2008 R2 (RTM) - 10.50.1600.1 (X64)
Apr 2 2010 15:48:46
Copyright (c) Microsoft Corporation
Developer Edition (64-bit) on Windows NT 6.1 <X64> (Build 7601: Service Pack 1)
2014-07-14 12:57:31.27 Server (c) Microsoft Corporation.
2014-07-14 12:57:31.27 Server All rights reserved.
2014-07-14 12:57:31.27 Server Server process ID is 4452.
2014-07-14 12:57:31.27 Server System Manufacturer: 'Dell Inc.', System Model: 'OptiPlex 9010'.
2014-07-14 12:57:31.28 Server Authentication mode is WINDOWS-ONLY.
2014-07-14 12:57:31.28 Server Logging SQL Server messages in file 'C:\Program Files\Microsoft SQL Server\MSSQL10_50.SQLDEVELOPER\MSSQL\Log\ERRORLOG'.
2014-07-14 12:57:31.28 Server This instance of SQL Server last reported using a process ID of 2640 at 7/14/2014 12:55:59 PM (local) 7/14/2014 7:55:59 PM (UTC). This is an informational message only; no user action is required.
2014-07-14 12:57:31.28 Server Registry startup parameters:
-d C:\Program Files\Microsoft SQL Server\MSSQL10_50.SQLDEVELOPER\MSSQL\DATA\master.mdf
-e C:\Program Files\Microsoft SQL Server\MSSQL10_50.SQLDEVELOPER\MSSQL\Log\ERRORLOG
-l C:\Program Files\Microsoft SQL Server\MSSQL10_50.SQLDEVELOPER\MSSQL\DATA\mastlog.ldf
2014-07-14 12:57:31.29 Server SQL Server is starting at normal priority base (=7). This is an informational message only. No user action is required.
2014-07-14 12:57:31.29 Server Detected 4 CPUs. This is an informational message; no user action is required.
2014-07-14 12:57:31.38 Server Using dynamic lock allocation. Initial allocation of 2500 Lock blocks and 5000 Lock Owner blocks per node. This is an informational message only. No user action is required.
2014-07-14 12:57:31.40 Server Node configuration: node 0: CPU mask: 0x000000000000000f:0 Active CPU mask: 0x000000000000000f:0. This message provides a description of the NUMA configuration for this computer. This is an informational message only. No user action is required.
2014-07-14 12:57:31.41 spid7s Starting up database 'master'.
2014-07-14 12:57:31.46 spid7s 1 transactions rolled forward in database 'master' (1). This is an informational message only. No user action is required.
2014-07-14 12:57:31.46 spid7s 0 transactions rolled back in database 'master' (1). This is an informational message only. No user action is required.
2014-07-14 12:57:31.46 spid7s Recovery is writing a checkpoint in database 'master' (1). This is an informational message only. No user action is required.
2014-07-14 12:57:31.51 spid7s Resource governor reconfiguration succeeded.
2014-07-14 12:57:31.51 spid7s SQL Server Audit is starting the audits. This is an informational message. No user action is required.
2014-07-14 12:57:31.51 spid7s SQL Server Audit has started the audits. This is an informational message. No user action is required.
2014-07-14 12:57:31.52 spid7s FILESTREAM: effective level = 0, configured level = 0, file system access share name = 'SQLDEVELOPER'.
2014-07-14 12:57:31.54 spid7s SQL Trace ID 1 was started by login "sa".
2014-07-14 12:57:31.55 spid7s Starting up database 'mssqlsystemresource'.
2014-07-14 12:57:31.58 spid7s The resource database build version is 10.50.1600. This is an informational message only. No user action is required.
2014-07-14 12:57:31.78 spid10s Starting up database 'model'.
2014-07-14 12:57:31.78 Server Warning: Support for the VIA protocol is deprecated and will be removed in a future version of Microsoft SQL Server. If possible, use a different network protocol and disable VIA.
2014-07-14 12:57:31.78 spid7s Server name is 'WKS308\SQLDEVELOPER'. This is an informational message only. No user action is required.
2014-07-14 12:57:31.82 spid10s Clearing tempdb database.
2014-07-14 12:57:31.89 Server A self-generated certificate was successfully loaded for encryption.
2014-07-14 12:57:31.89 Server Error: 26055, Severity: 16, State: 1.
2014-07-14 12:57:31.89 Server The SQL Server failed to initialize VIA support library [QLVipl.dll]. This normally indicates the VIA support library does not exist or is corrupted. Please repair or disable the VIA network protocol. Error: 0x7e.
2014-07-14 12:57:31.89 Server Error: 17182, Severity: 16, State: 1.
2014-07-14 12:57:31.89 Server TDSSNIClient initialization failed with error 0x7e, status code 0x60. Reason: Unable to initialize the VIA listener. The specified module could not be found.
2014-07-14 12:57:31.89 Server Error: 17182, Severity: 16, State: 1.
2014-07-14 12:57:31.89 Server TDSSNIClient initialization failed with error 0x7e, status code 0x1. Reason: Initialization failed with an infrastructure error. Check for previous errors. The specified module could not be found.
2014-07-14 12:57:31.89 Server Error: 17826, Severity: 18, State: 3.
2014-07-14 12:57:31.89 Server Could not start the network library because of an internal error in the network library. To determine the cause, review the errors immediately preceding this one in the error log.
2014-07-14 12:57:31.89 Server Error: 17120, Severity: 16, State: 1.
2014-07-14 12:57:31.89 Server SQL Server could not spawn FRunCM thread. Check the SQL Server error log and the Windows event logs for information about possible related problems.
2014-07-14 12:57:31.97 spid10s Starting up database 'tempdb'.
2014-07-14 12:57:32.19 spid14s A new instance of the full-text filter daemon host process has been successfully started.
2014-07-14 12:57:32.22 spid13s Starting up database 'ReportServer$SQLDEVELOPER'.
2014-07-14 12:57:32.22 spid10s Starting up database 'msdb'.
2014-07-14 12:57:32.22 spid17s Starting up database 'Sales_DW'.
2014-07-14 12:57:32.22 spid15s Starting up database 'DB1dev'.
2014-07-14 12:57:32.22 spid18s Starting up database 'ConferenceData'.
2014-07-14 12:57:32.22 spid14s Starting up database 'ReportServer$SQLDEVELOPERTempDB'.
2014-07-14 12:57:32.22 spid19s Starting up database 'SubsDBstuff'.
Cannot close event log because there are still event handle users active.
Rich P -
Enterprise manager configuration failed but i*SQL Plus runs fine
While Installing Oracle database 10g rel 2 on windows XP professional Service Pack 2 The Enterprise manager configuration failed.
However I*SQL plus and
Datbase configuration assistant and other tools run fine.
I got the following error message
Error instantiating em configuration files.
Refer log E:\oracle\product\10.2.0\db_1\cfgtoollogs\dbca\orcl\emConfig.log for more details.
On checking the contents of the log file I saw the following enteries
Creating directories...
Apr 14, 2007 2:24:45 PM oracle.sysman.emcp.util.PlatformInterface executeCommand
CONFIG: Unable to copy E:\oracle\product\10.2.0\db_1/sysman/config/emomsintg.xml to E:\oracle\product\10.2.0\db_1\localhost_orcl/sysman/config/emomsintg.xml: No such file or directory at bin/EMDeploy.pm line 261.
Apr 14, 2007 2:24:45 PM oracle.sysman.emcp.util.PlatformInterface executeCommand
WARNING: Error executing CMD /C E:\oracle\product\10.2.0\db_1\bin\emctl.bat deploy dbconsole E:\oracle\product\10.2.0\db_1\localhost_orcl localhost:3938 localhost orcl
Apr 14, 2007 2:24:45 PM oracle.sysman.emcp.EMAgentConfig instantiateEMConfigFiles
CONFIG: Failed to deploy state dirs
Apr 14, 2007 2:24:45 PM oracle.sysman.emcp.EMConfig perform
SEVERE: Error instantiating EM configuration files
Refer to the log file at E:\oracle\product\10.2.0\db_1\cfgtoollogs\dbca\orcl\emConfig.log for more details.
Apr 14, 2007 2:24:45 PM oracle.sysman.emcp.EMConfig perform
CONFIG: Stack Trace:
oracle.sysman.emcp.exception.EMConfigException: Error instantiating EM configuration files
at oracle.sysman.emcp.EMAgentConfig.updateAgentConfigFiles(EMAgentConfig.java:2560)
at oracle.sysman.emcp.EMAgentConfig.performConfiguration(EMAgentConfig.java:1166)
at oracle.sysman.emcp.EMAgentConfig.invoke(EMAgentConfig.java:207)
at oracle.sysman.emcp.EMAgentConfig.invoke(EMAgentConfig.java:185)
at oracle.sysman.emcp.EMConfig.perform(EMConfig.java:146)
at oracle.sysman.assistants.util.em.EMConfiguration.run(EMConfiguration.java:430)
at java.lang.Thread.run(Thread.java:534)
Can anybody suggest me a workaround.
Is this an open bug?worth running emca -deconfig dbcontrol db and then running emca -configure dbcontrol db to let it have another try.
-
Sql Query is running fine in one database but running from long in other
Hi All,
Please advice me on below:
One query is running fine on 11gr2 database with having 2GB SGA and cost of the running query is 15, but the same query is running from long time in other database having same 2GB SGA.
Below is teh Query:
SELECT CDU.USER_NAME, DECODE(:B2 , 'QUEUE','begin
dbms_aqadm.grant_queue_privilege(''ALL'','''||:B1
||''','''||CDU.USER_NAME||''',true); end;', 'grant '||DECODE(:B2 ,
'TABLE','SELECT,INSERT,UPDATE,DELETE'||DECODE(CDU.ADMIN,'Y',',REFERENCES
',''), 'VIEW',DECODE(:B3 ,NULL,'SELECT','SELECT,INSERT,UPDATE,DELETE'||D
ECODE(CDU.ADMIN,'Y',',REFERENCES','')), 'TYPE','EXECUTE',
'SEQUENCE','SELECT', 'EXECUTE')||' on
'||PACK_UTILS.GET_SCHEMA_OWNER||'.'||:B1 ||' to
"'||CDU.USER_NAME||'"'||DECODE(CDU.ADMIN,'Y',' WITH GRANT OPTION',''))
AS GRANT_SOURCE, 'create or replace synonym
"'||CDU.USER_NAME||'"."'||:B1 ||'" for
"'||PACK_UTILS.GET_SCHEMA_OWNER||'"."'||:B1 ||'"' AS SYNONYM_SOURCE,
NVL2( S.TABLE_NAME, 'Y', 'N' ) SYNONYM_EXISTS FROM CD_USERS CDU,
ALL_SYNONYMS S, ALL_USERS U WHERE :B2 IN
('TYPE','TABLE','VIEW','FUNCTION','PROCEDURE','PACKAGE','SEQUENCE','QUEU
E','SYNONYM') AND CDU.USER_TYPE = 'S' AND CDU.USER_NAME = U.USERNAME
AND CDU.USER_NAME = S.OWNER AND :B1 = S.TABLE_NAME
Please advise me as application team is chasing me like anything. what I can find out is that Cost is different in both databases.Sorry forr Late reply friends..
below are the Explian plans for both databases:
BAD database
PLAN_TABLE_OUTPUT
SQL_ID 3bp3rynsds42r, child number 0
SELECT CDU.USER_NAME, DECODE(:B2 , 'QUEUE','begin
dbms_aqadm.grant_queue_privilege(''ALL'','''||:B1
||''','''||CDU.USER_NAME||''',true); end;', 'grant '||DECODE(:B2 ,
'TABLE','SELECT,INSERT,UPDATE,DELETE'||DECODE(CDU.ADMIN,'Y',',REFERENCES
',''), 'VIEW',DECODE(:B3 ,NULL,'SELECT','SELECT,INSERT,UPDATE,DELETE'||D
ECODE(CDU.ADMIN,'Y',',REFERENCES','')), 'TYPE','EXECUTE',
'SEQUENCE','SELECT', 'EXECUTE')||' on
'||PACK_UTILS.GET_SCHEMA_OWNER||'.'||:B1 ||' to
"'||CDU.USER_NAME||'"'||DECODE(CDU.ADMIN,'Y',' WITH GRANT OPTION',''))
PLAN_TABLE_OUTPUT
AS GRANT_SOURCE, 'create or replace synonym
"'||CDU.USER_NAME||'"."'||:B1 ||'" for
"'||PACK_UTILS.GET_SCHEMA_OWNER||'"."'||:B1 ||'"' AS SYNONYM_SOURCE,
NVL2( S.TABLE_NAME, 'Y', 'N' ) SYNONYM_EXISTS FROM CD_USERS CDU,
ALL_SYNONYMS S, ALL_USERS U WHERE :B2 IN
('TYPE','TABLE','VIEW','FUNCTION','PROCEDURE','PACKAGE','SEQUENCE','QUEU
E','SYNONYM') AND CDU.USER_TYPE = 'S' AND CDU.USER_NAME = U.USERNAME
AND CDU.USER_NAME = S.OWNER AND :B1 = S.TABLE_NAME
Plan hash value: 2404940060
PLAN_TABLE_OUTPUT
| Id | Operation | Name | Rows | Bytes |TempSpc| Cost (%CPU)| Time |
| 0 | SELECT STATEMENT | | | | | 94 (100)| |
|* 1 | FILTER | | | | | | |
|* 2 | HASH JOIN | | 81 | 6723 | | 94 (0)| 00:00:01 |
| 3 | NESTED LOOPS OUTER | | 81 | 6480 | | 91 (0)| 00:00:01 |
|* 4 | HASH JOIN | | 81 | 3726 | | 10 (0)| 00:00:01 |
|* 5 | HASH JOIN | | 137 | 3699 | | 7 (0)| 00:00:01 |
| 6 | TABLE ACCESS FULL | TS$ | 7 | 21 | | 3 (0)| 00:00:01 |
|* 7 | TABLE ACCESS FULL | USER$ | 137 | 3288 | | 4 (0)| 00:00:01 |
PLAN_TABLE_OUTPUT
|* 8 | TABLE ACCESS FULL | CD_USERS | 82 | 1558 | | 3 (0)| 00:00:01 |
| 9 | VIEW | ALL_SYNONYMS | 1 | 34 | | 1 (0)| 00:00:01 |
| 10 | SORT UNIQUE | | | | | | |
| 11 | UNION-ALL PARTITION | | | | | | |
|* 12 | FILTER | | | | | | |
| 13 | NESTED LOOPS | | 1 | 116 | | 60 (0)| 00:00:01 |
| 14 | NESTED LOOPS | | 1 | 94 | | 59 (0)| 00:00:01 |
| 15 | NESTED LOOPS | | 12 | 684 | | 23 (0)| 00:00:01 |
| 16 | TABLE ACCESS BY INDEX ROWID | USER$ | 1 | 19 | | 1 (0)| 00:00:01 |
|* 17 | INDEX UNIQUE SCAN | I_USER1 | 1 | | | 0 (0)| |
| 18 | TABLE ACCESS BY INDEX ROWID | SYN$ | 12 | 456 | | 22 (0)| 00:00:01 |
PLAN_TABLE_OUTPUT
|* 19 | INDEX SKIP SCAN | I_SYN2 | 12 | | | 12 (0)| 00:00:01 |
|* 20 | TABLE ACCESS BY INDEX ROWID | OBJ$ | 1 | 37 | | 3 (0)| 00:00:01 |
|* 21 | INDEX RANGE SCAN | I_OBJ1 | 1 | | | 2 (0)| 00:00:01 |
|* 22 | INDEX RANGE SCAN | I_USER2 | 1 | 22 | | 1 (0)| 00:00:01 |
|* 23 | FIXED TABLE FULL | X$KZSPR | 17 | 119 | | 0 (0)| |
|* 24 | FILTER | | | | | | |
|* 25 | FILTER | | | | | | |
| 26 | NESTED LOOPS | | 27 | 2430 | | 6 (0)| 00:00:01 |
| 27 | NESTED LOOPS | | 1 | 78 | | 4 (0)| 00:00:01 |
| 28 | NESTED LOOPS | | 1 | 56 | | 3 (0)| 00:00:01 |
| 29 | TABLE ACCESS BY INDEX ROWID | USER$ | 1 | 19 | | 1 (0)| 00:00:01 |
PLAN_TABLE_OUTPUT
|* 30 | INDEX UNIQUE SCAN | I_USER1 | 1 | | | 0 (0)| |
|* 31 | INDEX RANGE SCAN | I_OBJ5 | 1 | 37 | | 2 (0)| 00:00:01 |
|* 32 | INDEX RANGE SCAN | I_USER2 | 1 | 22 | | 1 (0)| 00:00:01 |
|* 33 | INDEX RANGE SCAN | I_OBJAUTH1 | 28 | 336 | | 2 (0)| 00:00:01 |
|* 34 | FIXED TABLE FULL | X$KZSRO | 1 | 3 | | 0 (0)| |
| 35 | NESTED LOOPS | | 1 | 30 | | 3 (0)| 00:00:01 |
|* 36 | INDEX SKIP SCAN | I_USER2 | 1 | 20 | | 1 (0)| 00:00:01 |
|* 37 | INDEX RANGE SCAN | I_OBJ4 | 1 | 10 | | 2 (0)| 00:00:01 |
| 38 | NESTED LOOPS | | 1 | 30 | | 3 (0)| 00:00:01 |
|* 39 | INDEX SKIP SCAN | I_USER2 | 1 | 20 | | 1 (0)| 00:00:01 |
|* 40 | INDEX RANGE SCAN | I_OBJ4 | 1 | 10 | | 2 (0)| 00:00:01 |
PLAN_TABLE_OUTPUT
|* 41 | FILTER | | | | | | |
| 42 | NESTED LOOPS | | 1 | 129 | | 4301 (2)| 00:00:39 |
| 43 | NESTED LOOPS | | 1 | 129 | | 4301 (2)| 00:00:39 |
| 44 | NESTED LOOPS | | 1 | 91 | | 4299 (2)| 00:00:39 |
| 45 | NESTED LOOPS | | 1 | 69 | | 4298 (2)| 00:00:39 |
| 46 | NESTED LOOPS | | 2 | 64 | | 4292 (2)| 00:00:39 |
| 47 | TABLE ACCESS BY INDEX ROWID | USER$ | 1 | 19 | | 1 (0)| 00:00:01 |
|* 48 | INDEX UNIQUE SCAN | I_USER1 | 1 | | | 0 (0)| |
| 49 | VIEW | _ALL_SYNONYMS_TREE | 2 | 26 | | 4291 (2)| 00:00:39 |
|* 50 | CONNECT BY NO FILTERING WITH START-WITH| | | | | | |
|* 51 | FILTER | | | | | | |
PLAN_TABLE_OUTPUT
|* 52 | HASH JOIN | | 18370 | 2080K| | 4291 (2)| 00:00:39 |
| 53 | INDEX FULL SCAN | I_USER2 | 207 | 4554 | | 1 (0)| 00:00:01 |
|* 54 | HASH JOIN | | 18370 | 1686K| | 4290 (2)| 00:00:39 |
| 55 | TABLE ACCESS FULL | USER$ | 207 | 3933 | | 4 (0)| 00:00:01 |
|* 56 | HASH JOIN | | 2922K| 209M| 18M| 4269 (1)| 00:00:39 |
|* 57 | INDEX FAST FULL SCAN | I_OBJ2 | 387K| 13M| | 1323 (1)| 00:00:12 |
| 58 | TABLE ACCESS FULL | SYN$ | 400K| 14M| | 566 (2)| 00:00:06 |
| 59 | NESTED LOOPS | | 1 | 30 | | 3 (0)| 00:00:01 |
|* 60 | INDEX SKIP SCAN | I_USER2 | 1 | 20 | | 1 (0)| 00:00:01 |
|* 61 | INDEX RANGE SCAN | I_OBJ4 | 1 | 10 | | 2 (0)| 00:00:01 |
|* 62 | FILTER | | | | | | |
PLAN_TABLE_OUTPUT
| 63 | TABLE ACCESS BY INDEX ROWID | SYN$ | 1 | 38 | | 3 (0)| 00:00:01 |
|* 64 | INDEX UNIQUE SCAN | I_SYN1 | 1 | | | 2 (0)| 00:00:01 |
|* 65 | FILTER | | | | | | |
|* 66 | FILTER | | | | | | |
| 67 | NESTED LOOPS | | 27 | 2430 | | 6 (0)| 00:00:01 |
| 68 | NESTED LOOPS | | 1 | 78 | | 4 (0)| 00:00:01 |
| 69 | NESTED LOOPS | | 1 | 56 | | 3 (0)| 00:00:01 |
| 70 | TABLE ACCESS BY INDEX ROWID | USER$ | 1 | 19 | | 1 (0)| 00:00:01 |
|* 71 | INDEX UNIQUE SCAN | I_USER1 | 1 | | | 0 (0)| |
|* 72 | INDEX RANGE SCAN | I_OBJ5 | 1 | 37 | | 2 (0)| 00:00:01 |
|* 73 | INDEX RANGE SCAN | I_USER2 | 1 | 22 | | 1 (0)| 00:00:01 |
PLAN_TABLE_OUTPUT
|* 74 | INDEX RANGE SCAN | I_OBJAUTH1 | 28 | 336 | | 2 (0)| 00:00:01 |
|* 75 | FIXED TABLE FULL | X$KZSRO | 1 | 3 | | 0 (0)| |
| 76 | NESTED LOOPS | | 1 | 30 | | 3 (0)| 00:00:01 |
|* 77 | INDEX SKIP SCAN | I_USER2 | 1 | 20 | | 1 (0)| 00:00:01 |
|* 78 | INDEX RANGE SCAN | I_OBJ4 | 1 | 10 | | 2 (0)| 00:00:01 |
|* 79 | FIXED TABLE FULL | X$KZSPR | 17 | 119 | | 0 (0)| |
|* 80 | TABLE ACCESS BY INDEX ROWID | OBJ$ | 1 | 37 | | 3 (0)| 00:00:01 |
|* 81 | INDEX RANGE SCAN | I_OBJ1 | 1 | | | 2 (0)| 00:00:01 |
|* 82 | INDEX RANGE SCAN | I_USER2 | 1 | 22 | | 1 (0)| 00:00:01 |
|* 83 | INDEX UNIQUE SCAN | I_SYN1 | 1 | | | 1 (0)| 00:00:01 |
|* 84 | TABLE ACCESS BY INDEX ROWID | SYN$ | 1 | 38 | | 2 (0)| 00:00:01 |
PLAN_TABLE_OUTPUT
| 85 | NESTED LOOPS | | 1 | 30 | | 3 (0)| 00:00:01 |
|* 86 | INDEX SKIP SCAN | I_USER2 | 1 | 20 | | 1 (0)| 00:00:01 |
|* 87 | INDEX RANGE SCAN | I_OBJ4 | 1 | 10 | | 2 (0)| 00:00:01 |
| 88 | TABLE ACCESS FULL | TS$ | 7 | 21 | | 3 (0)| 00:00:01 |
Predicate Information (identified by operation id):
1 - filter((:B2='TYPE' OR :B2='TABLE' OR :B2='VIEW' OR :B2='FUNCTION' OR :B2='PROCEDURE' OR :B2='PACKAGE' OR
:B2='SEQUENCE' OR :B2='QUEUE' OR :B2='SYNONYM'))
PLAN_TABLE_OUTPUT
2 - access("U"."TEMPTS#"="TTS"."TS#")
4 - access("CDU"."USER_NAME"="U"."NAME")
5 - access("U"."DATATS#"="DTS"."TS#")
7 - filter("U"."TYPE#"=1)
8 - filter("CDU"."USER_TYPE"='S')
12 - filter(((INTERNAL_FUNCTION("O"."SPARE3") OR ("S"."NODE" IS NULL AND IS NOT NULL) OR IS NOT NULL) AND
(("O"."TYPE#"<>4 AND "O"."TYPE#"<>5 AND "O"."TYPE#"<>7 AND "O"."TYPE#"<>8 AND "O"."TYPE#"<>9 AND "O"."TYPE#"<>10 AND
"O"."TYPE#"<>11 AND "O"."TYPE#"<>12 AND "O"."TYPE#"<>13 AND "O"."TYPE#"<>14 AND "O"."TYPE#"<>22 AND "O"."TYPE#"<>87 AND
"O"."TYPE#"<>88) OR BITAND("U"."SPARE1",16)=0 OR (SYS_CONTEXT('userenv','current_edition_name')='ORA$BASE' AND
"U"."TYPE#"<>2) OR ("U"."TYPE#"=2 AND "U"."SPARE2"=TO_NUMBER(SYS_CONTEXT('userenv','current_edition_id'))) OR IS NOT
NULL)))
PLAN_TABLE_OUTPUT
17 - access("U"."NAME"="CDU"."USER_NAME")
19 - access("S"."NAME"=:B1)
filter("S"."NAME"=:B1)
20 - filter("O"."SPARE3"="U"."USER#")
21 - access("O"."OBJ#"="S"."OBJ#" AND "O"."TYPE#"=5)
filter("O"."TYPE#"=5)
22 - access("O"."OWNER#"="U"."USER#")
23 - filter((((-"KZSPRPRV")=(-45) OR (-"KZSPRPRV")=(-47) OR (-"KZSPRPRV")=(-48) OR (-"KZSPRPRV")=(-49) OR
(-"KZSPRPRV")=(-50)) AND "INST_ID"=USERENV('INSTANCE')))
24 - filter((("BA"."GRANTOR#"=USERENV('SCHEMAID') OR IS NOT NULL) AND (("O"."TYPE#"<>4 AND "O"."TYPE#"<>5 AND
"O"."TYPE#"<>7 AND "O"."TYPE#"<>8 AND "O"."TYPE#"<>9 AND "O"."TYPE#"<>10 AND "O"."TYPE#"<>11 AND "O"."TYPE#"<>12 AND
PLAN_TABLE_OUTPUT
"O"."TYPE#"<>13 AND "O"."TYPE#"<>14 AND "O"."TYPE#"<>22 AND "O"."TYPE#"<>87 AND "O"."TYPE#"<>88) OR
BITAND("U"."SPARE1",16)=0 OR (INTERNAL_FUNCTION("O"."TYPE#") AND
((SYS_CONTEXT('userenv','current_edition_name')='ORA$BASE' AND "U"."TYPE#"<>2) OR ("U"."TYPE#"=2 AND
"U"."SPARE2"=TO_NUMBER(SYS_CONTEXT('userenv','current_edition_id'))) OR IS NOT NULL)))))
25 - filter(:B1 IS NULL)
30 - access("BU"."NAME"=:B1)
31 - access("BU"."USER#"="O"."SPARE3" AND "O"."NAME"=:B1)
32 - access("O"."OWNER#"="U"."USER#")
33 - access("BA"."OBJ#"="O"."OBJ#")
34 - filter("KZSROROL"=:B1)
36 - access("U2"."TYPE#"=2 AND "U2"."SPARE2"=TO_NUMBER(SYS_CONTEXT('userenv','current_edition_id')))
PLAN_TABLE_OUTPUT
filter(("U2"."TYPE#"=2 AND "U2"."SPARE2"=TO_NUMBER(SYS_CONTEXT('userenv','current_edition_id'))))
37 - access("O2"."DATAOBJ#"=:B1 AND "O2"."TYPE#"=88 AND "O2"."OWNER#"="U2"."USER#")
39 - access("U2"."TYPE#"=2 AND "U2"."SPARE2"=TO_NUMBER(SYS_CONTEXT('userenv','current_edition_id')))
filter(("U2"."TYPE#"=2 AND "U2"."SPARE2"=TO_NUMBER(SYS_CONTEXT('userenv','current_edition_id'))))
40 - access("O2"."DATAOBJ#"=:B1 AND "O2"."TYPE#"=88 AND "O2"."OWNER#"="U2"."USER#")
41 - filter((("O"."TYPE#"<>4 AND "O"."TYPE#"<>5 AND "O"."TYPE#"<>7 AND "O"."TYPE#"<>8 AND "O"."TYPE#"<>9 AND
"O"."TYPE#"<>10 AND "O"."TYPE#"<>11 AND "O"."TYPE#"<>12 AND "O"."TYPE#"<>13 AND "O"."TYPE#"<>14 AND "O"."TYPE#"<>22 AND
"O"."TYPE#"<>87 AND "O"."TYPE#"<>88) OR BITAND("U"."SPARE1",16)=0 OR
(SYS_CONTEXT('userenv','current_edition_name')='ORA$BASE' AND "U"."TYPE#"<>2) OR ("U"."TYPE#"=2 AND
"U"."SPARE2"=TO_NUMBER(SYS_CONTEXT('userenv','current_edition_id'))) OR IS NOT NULL))
48 - access("U"."NAME"="CDU"."USER_NAME")
PLAN_TABLE_OUTPUT
50 - access("S"."BASE_SYN_ID"=PRIOR NULL)
filter( IS NOT NULL)
51 - filter((("O"."TYPE#"<>4 AND "O"."TYPE#"<>5 AND "O"."TYPE#"<>7 AND "O"."TYPE#"<>8 AND "O"."TYPE#"<>9 AND
"O"."TYPE#"<>10 AND "O"."TYPE#"<>11 AND "O"."TYPE#"<>12 AND "O"."TYPE#"<>13 AND "O"."TYPE#"<>14 AND "O"."TYPE#"<>22 AND
"O"."TYPE#"<>87 AND "O"."TYPE#"<>88) OR BITAND("U"."SPARE1",16)=0 OR
(SYS_CONTEXT('userenv','current_edition_name')='ORA$BASE' AND "U"."TYPE#"<>2) OR ("U"."TYPE#"=2 AND
"U"."SPARE2"=TO_NUMBER(SYS_CONTEXT('userenv','current_edition_id'))) OR IS NOT NULL))
52 - access("O"."OWNER#"="U"."USER#")
54 - access("S"."OWNER"="BU"."NAME" AND "BU"."USER#"="O"."SPARE3")
56 - access("S"."NAME"="O"."NAME")
57 - filter("O"."TYPE#"=5)
PLAN_TABLE_OUTPUT
60 - access("U2"."TYPE#"=2 AND "U2"."SPARE2"=TO_NUMBER(SYS_CONTEXT('userenv','current_edition_id')))
filter(("U2"."TYPE#"=2 AND "U2"."SPARE2"=TO_NUMBER(SYS_CONTEXT('userenv','current_edition_id'))))
61 - access("O2"."DATAOBJ#"=:B1 AND "O2"."TYPE#"=88 AND "O2"."OWNER#"="U2"."USER#")
62 - filter(( IS NOT NULL OR ("S"."NODE" IS NULL AND IS NOT NULL)))
64 - access("S"."OBJ#"=:B1)
65 - filter((("BA"."GRANTOR#"=USERENV('SCHEMAID') OR IS NOT NULL) AND (("O"."TYPE#"<>4 AND "O"."TYPE#"<>5 AND
"O"."TYPE#"<>7 AND "O"."TYPE#"<>8 AND "O"."TYPE#"<>9 AND "O"."TYPE#"<>10 AND "O"."TYPE#"<>11 AND "O"."TYPE#"<>12 AND
"O"."TYPE#"<>13 AND "O"."TYPE#"<>14 AND "O"."TYPE#"<>22 AND "O"."TYPE#"<>87 AND "O"."TYPE#"<>88) OR
BITAND("U"."SPARE1",16)=0 OR (INTERNAL_FUNCTION("O"."TYPE#") AND
((SYS_CONTEXT('userenv','current_edition_name')='ORA$BASE' AND "U"."TYPE#"<>2) OR ("U"."TYPE#"=2 AND
"U"."SPARE2"=TO_NUMBER(SYS_CONTEXT('userenv','current_edition_id'))) OR IS NOT NULL)))))
PLAN_TABLE_OUTPUT
66 - filter(:B1 IS NULL)
71 - access("BU"."NAME"=:B1)
72 - access("BU"."USER#"="O"."SPARE3" AND "O"."NAME"=:B1)
73 - access("O"."OWNER#"="U"."USER#")
74 - access("BA"."OBJ#"="O"."OBJ#")
75 - filter("KZSROROL"=:B1)
77 - access("U2"."TYPE#"=2 AND "U2"."SPARE2"=TO_NUMBER(SYS_CONTEXT('userenv','current_edition_id')))
filter(("U2"."TYPE#"=2 AND "U2"."SPARE2"=TO_NUMBER(SYS_CONTEXT('userenv','current_edition_id'))))
78 - access("O2"."DATAOBJ#"=:B1 AND "O2"."TYPE#"=88 AND "O2"."OWNER#"="U2"."USER#")
79 - filter((((-"KZSPRPRV")=(-45) OR (-"KZSPRPRV")=(-47) OR (-"KZSPRPRV")=(-48) OR (-"KZSPRPRV")=(-49) OR
(-"KZSPRPRV")=(-50)) AND "INST_ID"=USERENV('INSTANCE')))
PLAN_TABLE_OUTPUT
80 - filter("O"."SPARE3"="U"."USER#")
81 - access("O"."OBJ#"="ST"."SYN_ID" AND "O"."TYPE#"=5)
filter("O"."TYPE#"=5)
82 - access("O"."OWNER#"="U"."USER#")
83 - access("S"."OBJ#"="ST"."SYN_ID")
filter("O"."OBJ#"="S"."OBJ#")
84 - filter("S"."NAME"=:B1)
86 - access("U2"."TYPE#"=2 AND "U2"."SPARE2"=TO_NUMBER(SYS_CONTEXT('userenv','current_edition_id')))
filter(("U2"."TYPE#"=2 AND "U2"."SPARE2"=TO_NUMBER(SYS_CONTEXT('userenv','current_edition_id'))))
87 - access("O2"."DATAOBJ#"=:B1 AND "O2"."TYPE#"=88 AND "O2"."OWNER#"="U2"."USER#")
209 rows selected
==============================================================================================
Good one
PLAN_TABLE_OUTPUT
SQL_ID 3bp3rynsds42r, child number 0
SELECT CDU.USER_NAME, DECODE(:B2 , 'QUEUE','begin
dbms_aqadm.grant_queue_privilege(''ALL'','''||:B1
||''','''||CDU.USER_NAME||''',true); end;', 'grant '||DECODE(:B2 ,
'TABLE','SELECT,INSERT,UPDATE,DELETE'||DECODE(CDU.ADMIN,'Y',',REFERENCES
',''), 'VIEW',DECODE(:B3 ,NULL,'SELECT','SELECT,INSERT,UPDATE,DELETE'||D
ECODE(CDU.ADMIN,'Y',',REFERENCES','')), 'TYPE','EXECUTE',
'SEQUENCE','SELECT', 'EXECUTE')||' on
'||PACK_UTILS.GET_SCHEMA_OWNER||'.'||:B1 ||' to
"'||CDU.USER_NAME||'"'||DECODE(CDU.ADMIN,'Y',' WITH GRANT OPTION',''))
PLAN_TABLE_OUTPUT
AS GRANT_SOURCE, 'create or replace synonym
"'||CDU.USER_NAME||'"."'||:B1 ||'" for
"'||PACK_UTILS.GET_SCHEMA_OWNER||'"."'||:B1 ||'"' AS SYNONYM_SOURCE,
NVL2( S.TABLE_NAME, 'Y', 'N' ) SYNONYM_EXISTS FROM CD_USERS CDU,
ALL_SYNONYMS S, ALL_USERS U WHERE :B2 IN
('TYPE','TABLE','VIEW','FUNCTION','PROCEDURE','PACKAGE','SEQUENCE','QUEU
E','SYNONYM') AND CDU.USER_TYPE = 'S' AND CDU.USER_NAME = U.USERNAME
AND CDU.USER_NAME = S.OWNER AND :B1 = S.TABLE_NAME
Plan hash value: 2146531909
PLAN_TABLE_OUTPUT
| Id | Operation | Name | Rows | Bytes |TempSpc| Cost (%CPU)| Time |
| 0 | SELECT STATEMENT | | | | | 15 (100)| |
|* 1 | FILTER | | | | | | |
| 2 | NESTED LOOPS OUTER | | 3 | 273 | | 15 (0)| 00:00:01 |
| 3 | NESTED LOOPS | | 3 | 153 | | 12 (0)| 00:00:01 |
| 4 | NESTED LOOPS | | 3 | 144 | | 9 (0)| 00:00:01 |
| 5 | NESTED LOOPS | | 3 | 135 | | 6 (0)| 00:00:01 |
|* 6 | TABLE ACCESS FULL | USER$ | 55 | 1375 | | 4 (0)| 00:00:01 |
|* 7 | TABLE ACCESS BY INDEX ROWID | CD_USERS | 1 | 20 | | 1 (0)| 00:00:01 |
PLAN_TABLE_OUTPUT
|* 8 | INDEX UNIQUE SCAN | I1_CD_USERS | 1 | | | 0 (0)| |
| 9 | TABLE ACCESS CLUSTER | TS$ | 1 | 3 | | 1 (0)| 00:00:01 |
|* 10 | INDEX UNIQUE SCAN | I_TS# | 1 | | | 0 (0)| |
| 11 | TABLE ACCESS CLUSTER | TS$ | 1 | 3 | | 1 (0)| 00:00:01 |
|* 12 | INDEX UNIQUE SCAN | I_TS# | 1 | | | 0 (0)| |
| 13 | VIEW | ALL_SYNONYMS | 1 | 40 | | 1 (0)| 00:00:01 |
| 14 | SORT UNIQUE | | | | | | |
| 15 | UNION-ALL PARTITION | | | | | | |
|* 16 | FILTER | | | | | | |
| 17 | NESTED LOOPS | | 1 | 116 | | 19 (0)| 00:00:01 |
| 18 | NESTED LOOPS | | 1 | 94 | | 18 (0)| 00:00:01 |
PLAN_TABLE_OUTPUT
| 19 | NESTED LOOPS | | 1 | 56 | | 15 (0)| 00:00:01 |
| 20 | TABLE ACCESS BY INDEX ROWID | USER$ | 1 | 20 | | 1 (0)| 00:00:01 |
|* 21 | INDEX UNIQUE SCAN | I_USER1 | 1 | | | 0 (0)| |
| 22 | TABLE ACCESS BY INDEX ROWID | SYN$ | 1 | 36 | | 14 (0)| 00:00:01 |
|* 23 | INDEX SKIP SCAN | I_SYN2 | 1 | | | 12 (0)| 00:00:01 |
|* 24 | TABLE ACCESS BY INDEX ROWID | OBJ$ | 1 | 38 | | 3 (0)| 00:00:01 |
|* 25 | INDEX RANGE SCAN | I_OBJ1 | 1 | | | 2 (0)| 00:00:01 |
|* 26 | INDEX RANGE SCAN | I_USER2 | 1 | 22 | | 1 (0)| 00:00:01 |
|* 27 | FIXED TABLE FULL | X$KZSPR | 17 | 119 | | 0 (0)| |
|* 28 | FILTER | | | | | | |
|* 29 | FILTER | | | | | | |
PLAN_TABLE_OUTPUT
| 30 | NESTED LOOPS | | 3 | 279 | | 5 (0)| 00:00:01 |
| 31 | NESTED LOOPS | | 1 | 80 | | 4 (0)| 00:00:01 |
| 32 | NESTED LOOPS | | 1 | 58 | | 3 (0)| 00:00:01 |
| 33 | TABLE ACCESS BY INDEX ROWID | USER$ | 1 | 20 | | 1 (0)| 00:00:01 |
|* 34 | INDEX UNIQUE SCAN | I_USER1 | 1 | | | 0 (0)| |
|* 35 | INDEX RANGE SCAN | I_OBJ5 | 1 | 38 | | 2 (0)| 00:00:01 |
|* 36 | INDEX RANGE SCAN | I_USER2 | 1 | 22 | | 1 (0)| 00:00:01 |
|* 37 | INDEX RANGE SCAN | I_OBJAUTH1 | 3 | 39 | | 1 (0)| 00:00:01 |
|* 38 | FIXED TABLE FULL | X$KZSRO | 1 | 3 | | 0 (0)| |
| 39 | NESTED LOOPS | | 1 | 32 | | 3 (0)| 00:00:01 |
|* 40 | INDEX SKIP SCAN | I_USER2 | 1 | 20 | | 1 (0)| 00:00:01 |
PLAN_TABLE_OUTPUT
|* 41 | INDEX RANGE SCAN | I_OBJ4 | 1 | 12 | | 2 (0)| 00:00:01 |
| 42 | NESTED LOOPS | | 1 | 32 | | 3 (0)| 00:00:01 |
|* 43 | INDEX SKIP SCAN | I_USER2 | 1 | 20 | | 1 (0)| 00:00:01 |
|* 44 | INDEX RANGE SCAN | I_OBJ4 | 1 | 12 | | 2 (0)| 00:00:01 |
|* 45 | FILTER | | | | | | |
| 46 | NESTED LOOPS | | 1 | 129 | | 1065 (1)| 00:00:13 |
| 47 | NESTED LOOPS | | 1 | 107 | | 1064 (1)| 00:00:13 |
| 48 | NESTED LOOPS | | 1 | 69 | | 1061 (1)| 00:00:13 |
| 49 | NESTED LOOPS | | 2 | 66 | | 1059 (1)| 00:00:13 |
| 50 | TABLE ACCESS BY INDEX ROWID | USER$ | 1 | 20 | | 1 (0)| 00:00:01 |
|* 51 | INDEX UNIQUE SCAN | I_USER1 | 1 | | | 0 (0)| |
PLAN_TABLE_OUTPUT
| 52 | VIEW | _ALL_SYNONYMS_TREE | 2 | 26 | | 1058 (1)| 00:00:13 |
|* 53 | CONNECT BY NO FILTERING WITH START-WITH| | | | | | |
|* 54 | FILTER | | | | | | |
|* 55 | HASH JOIN | | 705 | 81780 | | 1058 (1)| 00:00:13 |
| 56 | INDEX FULL SCAN | I_USER2 | 124 | 2728 | | 1 (0)| 00:00:01 |
|* 57 | HASH JOIN | | 705 | 66270 | | 1057 (1)| 00:00:13 |
| 58 | TABLE ACCESS FULL | USER$ | 124 | 2480 | | 4 (0)| 00:00:01 |
|* 59 | HASH JOIN | | 66964 | 4839K| 2232K| 1052 (1)| 00:00:13 |
| 60 | TABLE ACCESS FULL | SYN$ | 47615 | 1673K| | 78 (2)| 00:00:01 |
|* 61 | INDEX FAST FULL SCAN | I_OBJ5 | 47862 | 1776K| | 752 (1)| 00:00:10 |
| 62 | NESTED LOOPS | | 1 | 32 | | 3 (0)| 00:00:01 |
PLAN_TABLE_OUTPUT
|* 63 | INDEX SKIP SCAN | I_USER2 | 1 | 20 | | 1 (0)| 00:00:01 |
|* 64 | INDEX RANGE SCAN | I_OBJ4 | 1 | 12 | | 2 (0)| 00:00:01 |
|* 65 | FILTER | | | | | | |
| 66 | TABLE ACCESS BY INDEX ROWID | SYN$ | 1 | 36 | | 2 (0)| 00:00:01 |
|* 67 | INDEX UNIQUE SCAN | I_SYN1 | 1 | | | 1 (0)| 00:00:01 |
|* 68 | FILTER | | | | | | |
|* 69 | FILTER | | | | | | |
| 70 | NESTED LOOPS | | 3 | 279 | | 5 (0)| 00:00:01 |
| 71 | NESTED LOOPS | | 1 | 80 | | 4 (0)| 00:00:01 |
| 72 | NESTED LOOPS | | 1 | 58 | | 3 (0)| 00:00:01 |
| 73 | TABLE ACCESS BY INDEX ROWID | USER$ | 1 | 20 | | 1 (0)| 00:00:01 |
PLAN_TABLE_OUTPUT
|* 74 | INDEX UNIQUE SCAN | I_USER1 | 1 | | | 0 (0)| |
|* 75 | INDEX RANGE SCAN | I_OBJ5 | 1 | 38 | | 2 (0)| 00:00:01 |
|* 76 | INDEX RANGE SCAN | I_USER2 | 1 | 22 | | 1 (0)| 00:00:01 |
|* 77 | INDEX RANGE SCAN | I_OBJAUTH1 | 3 | 39 | | 1 (0)| 00:00:01 |
|* 78 | FIXED TABLE FULL | X$KZSRO | 1 | 3 | | 0 (0)| |
| 79 | NESTED LOOPS | | 1 | 32 | | 3 (0)| 00:00:01 |
|* 80 | INDEX SKIP SCAN | I_USER2 | 1 | 20 | | 1 (0)| 00:00:01 |
|* 81 | INDEX RANGE SCAN | I_OBJ4 | 1 | 12 | | 2 (0)| 00:00:01 |
|* 82 | FIXED TABLE FULL | X$KZSPR | 17 | 119 | | 0 (0)| |
|* 83 | TABLE ACCESS BY INDEX ROWID | SYN$ | 1 | 36 | | 1 (0)| 00:00:01 |
|* 84 | INDEX UNIQUE SCAN | I_SYN1 | 1 | | | 0 (0)| |
PLAN_TABLE_OUTPUT
|* 85 | TABLE ACCESS BY INDEX ROWID | OBJ$ | 1 | 38 | | 3 (0)| 00:00:01 |
|* 86 | INDEX RANGE SCAN | I_OBJ1 | 1 | | | 2 (0)| 00:00:01 |
|* 87 | INDEX RANGE SCAN | I_USER2 | 1 | 22 | | 1 (0)| 00:00:01 |
| 88 | NESTED LOOPS | | 1 | 32 | | 3 (0)| 00:00:01 |
|* 89 | INDEX SKIP SCAN | I_USER2 | 1 | 20 | | 1 (0)| 00:00:01 |
|* 90 | INDEX RANGE SCAN | I_OBJ4 | 1 | 12 | | 2 (0)| 00:00:01 |
Predicate Information (identified by operation id):
PLAN_TABLE_OUTPUT
1 - filter((:B2='TYPE' OR :B2='TABLE' OR :B2='VIEW' OR :B2='FUNCTION' OR :B2='PROCEDURE' OR :B2='PACKAGE' OR
:B2='SEQUENCE' OR :B2='QUEUE' OR :B2='SYNONYM'))
6 - filter("U"."TYPE#"=1)
7 - filter("CDU"."USER_TYPE"='S')
8 - access("CDU"."USER_NAME"="U"."NAME")
10 - access("U"."DATATS#"="DTS"."TS#")
12 - access("U"."TEMPTS#"="TTS"."TS#")
16 - filter(((INTERNAL_FUNCTION("O"."SPARE3") OR ("S"."NODE" IS NULL AND IS NOT NULL) OR IS NOT NULL) AND
(("O"."TYPE#"<>4 AND "O"."TYPE#"<>5 AND "O"."TYPE#"<>7 AND "O"."TYPE#"<>8 AND "O"."TYPE#"<>9 AND "O"."TYPE#"<>10 AND
"O"."TYPE#"<>11 AND "O"."TYPE#"<>12 AND "O"."TYPE#"<>13 AND "O"."TYPE#"<>14 AND "O"."TYPE#"<>22 AND "O"."TYPE#"<>87 AND
"O"."TYPE#"<>88) OR BITAND("U"."SPARE1",16)=0 OR (SYS_CONTEXT('userenv','current_edition_name')='ORA$BASE' AND
PLAN_TABLE_OUTPUT
"U"."TYPE#"<>2) OR ("U"."TYPE#"=2 AND "U"."SPARE2"=TO_NUMBER(SYS_CONTEXT('userenv','current_edition_id'))) OR IS NOT
NULL)))
21 - access("U"."NAME"="CDU"."USER_NAME")
23 - access("S"."NAME"=:B1)
filter("S"."NAME"=:B1)
24 - filter("O"."SPARE3"="U"."USER#")
25 - access("O"."OBJ#"="S"."OBJ#" AND "O"."TYPE#"=5)
filter("O"."TYPE#"=5)
26 - access("O"."OWNER#"="U"."USER#")
27 - filter((((-"KZSPRPRV")=(-45) OR (-"KZSPRPRV")=(-47) OR (-"KZSPRPRV")=(-48) OR (-"KZSPRPRV")=(-49) OR
(-"KZSPRPRV")=(-50)) AND "INST_ID"=USERENV('INSTANCE')))
PLAN_TABLE_OUTPUT
28 - filter((("BA"."GRANTOR#"=USERENV('SCHEMAID') OR IS NOT NULL) AND (("O"."TYPE#"<>4 AND "O"."TYPE#"<>5 AND
"O"."TYPE#"<>7 AND "O"."TYPE#"<>8 AND "O"."TYPE#"<>9 AND "O"."TYPE#"<>10 AND "O"."TYPE#"<>11 AND "O"."TYPE#"<>12 AND
"O"."TYPE#"<>13 AND "O"."TYPE#"<>14 AND "O"."TYPE#"<>22 AND "O"."TYPE#"<>87 AND "O"."TYPE#"<>88) OR
BITAND("U"."SPARE1",16)=0 OR (INTERNAL_FUNCTION("O"."TYPE#") AND
((SYS_CONTEXT('userenv','current_edition_name')='ORA$BASE' AND "U"."TYPE#"<>2) OR ("U"."TYPE#"=2 AND
"U"."SPARE2"=TO_NUMBER(SYS_CONTEXT('userenv','current_edition_id'))) OR IS NOT NULL)))))
29 - filter(:B1 IS NULL)
34 - access("BU"."NAME"=:B1)
35 - access("BU"."USER#"="O"."SPARE3" AND "O"."NAME"=:B1)
36 - access("O"."OWNER#"="U"."USER#")
37 - access("BA"."OBJ#"="O"."OBJ#")
PLAN_TABLE_OUTPUT
38 - filter("KZSROROL"=:B1)
40 - access("U2"."TYPE#"=2 AND "U2"."SPARE2"=TO_NUMBER(SYS_CONTEXT('userenv','current_edition_id')))
filter(("U2"."TYPE#"=2 AND "U2"."SPARE2"=TO_NUMBER(SYS_CONTEXT('userenv','current_edition_id'))))
41 - access("O2"."DATAOBJ#"=:B1 AND "O2"."TYPE#"=88 AND "O2"."OWNER#"="U2"."USER#")
43 - access("U2"."TYPE#"=2 AND "U2"."SPARE2"=TO_NUMBER(SYS_CONTEXT('userenv','current_edition_id')))
filter(("U2"."TYPE#"=2 AND "U2"."SPARE2"=TO_NUMBER(SYS_CONTEXT('userenv','current_edition_id'))))
44 - access("O2"."DATAOBJ#"=:B1 AND "O2"."TYPE#"=88 AND "O2"."OWNER#"="U2"."USER#")
45 - filter((("O"."TYPE#"<>4 AND "O"."TYPE#"<>5 AND "O"."TYPE#"<>7 AND "O"."TYPE#"<>8 AND "O"."TYPE#"<>9 AND
"O"."TYPE#"<>10 AND "O"."TYPE#"<>11 AND "O"."TYPE#"<>12 AND "O"."TYPE#"<>13 AND "O"."TYPE#"<>14 AND "O"."TYPE#"<>22 AND
"O"."TYPE#"<>87 AND "O"."TYPE#"<>88) OR BITAND("U"."SPARE1",16)=0 OR
(SYS_CONTEXT('userenv','current_edition_name')='ORA$BASE' AND "U"."TYPE#"<>2) OR ("U"."TYPE#"=2 AND
PLAN_TABLE_OUTPUT
"U"."SPARE2"=TO_NUMBER(SYS_CONTEXT('userenv','current_edition_id'))) OR IS NOT NULL))
51 - access("U"."NAME"="CDU"."USER_NAME")
53 - access("S"."BASE_SYN_ID"=PRIOR NULL)
filter( IS NOT NULL)
54 - filter((("O"."TYPE#"<>4 AND "O"."TYPE#"<>5 AND "O"."TYPE#"<>7 AND "O"."TYPE#"<>8 AND "O"."TYPE#"<>9 AND
"O"."TYPE#"<>10 AND "O"."TYPE#"<>11 AND "O"."TYPE#"<>12 AND "O"."TYPE#"<>13 AND "O"."TYPE#"<>14 AND "O"."TYPE#"<>22 AND
"O"."TYPE#"<>87 AND "O"."TYPE#"<>88) OR BITAND("U"."SPARE1",16)=0 OR
(SYS_CONTEXT('userenv','current_edition_name')='ORA$BASE' AND "U"."TYPE#"<>2) OR ("U"."TYPE#"=2 AND
"U"."SPARE2"=TO_NUMBER(SYS_CONTEXT('userenv','current_edition_id'))) OR IS NOT NULL))
55 - access("O"."OWNER#"="U"."USER#")
57 - access("S"."OWNER"="BU"."NAME" AND "BU"."USER#"="O"."SPARE3")
PLAN_TABLE_OUTPUT
59 - access("S"."NAME"="O"."NAME")
61 - filter("O"."TYPE#"=5)
63 - access("U2"."TYPE#"=2 AND "U2"."SPARE2"=TO_NUMBER(SYS_CONTEXT('userenv','current_edition_id')))
filter(("U2"."TYPE#"=2 AND "U2"."SPARE2"=TO_NUMBER(SYS_CONTEXT('userenv','current_edition_id'))))
64 - access("O2"."DATAOBJ#"=:B1 AND "O2"."TYPE#"=88 AND "O2"."OWNER#"="U2"."USER#")
65 - filter(( IS NOT NULL OR ("S"."NODE" IS NULL AND IS NOT NULL)))
67 - access("S"."OBJ#"=:B1)
68 - filter((("BA"."GRANTOR#"=USERENV('SCHEMAID') OR IS NOT NULL) AND (("O"."TYPE#"<>4 AND "O"."TYPE#"<>5 AND
"O"."TYPE#"<>7 AND "O"."TYPE#"<>8 AND "O"."TYPE#"<>9 AND "O"."TYPE#"<>10 AND "O"."TYPE#"<>11 AND "O"."TYPE#"<>12 AND
"O"."TYPE#"<>13 AND "O"."TYPE#"<>14 AND "O"."TYPE#"<>22 AND "O"."TYPE#"<>87 AND "O"."TYPE#"<>88) OR
BITAND("U"."SPARE1",16)=0 OR (INTERNAL_FUNCTION("O"."TYPE#") AND
PLAN_TABLE_OUTPUT
((SYS_CONTEXT('userenv','current_edition_name')='ORA$BASE' AND "U"."TYPE#"<>2) OR ("U"."TYPE#"=2 AND
"U"."SPARE2"=TO_NUMBER(SYS_CONTEXT('userenv','current_edition_id'))) OR IS NOT NULL)))))
69 - filter(:B1 IS NULL)
74 - access("BU"."NAME"=:B1)
75 - access("BU"."USER#"="O"."SPARE3" AND "O"."NAME"=:B1)
76 - access("O"."OWNER#"="U"."USER#")
77 - access("BA"."OBJ#"="O"."OBJ#")
78 - filter("KZSROROL"=:B1)
80 - access("U2"."TYPE#"=2 AND "U2"."SPARE2"=TO_NUMBER(SYS_CONTEXT('userenv','current_edition_id')))
filter(("U2"."TYPE#"=2 AND "U2"."SPARE2"=TO_NUMBER(SYS_CONTEXT('userenv','current_edition_id'))))
81 - access("O2"."DATAOBJ#"=:B1 AND "O2"."TY -
SSIS Package runs from the Package executer and from BIDS but not from the sql agent schedular
Hi Experts,
I have 2 packages :
1. Main Package -For each loop package
2. Sub Package - As we need to collect the information from several other DB with same table structures .
The Main Package calls the Sub Package and loops through several linked server (9 of them ) .
From last 2 weeks the scheduler is running on time but no data is loaded into our destination DB .
Daily i need to manually run the package .
The SQL Agent task is scheduled using the service account from which the sql server was installed on the server so it has the full privledges.
If i run the Main package from the BIDS i see 2 messages related to the configuration of xml no error message and executes fine.
If i run the Package from the execute package utility it runs fine.
Now if the package is scheduled for a nightly load it executes fine successfully no error message also in the Job History
but when i check for the data loaded on that day no data loads up in the destination DB . Due to this behavior of the sql agent even if am on leave i have to login on to the server and exec manually so if at times i forget the exec we are in big trouble
Please experts help me in troubleshooting the issue.
Thanks
PriyaHi Visakh16 ,
We are using a service account to run the package .. Earlier in the BIDS i was getting the error crypotgenic
something password .. I googled out and changed the security : Protection Level : Dont save Sensitive
information . So that error now its not showing in the BIDS
And how is login mapping done for the linked servers? You've configured a mapped login for the service account also?
Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs -
Same exact update runs fine in one db but causes ORA-00904 in another
I have an update statement that runs fine in one db but causes "" error in another. The two databases table structures are the same. I checked for synonyms and reserved words on BASE and COMPANY_ID but did not come up with anything. The db where it is working is 10.2. The db where it is not working is 10.1.
Here is the statement:
1 UPDATE t_company base
2 SET (company_name, company_name_sid, company_name_lco, canonical_name,
3 short_name, short_name2) =
4 (SELECT company_name, source_id, company_name_lco, canonical_name,
5 short_name, short_name2
6 FROM t_auth_company comp
7 WHERE comp.company_id = base.company_id
8 AND source_id =
9 (SELECT source_id
10 FROM (SELECT auth.source_id, trumping_order
11 FROM t_auth_company auth,
12 t_trumping_rule rl
13 WHERE auth.company_id = base.company_id
14 AND auth.company_name IS NOT NULL
15 AND rl.source_id = auth.source_id
16 AND rl.attribute_id = 'abc'
17 ORDER BY rl.trumping_order)
18 WHERE ROWNUM = 1))
19 WHERE
20 (-- The company has been updated
21 company_id IN (
22 SELECT company_id
23 FROM t_auth_company auth
24 WHERE auth.company_name_lco >= sysdate
25 OR auth.company_id_lco >= sysdate)
26 OR
27 ( -- The trumping rule for the attribute has been changed
28 SELECT MAX(last_changed_on)
29 FROM t_trumping_rule rl
30 WHERE rl.attribute_id = 'abc' ) >= sysdate
31 )
32 -- The company has been merged
33 AND 1 < (SELECT COUNT (*)
34 FROM t_auth_company auth
35* WHERE auth.company_id = base.company_id)
SQL> /
WHERE auth.company_id = base.company_id
ERROR at line 13:
ORA-00904: "BASE"."COMPANY_ID": invalid identifier
Thank You
BorisThank you for responding. It is syntactically working in the 10.2 database. Please, see this:
SQL> UPDATE t_company base
2 SET (company_name, company_name_sid, company_name_lco, canonical_name,
3 short_name, short_name2) =
4 (SELECT company_name, source_id, company_name_lco, canonical_name,
5 short_name, short_name2
6 FROM t_auth_company comp
7 WHERE comp.company_id = base.company_id
8 AND source_id =
9 (SELECT source_id
10 FROM (SELECT auth.source_id, trumping_order
11 FROM t_auth_company auth,
12 t_trumping_rule rl
13 WHERE auth.company_id = base.company_id
14 AND auth.company_name IS NOT NULL
15 AND rl.source_id = auth.source_id
16 AND rl.attribute_id = 'abc'
17 ORDER BY rl.trumping_order)
18 WHERE ROWNUM = 1))
19 WHERE
20 (-- The company has been updated
21 company_id IN (
22 SELECT company_id
23 FROM t_auth_company auth
24 WHERE auth.company_name_lco >= sysdate
25 OR auth.company_id_lco >= sysdate)
26 OR
27 ( -- The trumping rule for the attribute has been changed
28 SELECT MAX(last_changed_on)
29 FROM t_trumping_rule rl
30 WHERE rl.attribute_id = 'abc' ) >= sysdate
31 )
32 -- The company has been merged
33 AND 1 < (SELECT COUNT (*)
34 FROM t_auth_company auth
35 WHERE auth.company_id = base.company_id)
36 /
0 rows updated.
SQL>
The table structures are as follows:
CREATE TABLE RTCR_UCDB.T_AUTH_COMPANY
AUTH_COMPANY_ID NUMBER(22),
SOURCE_ID NUMBER(3) NOT NULL,
LD_COMPANY_ID NUMBER(22),
SOURCE_COMPANY_ID VARCHAR2(150 BYTE),
MATCH_DECISION NUMBER(1) DEFAULT 0 NOT NULL,
MATCH_DECISION_LCO DATE DEFAULT sysdate,
COMPANY_ID NUMBER(22),
COMPANY_ID_LCO DATE,
COMPANY_NAME VARCHAR2(150 BYTE),
COMPANY_NAME_LCO DATE DEFAULT sysdate,
CANONICAL_NAME VARCHAR2(150 BYTE),
SHORT_NAME VARCHAR2(150 BYTE),
SHORT_NAME2 VARCHAR2(150 BYTE),
URL VARCHAR2(150 BYTE),
URL_LCO DATE DEFAULT sysdate,
NURL VARCHAR2(150 BYTE),
PRIMARY_SIC VARCHAR2(150 BYTE),
PRIMARY_SIC_LCO DATE DEFAULT sysdate,
PRIMARY_TICKER VARCHAR2(15 BYTE),
PRIMARY_TICKER_LCO DATE DEFAULT sysdate,
EXCHANGE_ID VARCHAR2(60 BYTE),
EXCHANGE_ID_LCO DATE DEFAULT sysdate,
NEXCHANGE_ID VARCHAR2(60 BYTE),
ADDRESS VARCHAR2(150 BYTE),
ADDRESS_LCO DATE DEFAULT sysdate,
NADDRESS VARCHAR2(150 BYTE),
NADDRESS_CONTAINS VARCHAR2(150 BYTE),
CITY VARCHAR2(150 BYTE),
CITY_LCO DATE DEFAULT sysdate,
NCITY VARCHAR2(150 BYTE),
STATE VARCHAR2(150 BYTE),
STATE_LCO DATE DEFAULT sysdate,
NSTATE VARCHAR2(150 BYTE),
POSTAL_CODE VARCHAR2(15 BYTE),
POSTAL_CODE_LCO DATE DEFAULT sysdate,
NPOSTAL_CODE VARCHAR2(15 BYTE),
COUNTRY_ID VARCHAR2(10 BYTE),
COUNTRY_ID_LCO DATE DEFAULT sysdate,
NCOUNTRY_ID VARCHAR2(10 BYTE),
TELEPHONE VARCHAR2(60 BYTE),
TELEPHONE_LCO DATE DEFAULT sysdate,
NPHONE VARCHAR2(60 BYTE),
PHONE_7D VARCHAR2(60 BYTE),
PHONE_AREA VARCHAR2(60 BYTE),
FAX VARCHAR2(60 BYTE),
FAX_LCO DATE DEFAULT sysdate,
NFAX VARCHAR2(60 BYTE),
GW_COMPANY_ID VARCHAR2(150 BYTE),
GW_COMPANY_ID_LCO DATE DEFAULT sysdate,
CIK_NUMBER VARCHAR2(150 BYTE),
CIK_NUMBER_LCO DATE DEFAULT sysdate,
IRS_EIN VARCHAR2(150 BYTE),
IRS_EIN_LCO DATE DEFAULT sysdate,
MIN_DATA_FLAG VARCHAR2(1 BYTE) DEFAULT 'N' NOT NULL,
OBSOLETE_FLAG VARCHAR2(1 BYTE) DEFAULT 'N' NOT NULL,
OBSOLETE_FLAG_LCO DATE,
LAST_CHANGED_BY VARCHAR2(50 BYTE) DEFAULT user NOT NULL,
LAST_CHANGED_ON DATE DEFAULT sysdate NOT NULL,
CREATED_ON DATE NOT NULL
CREATE TABLE RTCR_UCDB.T_TRUMPING_RULE
SOURCE_ID NUMBER(3) NOT NULL,
ATTRIBUTE_ID NUMBER(5) NOT NULL,
TRUMPING_ORDER NUMBER(3),
LAST_CHANGED_BY VARCHAR2(50 BYTE) DEFAULT USER,
LAST_CHANGED_ON DATE DEFAULT sysdate
CREATE TABLE RTCR_UCDB.T_COMPANY
COMPANY_ID NUMBER(22),
COMPANY_NAME VARCHAR2(150 BYTE),
COMPANY_NAME_SID NUMBER(3),
COMPANY_NAME_LCO DATE,
CANONICAL_NAME VARCHAR2(150 BYTE),
SHORT_NAME VARCHAR2(150 BYTE),
SHORT_NAME2 VARCHAR2(150 BYTE),
URL VARCHAR2(150 BYTE),
URL_SID NUMBER(3),
URL_LCO DATE,
NURL VARCHAR2(150 BYTE),
PRIMARY_SIC VARCHAR2(150 BYTE),
PRIMARY_SIC_SID NUMBER(3),
PRIMARY_SIC_LCO DATE,
PRIMARY_TICKER VARCHAR2(15 BYTE),
PRIMARY_TICKER_SID NUMBER(3),
PRIMARY_TICKER_LCO DATE,
EXCHANGE_ID VARCHAR2(60 BYTE),
EXCHANGE_ID_SID NUMBER(3),
EXCHANGE_ID_LCO DATE,
NEXCHANGE_ID VARCHAR2(60 BYTE),
ADDRESS VARCHAR2(150 BYTE),
ADDRESS_SID NUMBER(3),
ADDRESS_LCO DATE,
NADDRESS VARCHAR2(150 BYTE),
CITY VARCHAR2(150 BYTE),
CITY_SID NUMBER(3),
CITY_LCO DATE,
NCITY VARCHAR2(150 BYTE),
STATE VARCHAR2(150 BYTE),
STATE_SID NUMBER(3),
STATE_LCO DATE,
NSTATE VARCHAR2(150 BYTE),
POSTAL_CODE VARCHAR2(15 BYTE),
POSTAL_CODE_SID NUMBER(3),
POSTAL_CODE_LCO DATE,
NPOSTAL_CODE VARCHAR2(15 BYTE),
COUNTRY_ID VARCHAR2(10 BYTE),
COUNTRY_ID_SID NUMBER(3),
COUNTRY_ID_LCO DATE,
NCOUNTRY_ID VARCHAR2(10 BYTE),
TELEPHONE VARCHAR2(60 BYTE),
TELEPHONE_SID NUMBER(3),
TELEPHONE_LCO DATE,
NPHONE VARCHAR2(60 BYTE),
PHONE_7D VARCHAR2(60 BYTE),
PHONE_AREA VARCHAR2(60 BYTE),
FAX VARCHAR2(60 BYTE),
FAX_SID NUMBER(3),
FAX_LCO DATE,
NFAX VARCHAR2(60 BYTE),
GW_COMPANY_ID VARCHAR2(150 BYTE),
GW_COMPANY_ID_SID NUMBER(3),
GW_COMPANY_ID_LCO DATE,
CIK_NUMBER VARCHAR2(150 BYTE),
CIK_NUMBER_SID NUMBER(3),
CIK_NUMBER_LCO DATE,
IRS_EIN VARCHAR2(150 BYTE),
IRS_EIN_SID NUMBER(3),
IRS_EIN_LCO DATE,
LAST_CHANGED_BY VARCHAR2(50 BYTE) DEFAULT user NOT NULL,
LAST_CHANGED_ON DATE DEFAULT sysdate NOT NULL,
CREATED_ON DATE NOT NULL
) -
Query runs fine in 9i but results to ORA-01652 unable to extend temp in 10g
Hi,
We are having issues in running a SQL query in 10g. In 9i, it runs fine with no problems but when run in 10g, It takes forever and the temp tablespace grows very large upto 60GB until we get ORA-01652 error due to lack of disk space. This does not occur in 9i, where query runs in only 20 mins and does not take up temp that big. 9i version is 9.2.0.8. 10g is 10.2.0.3Heres the SQL query:
SELECT
J2.EMPLID,
TO_CHAR(J2.EFFDT,'YYYY-MM-DD'),
J2.EFFSEQ,
J2."ACTION",
J2.ACTION_REASON,
TO_CHAR(J2.GRADE_ENTRY_DT,'YYYY-MM-DD'),
J2.COMPRATE,
J2.CHANGE_AMT,
J2.COMP_FREQUENCY,
J2.STD_HOURS,
J2.JOBCODE,
J2.GRADE,
J2.PAYGROUP,
PN2.NATIONAL_ID,
TO_CHAR(PC.CHECK_DT,'YYYY-MM-DD'),
SUM(PO.OTH_EARNS),
To_CHAR(SUM(PO.OTH_EARNS)),
PO.ERNCD,
'3',
TO_CHAR(PC.PAY_END_DT,'YYYY-MM-DD'),
PC.PAYCHECK_NBR
FROM PS_JOB J2,
PS_PERS_NID PN2,
PS_PAY_OTH_EARNS PO,
PS_PAY_CHECK PC
WHERE J2.EMPL_RCD = 0
AND PN2.EMPLID = J2.EMPLID
AND PN2.COUNTRY = 'USA'
AND PN2.NATIONAL_ID_TYPE = 'PR'
AND J2.COMPANY <> '900'
AND J2.EFFDT <= SYSDATE
AND PC.EMPLID = J2.EMPLID
AND PC.COMPANY = PO.COMPANY
AND PC.PAYGROUP = PO.PAYGROUP
AND PC.PAY_END_DT = PO.PAY_END_DT
AND PC.OFF_CYCLE = PO.OFF_CYCLE
AND PC.PAGE_NUM = PO.PAGE_NUM
AND PC.LINE_NUM = PO.LINE_NUM
AND PC.SEPCHK = PO.SEPCHK
AND EXISTS (SELECT ERNCD
FROM PS_P1_CMP_ERNCD P1_CMP
WHERE P1_CMP.ERNCD = PO.ERNCD AND EFF_STATUS = 'A')
GROUP BY J2.EMPLID,
J2.EFFDT,
J2.EFFSEQ,
J2.ACTION,
J2.ACTION_REASON,
J2.GRADE_ENTRY_DT,
J2.COMPRATE,
J2.CHANGE_AMT,
J2.COMP_FREQUENCY,
J2.STD_HOURS,
J2.JOBCODE,
J2.GRADE,
J2.PAYGROUP,
PN2.NATIONAL_ID,
PC.CHECK_DT,
PO.ERNCD,
'3',
PC.PAY_END_DT,
PC.PAYCHECK_NBR -
Newbie question: sql runs on sqlplus but not compile in pl/sql?
I have the following two tables I would like to put a sql statement into pl/sql packages so I can use dbms_jobs automate it however, I keep getting compile time error. It seems to me that pl/sql does not like my sql that runs fine in sqlplus. Below is the error message and my test case?
mdb_user@CMD> show error
Errors for PACKAGE BODY DATA_QUALITY_REPORT_P:
LINE/COL ERROR
10/1 PL/SQL: SQL Statement ignored
13/42 PL/SQL: ORA-00942: table or view does not exist
create table S_ORG_EXT
accnt_type_cd varchar2(100),
cust_stat_cd varchar2(100)
insert into s_org_ext
select column_name,data_type from user_tab_columns where rownum <= 100
select * from s_org_ext
create table data_quality_report
runid number not null,
report_type number not null, --report type such as dup or not dup or other metrics
org_level number not null, --organization level nsgn, sgn, shipto
loc_level number not null,--locale level by city, by country, by region, grand_total
name varchar2(100) not null,--the row output name of the agg
value number not null,-- the row output value of the agg
rundate date default sysdate
create sequence data_quality_report_seq start with 1000
INCREMENT BY 1
NOCACHE
NOCYCLE
insert into data_quality_report
select data_quality_report_seq.nextval,3,99,99,accnt_type_cd,cnt,sysdate from
select accnt_type_cd, count (*) cnt from S_ORG_EXT where cust_stat_cd = 'VARCHAR2' group by accnt_type_cd order by 2 desc
select * from data_quality_report
truncate table data_quality_report
CREATE or replace PACKAGE data_quality_report_p AS
function pull_data return data_quality_report.runid%type;
END data_quality_report_p ;
create or replace package body data_quality_report_p as
function pull_data return data_quality_report.runid%type is
new_rid data_quality_report.runid%type;
begin
select data_quality_report_seq.nextval into new_rid from dual;
insert into data_quality_report
select new_rid,3,999999,999999,accnt_type_cd,cnt,sysdate from
select accnt_type_cd, count (*) cnt from S_ORG_EXT where cust_stat_cd = 'VARCHAR2' group by accnt_type_cd order by 2 desc
return new_rid;
exception
when no_data_found then
DBMS_OUTPUT.PUT_LINE('Handling NO_DATA_FOUND exception.');
when others then
DBMS_OUTPUT.PUT_LINE('Handling OTHER exception.');
end; --end pull_data
end data_quality_report_p;
/Hi,
A very common cause for ORA-00942 in a stored procedure (here I'm including packages and functions) is that you have privileges only through a role. Roles don't count in stored procedures if they are compiled with the default "AUTHID DEFINER". Either
(1) have whatever privileges you need (e.g. "INSERT ON data_quality_report" or "SELECT ON s_org_ext") granted directly to you (the package owner), or to the pseudo-user PUBLIC, and not merely to some role that you have, or
(2) create the package in the same schema as the tables, or
(3) create the package with "invoker's rights", like this
CREATE OR REPLACE PACKAGE data_quality_report_p
AUTHID CURRENT_USER -- Added
AS
FUNCTION pull_data ...'AUTHID CURRENT_USER" goes right before the keyword "IS" (or "AS") in the package spec; you don't have to do anything to the package body.
However, if you do this, then whoever runs the package will need to have those privileges, in addition to EXECUTE privileges on the package. Privileges granted through a role will be okay.
Usually, (1) is the best solution. Have the table owner(s), or someone with the proper authority, grant privileges directly to you.
By the way, there's no point in having an ORDER BY clause in a sub-query like you're doing, and there's no point in having ORDER BY in an INSERT statement. It's not causing the ORA_00932 error (or any other error), it's just wasting resources.
Edited by: Frank Kulash on Mar 23, 2011 4:02 PM
Change DEFINER to CURRENT_USER in a couple of places. (Bad mistake!) -
Got error in job execution, but the standalone procedure runs fine.
I got error in job execution. But it runs fine as standalone procedure. Where could it be wrong?
_>exec dbms_job.run(145373);
BEGIN dbms_job.run(145373); END;
ERROR at line 1:
ORA-12011: execution of 1 jobs failed
ORA-06512: at "SYS.DBMS_IJOB", line 481
ORA-06512: at "SYS.DBMS_JOB", line 275
ORA-06512: at line 1
I checked the alert log file
ORA-06550: line 1, column 101:
PLS-00103: Encountered the symbol "RPTIMPORT" when expecting one of the following:
:= . ( @ % ;
Thu May 2 12:59:34 2013
Errors in file /oracle/admin/PDAMLPR1/udump/pdamlpr11_ora_15574.trc:
ORA-12012: error on auto execute of job 146925
ORA-06550: line 1, column 133:
PLS-00103: Encountered the symbol "" when expecting one of the following:
:= . ( @ % ;
The symbol ";" was substituted for "" to continue.
The trace file:
*** ACTION NAME:() 2013-05-02 12:43:48.261
*** MODULE NAME:(SQL*Plus) 2013-05-02 12:43:48.261
*** SERVICE NAME:(SYS$USERS) 2013-05-02 12:43:48.261
*** SESSION ID:(1811.10644) 2013-05-02 12:43:48.261
*** 2013-05-02 12:43:48.261
ORA-12012: error on auto execute of job 145373
ORA-06550: line 1, column 133:
PLS-00103: Encountered the symbol "" when expecting one of the following:
:= . ( @ % ;
The symbol ";" was substituted for "" to continue.
*** ACTION NAME:(********* Schedule Job: Report C) 2013-05-02 12:47:58.178
*** MODULE NAME:(PATIENT_REMEDIATE_JOB) 2013-05-02 12:47:58.178
*** 2013-05-02 12:47:58.178
ORA-12012: error on auto execute of job 145373
ORA-06550: line 1, column 133:
PLS-00103: Encountered the symbol "" when expecting one of the following:
:= . ( @ % ;
The symbol ";" was substituted for "" to continue.
*** 2013-05-02 12:52:43.409
ORA-12012: error on auto execute of job 146924
ORA-06550: line 1, column 101:
PLS-00103: Encountered the symbol "RPTIMPORT" when expecting one of the following:
:= . ( @ % ;
*** 2013-05-02 12:59:34.651
ORA-12012: error on auto execute of job 146925
ORA-06550: line 1, column 133:
PLS-00103: Encountered the symbol "" when expecting one of the following:
:= . ( @ % ;
The symbol ";" was substituted for "" to continue.
~
~
The job was created as the following with 30 min interval:
The job number: 145373
DECLARE
X NUMBER;
BEGIN
SYS.DBMS_JOB.SUBMIT
( job => X
,what => 'RPTIMPORT.pr_exec_pop_ddl21_data_irt'
,next_date => to_date(sysdate)
,interval => '/*30:Mins*/ sysdate + 30/(60*24)'
,no_parse => TRUE
SYS.DBMS_OUTPUT.PUT_LINE('Job Number is: ' || to_char(x));
END;
Thanks for help!the issue is resolved. I missed to put ";" at end of what statement. Thank all.
-
Why is my update code running fine yet not actually updating the table?
When I step through this, it runs fine - the call to Commit executes without dropping into the Rollback block. Yet, the grid (and the underlying table) are not updated.
private void buttonUpdate_Click(object sender, EventArgs e)
const int TICKETID_COLUMN = 0;
String _ticketID = Convert.ToString(dataGridView1.CurrentRow.Cells[TICKETID_COLUMN].Value);
UpdateRecord(
_ticketID,
textBoxTicketSource.Text,
textBoxContactEmail.Text,
textBoxAboutLLSID.Text,
textBoxCategoryID.Text);
private void UpdateRecord(string ATicketID, string ATicketSource, string AContactsEmail, string AAboutLLSID, string ACategoryID)
try
con = new OracleConnection(oradb);
con.Open();
String update = @"UPDATE LLS.INTERPRETERTICKETS
SET TICKETSOURCE = :p_TICKETSOURCE,
ABOUTLLSID = :p_ABOUTLLSID,
CATEGORYID = :p_CATEGORYID,
CONTACTEMAIL = :p_CONTACTEMAIL
WHERE TICKETID = :p_TICKETID";
cmd = new OracleCommand(update, con);
cmd.CommandType = CommandType.Text;
// TICKETSOURCE, ABOUTLLSID, CATEGORYID, CONTACTEMAIL, TICKETID
OracleParameter p_TICKETSOURCE =
new OracleParameter("p_TICKETSOURCE", OracleDbType.NVarchar2, ParameterDirection.Input);
p_TICKETSOURCE.Size = 20;
p_TICKETSOURCE.Value = ATicketSource;
cmd.Parameters.Add(p_TICKETSOURCE);
OracleParameter p_ABOUTLLSID =
new OracleParameter("p_ABOUTLLSID", OracleDbType.Int32, ParameterDirection.Input);
p_ABOUTLLSID.Value = AAboutLLSID;
cmd.Parameters.Add(p_ABOUTLLSID);
OracleParameter p_CATEGORYID =
new OracleParameter("p_CATEGORYID", OracleDbType.Int32, ParameterDirection.Input);
p_CATEGORYID.Value = ACategoryID;
cmd.Parameters.Add(p_CATEGORYID);
OracleParameter p_CONTACTEMAIL =
new OracleParameter("p_CONTACTEMAIL", OracleDbType.NVarchar2, ParameterDirection.Input);
p_CONTACTEMAIL.Size = 100;
p_CONTACTEMAIL.Value = AContactsEmail;
cmd.Parameters.Add(p_CONTACTEMAIL);
OracleParameter p_TICKETID =
new OracleParameter("p_TICKETID", OracleDbType.NVarchar2, ParameterDirection.Input);
p_TICKETID.Size = 20;
p_TICKETID.Value = ATicketID;
cmd.Parameters.Add(p_TICKETID);
try
using (var transaction = con.BeginTransaction())
cmd.Transaction = transaction;
cmd.ExecuteNonQuery();
transaction.Commit();
catch (Exception ex)
ot.Rollback();
throw;
MessageBox.Show("Apparent success");
finally
con.Close();
con.Dispose();
dataGridView1.Refresh();
}It's hard to say with the limited information available. Nothing jumps out at me as being "wrong" in your code.
What is the Records Affected return value from cmd.ExecuteQuery?
I tested this and it worked fine for me:
SQL
========
SQL> create table interpretertickets (ticketsource nvarchar2(100),
2 aboutllsid number,
3 categoryid number,
4 contactemail nvarchar2(100),
5 ticketid nvarchar2(100));
Table created.
SQL>
SQL> insert into interpretertickets values(null,null,null,null,1);
1 row created.
SQL> commit;
Commit complete.
/////////////// CODE //////////////////////
private void button1_Click(object sender, EventArgs e)
string constr = "data source=orcl;user id=scott;password=tiger";
OracleConnection con = new OracleConnection(constr);
con.Open();
String update = @"UPDATE INTERPRETERTICKETS
SET TICKETSOURCE = :p_TICKETSOURCE,
ABOUTLLSID = :p_ABOUTLLSID,
CATEGORYID = :p_CATEGORYID,
CONTACTEMAIL = :p_CONTACTEMAIL
WHERE TICKETID = :p_TICKETID";
OracleCommand cmd = new OracleCommand(update, con);
cmd.CommandType = CommandType.Text;
// TICKETSOURCE, ABOUTLLSID, CATEGORYID, CONTACTEMAIL, TICKETID
OracleParameter p_TICKETSOURCE =
new OracleParameter("p_TICKETSOURCE", OracleDbType.NVarchar2, ParameterDirection.Input);
p_TICKETSOURCE.Size = 20;
p_TICKETSOURCE.Value = "newval1";
cmd.Parameters.Add(p_TICKETSOURCE);
OracleParameter p_ABOUTLLSID =
new OracleParameter("p_ABOUTLLSID", OracleDbType.Int32, ParameterDirection.Input);
p_ABOUTLLSID.Value = 123;
cmd.Parameters.Add(p_ABOUTLLSID);
OracleParameter p_CATEGORYID =
new OracleParameter("p_CATEGORYID", OracleDbType.Int32, ParameterDirection.Input);
p_CATEGORYID.Value = 456;
cmd.Parameters.Add(p_CATEGORYID);
OracleParameter p_CONTACTEMAIL =
new OracleParameter("p_CONTACTEMAIL", OracleDbType.NVarchar2, ParameterDirection.Input);
p_CONTACTEMAIL.Size = 100;
p_CONTACTEMAIL.Value = "[email protected]";
cmd.Parameters.Add(p_CONTACTEMAIL);
OracleParameter p_TICKETID =
new OracleParameter("p_TICKETID", OracleDbType.NVarchar2, ParameterDirection.Input);
p_TICKETID.Size = 20;
p_TICKETID.Value = 1;
cmd.Parameters.Add(p_TICKETID);
using (var transaction = con.BeginTransaction())
cmd.Transaction = transaction;
int recaff = cmd.ExecuteNonQuery();
MessageBox.Show("records affected: " + recaff);
transaction.Commit();
}
Maybe you are looking for
-
As of last week, our Windows 7 Pro workstations can not map or browse the Windows 2008 Server shares. They can ping the Windows 2008 server. The Windows 7 Pro machines can still access the Windows 2003 Server Shares. The older workstations running Wi
-
How to populate auditory coumns in jhs application???
Hi, I have an application with: JDeveloper 10.1.2 Jheadstart 10.1.2 How to populate auditory coumns for create by and modified by ??? ...For the created on and modified on, run correctly... * I have a login page (jsp: user and password textbox) * I p
-
Windows 8.1 Update 1 Kiosk Mode difference
We have a number of stations running modern IE on Windows 8.1 in Kiosk Mode. I ran the in-place upgrade on a few of them to test Windows 8.1 Update 1. Everything runs fine except that hitting the Windows key 5 times no longer takes you to the login
-
Why isn't my site working on mobile?
My site -- blueivorycreative.com -- was uploaded to an FTP host and has been working perfectly both in my computer web browser and on my phone. However, we are now unable to pull up the site on any mobile phone. I contacted my hosting service and t
-
How can I make a setting so that new tabs bring up my home page?
When I open a new tab I get this lame empty page. I want my home page to come up! I know I can just click on the home button to do this but how can I set up Firefox to do it automatically? PS when first opening Firefox there is no problem - home page