I am getting the error while deleting user from oracle db. The error message is not very helpful to diagnose this issue. Please let me know if you are aware of this issue.
SQL> drop user sshil_lrg_2 cascade;
drop user sshil_lrg_2 cascade
*
ERROR at line 1:
ORA-00604: error occurred at recursive SQL level 1
ORA-00942: table or view does not exist
ORA-06512: at line 36
The problem in most Oracle installations is a missing system table.
Oracle attempts to drop a non-existent system table during the CASCADE operation of dropping all of the user's objects.
SOLUTION:
Create the missing table in the Oracle instance.
See: https://community.oracle.com/thread/1048567?tstart=0
Then attempt the DROP USER {name} CASCADE command again.
Was able to successfully reproduce this error in a plain-vanilla Oracle install with no specific triggers created. This solution resolved the problem.
The error message ORA-00942: table or view does not exist indicates that some software tries to execute something like drop table I_DO_NOT_EXIST. However, you are not dropping a table but a user.
Looking better at the error message, you will also see ORA-00604 and line 36. This is indication that your original SQL statement caused other SQL (ORA-00604) and PL/SQL (line 36) to be triggered.
Probably you have a database trigger that executes on DDL statements. Check the contents of user_triggers of the user sys and disable/debug these trigger.
Writing a good trigger that fires on DDL is non-trivial, since you need to ensure that you don't lock yourself out ever.
Related
I have two database HB and DSHB. I am trying to create REFRESH FAST ON DEMAND materialized view in DSHB schema wherein HB is remote schema using dblink with following code,
CREATE materialized view MV_HB_SYSTEM
BUILD IMMEDIATE
REFRESH FAST
ON DEMAND
WITH PRIMARY KEY
AS
SELECT DELETED, SYS_NO FROM HB.HB_SYSTEM#HBLINK;
But getting following error in creation,
SQL Error: ORA-12018: following error encountered during code generation for "HB"."MV_HB_SYSTEM"
ORA-00942: table or view does not exist
But on running query " SELECT DELETED, SYS_NO FROM HB.HB_SYSTEM#HBLINK;" in separate connection works perfectly.
I have also created Materialized View Log with following code,
CREATE Materialized View Log ON HB_SYSTEM;
I have found in some forum that SELECT privilege on Materialized View Log needs to be granted as mentioned below,
GRANT SELECT ON MLOG$_<tableName> to DSHB;
where DSHB is the account that will accessing the log (ie via the db link).
But when i run this command from HB schema i am getting error stating DSHB user or role is unavailable in HB and i am unable to grant SELECT on Materialized View Log in HB schema. Is it possible to directly grant SELECT privilege to dblink from remote schema? i mean something like below query from HB schema. I tried but didnt work.
GRANT SELECT ON MLOG$_<tableName> to HB.HB_SYSTEM#HBLINK;
Please suggest how to resolve ORA-00942 error and create REFRESH FAST ON DEMAND materialized view.
I am trying to add an control to my page. I am following the wizard. Step 1, I select my connection string. The connection works, no error messages. Step 2, I choose "Specify a custom SQL statement or stored Procedure" radio button. Step 3, in the "SELECT" tab I click the "Stored Prodedure" radio button, then select the stored procedure I would like to use. I take this as confirmation that the connection string is working. Step 4, I press the "Test Query" button.
A pop up appears with the message "There was an error executing the query. Please check the syntax of the command and if present, the types and values of the parameters and ensure they are correct. Could not find stored procedure .
I've tested the procedure in SSMS, and it works. I took the query string that is in the stored procedure and changed the radio from Step 3 to "SQL Statement" and pasted the string into the box. The statement worked fine.
I also changed the permissions for the login specified in the connection string to the same permissions I have on the server. (Full admin rights!) That did not correct the issue. I only found a few questions in the forums regarding this issue, and they all pointed to permission issues, but I have ruled that out as I set the permissions.
The Wizard can find the procedure when I am walking through the Wizard, but it can't find it when I test.
I hope someone can point me in the right direction... Thanks!
* EDIT *
Just to expand on the #BlackjacketMack's answer:
When I use the wizard to create the SqlDataSource, and select the Stored Procedure from the the list, it appears that VS is defaulting to the dbo schema at runtime, even though it displays all the sprocs in each schema. (I verified this by changing the schema the sproc was on to dbo and testing it. The results were returned with no errors.) Within the wizard, I do not see any options to change the schema. If I click the "SQL Statement" radio button and type EXECUTE [APP001].[MyStoredProcedure], it works perfectly. I did try the GRANT EXECUTE as #otaku recommended, but that did not work. I also changed the default schema for the user specified in the connection string to [APP001] to no avail. So this appears to be an issue when using the dropdowns in the wizard. Manually entering the data so that the schema can be fully qualified did the trick!
Make sure the application that you are running have the appropriate grant execute on the database objects. Sometimes they are tied to a database role such as below where the stored procedure need to have the execute permission:
GRANT EXECUTE ON ][dbo].[MyStoreProc] TO U_ExecuteProcs
Qualify your procedure with the schema If the proc has a schema 'APP001' as you indicated in a comment, make sure the Sql being passed looks something like EXEC APP001.YourStoredProcedureName.
Use a profiler! One great way to approach this problem is run a profiler on your SQL...either the MS Profiler, or we use http://anjlab.com/en/projects/opensource/sqlprofiler which used to be free. Basically, you'll see exactly what SQL your application is sending and who the login they're sending it as.
If you gave yourself admin permissions as you indicated, I wouldn't define too many object specific permissions simply because they tend to go unmaintained.
I think defining the execution context within your stored procedure will resolve the issue , Here is the link:
http://technet.microsoft.com/en-us/library/ms188354.aspx
I have a table Product which have Quantity column, This table get updated thru .net application using Stored procedure based on flag variable. Now im having problem reported from user that even though the flag variable is not set table is getting updated with new values.
Now i need to isolated the cause for the issue.How will i check which update and through which application this table is getting modified. I have no idea about it.
What is the best approach to resolve this issue?
Assuming you are using SQL Server:
You can monitor calls to SQL Server using SQL Server Profiler. You can setup a filter to monitor queries affecting the Product table. The log will show what the query looked like, when the query was executed, the database user executing the query, the name of the application (if that is specified in the connection string) and a bunch of other things.
So I have a stored procedure that does the following (modified out the data params):
ALTER TABLE dbo.ReceiptInfo NOCHECK CONSTRAINT Credits_ReceiptInfo_FK1;
UPDATE ReceiptInfo SET CreditAccount=#CreditAccount WHERE CreditAccount=#OriginalAccount;
ALTER TABLE dbo.ReceiptInfo CHECK CONSTRAINT Credits_ReceiptInfo_FK1;
This is all in a stored procedure, which runs perfectly fine when I execute it from management studio but skips the alter constraints when called from ASP.net. I know it's at least executing the stored proc, because I get a message saying the update conflicted with the constraint.
For the record, I know this could all be solved by ON UPDATE CASCADE, but that option was rejected by upper management.
When you use Management Studio to execute a stored procedure, that is done under your account that presumably has admin rights.
When you execute the sp from asp.net, you probably use another account, that is not allowed to do this.
I have a Web site live and running now. I am using the Subsonic to handle the database connections etc.
I am getting time out expired error while updating a table (say Employee). When I check sp_who2, I see the suspended connection for the PID which is updating with a block by anothor pid, so I run the profiler and found out when ever this suspended connection occur, the blocked pid is a select statement on the view (say ActiveEmployees, which is the same as the table but with some where conditions).
Anyone know why a Select statement on the view could cause failure in update. If it is other (like select fails due to update) may be reasonable.
Is there any way for me to make select on a view without locking the table?
PS: I am using the Sql server 2005 and subsonic 2.2.
You might add with(nolock) hint to the select statement in the view if you don't care about accuracy of the returned data (it will return uncommited rows possibly).
We encountered timeouts also when the select statements where scanning a table that other thread was inserting into. I resolved the issue by adding appropriate index that is used by our select.