aspnet_regsql SQLCACHEDEPENDENCY - sqlcachedependency

I have created a datatbase "testschema" and schema called "MySchema". I have
created a table "MySchema.table1" in the database. I am trying to create sql
cache dependancy on table using aspnet_regsql utitlity.
MySchema.Table1
But it throw an error.
Enabling the table for SQL cache dependency.
An error has happened. Details of the exception:
Cannot create trigger
'dbo.MySchema.Table1_AspNet_SqlCacheNotification_Trigger'
as its schema is different from the schema of the target table or view.
Failed during cache dependency registration.
Please make sure the database name and the table name are valid. Table names
mus
t conform to the format of regular identifiers in SQL.
The failing SQL command is:
dbo.AspNet_SqlCacheRegisterTableStoredProcedure
I have tried with out schema name and again it is failed. Pl. let me know
what's wrong creating dependancy on table?

Found it !
http://forums.asp.net/t/1249281.aspx/1
The problem occured if you have more other schema on your db (other than [dbo])
after the change made to the sp AspNet_SqlCacheRegisterTableStoredProcedure
to select the schema dynamically it worked!
Thank you Vivek

Related

Oracle Apex 19.2: Cannot resolve the "schema is reserved or restricted" issue

I attempted to create a workspace in APEX using an existing schema called PEOPLE and it gave the error message "The schema is reserved or restricted". I tried with other existing schemas that I created and they all worked fine.
Technical/Environment details follow:
Database: Oracle 19c EE installed on local machine.
Apex: 19.2 installed as Embedded Gateway on local machine.
Created pluggable database called PDB1.
Created tablespace PEOPLE_TAB using OMF (Oracle Managed Files) syntax.
Created local user PEOPLE in PDB1.
Gave PEOPLE the following roles and privs (I'm aware some are doubled up like RESOURCE role and CREATE SESSION priv):
RESOURCE
UNLIMITED TABLESPACE
SELECT_CATALOG_ROLE
CREATE SESSION
CREATE TABLE
CREATE TYPE
CREATE CLUSTER
CREATE TRIGGER
CREATE PROCEDURE
CREATE SEQUENCE
CREATE VIEW
CREATE DIMENSION
CREATE JOB
CREATE SYNONYM
CREATE DIMENSION
CREATE MATERIALIZED VIEW
I created another user TEST1 in the same tablespace PEOPLE_TAB, with the same privs as PEOPLE and re-created the objects and data. I could successfully create a workspace using this new schema!
Trawled the web, but most articles and posts refer to older versions of APEX, but I still tried the following.
I followed the advice given in the Oracle docs, Application Express Release 19.2 Adminstration Guide section 2.13
The APEX engine schema for APEX 19.2 is APEX_190200. So I unlocked APEX_190200 and logged in (after changing password) to run the checks.
-- Checked if PEOPLE was a restricted schema
SELECT schema FROM APEX_190200.wwv_flow_restricted_schemas order by schema;
PEOPLE is not listed and I assume is not restricted. So I tried to unrestrict PEOPLE anyway as detailed in the docs.
-- ran from APEX_190200
EXEC APEX_INSTANCE_ADMIN.UNRESTRICT_SCHEMA(p_schema => 'PEOPLE');
COMMIT;
Successfully ran but did not resolve the issue.
Looking on the web most of the info was out of date but tried anyway.
-- ran from APEX_190200
EXEC APEX_SITE_ADMIN_PRIVS.UNRESTRICT_SCHEMA(p_schema => 'PEOPLE');
COMMIT;
The above did not run and complained the package didn't exist. I verified that when looking for APEX_SITE_ADMIN_PRIVS in user_objects - it was not there.
Some years ago there was a bug with the function wwv_flow_provision.IS_RESERVED, but I checked this and it ran ok returning FALSE for PEOPLE and TRUE for reserved words like VARCHAR.
It's really thrown me when I can create an identical user (different name) with identical privs, objects and data was created on the same tablespace and it worked fine with an APEX workspace.
Does anyone have any experience of resolving this issue or point me in the right direction?
Thank you.
You are receiving the error because PEOPLE is specified as a restricted schema with an APEX package.
In the installation scripts for APEX 19.2, the file named f4050.sql has a page validation on page 79 (the page that is raising the error) that looks like this:
...
...
...
wwv_flow_api.create_page_validation(
p_id=>wwv_flow_api.id(114752711027135415)
,p_validation_name=>'schema not reserved/restricted'
,p_validation_sequence=>80
,p_validation=>wwv_flow_string.join(wwv_flow_t_varchar2(
'wwv_flow_provision.schema_name_valid(',
' p_schema => :F4050_P79_SCHEMA,',
' p_workspace_name => :F4050_P27_COMPANY);'))
,p_validation_type=>'PLSQL_EXPRESSION'
,p_error_message=>'Schema is reserved or restricted'
,p_when_button_pressed=>wwv_flow_api.id(12559200978895311)
,p_error_display_location=>'INLINE_WITH_FIELD_AND_NOTIFICATION'
);
...
...
...
Then using a procedure block like this, you can determine if the schema name is valid or not:
BEGIN
IF apex_190200.wwv_flow_provision.schema_name_valid (p_schema => 'PEOPLE',
p_workspace_name => 'PEOPLE')
THEN
DBMS_OUTPUT.put_line ('Valid');
ELSE
DBMS_OUTPUT.put_line ('Invalid');
END IF;
END;
/
Then by unwrapping the code in those packages (tools can be easily found online). Within that code, there is a call to another function named WWV_FLOW_PROVISIONING.RESERVED_SCHEMA (P_SCHEMA => P_SCHEMA). Within that function, there is code that looks like this:
IF C_SCHEMA IN (
'HTMLDB_PUBLIC_USER',
'APEX_PUBLIC_USER',
'PUBLIC_USER',
'FLOWS_FILES',
'SCHEDULER',
'PEOPLE') THEN
RETURN TRUE;
END IF;
So without modifying the package WWV_FLOW_PROVISIONING (which I would highly recommend AGAINST), you will not be able to create an APEX workspace with the schema name PEOPLE. This will need to be fixed by Oracle either through a patch to the package or in a newer version of APEX.
Fascinating issue. The restricted schema is hard-coded in APEX provisioning code. It's very much a legacy issue.
We can attempt to fix this in the next release of APEX, but that won't help you now. If you file a Service Request for Oracle Support, I'll make sure you get a fix for this issue (assuming you're using a supported version of APEX).

Unable to see error description in SQL plus

I am new to oracle and using SQL plus terminal to access oracle DB. I tried to create one function and it returned warning that
function created with compilation error
When I executed show errors it always showing
ERROR:
ORA-00942: table or view does not exist
My function :
create or replace function axsaum.get_name
AS
v_name varchar2(20);
begin
v_name:='Helloooooo';
dbms_output.put_line(v_name);
END;
/
Please suggest.
You have the error message: ORA-00942: table or view does not exist. This means your function contains a reference to a database object which the compiler is unable to associate to a table or view within the scope of the function.
There are several reasons why you might get this.
Your function references a table or view which exists in the schema but you have misspelled its name.
Your function references a table or view which exists in a different schema and you have not prefixed the reference with the owning schema and there is no synonym either.
Your function references a table or view which exists in a different schema but the schema owner has not granted you rights on that object.
Your function references a table or view which exists in a different schema and the schema owner has granted you rights on that object through a role. The Oracle security model means that we cannot build database objects (views, stored procedures, etc) using privileges granted to our account through a role. The privileges have to be explicitly granted to our named account.
The object does not exist in your schema or another.
The first two causes are ones you can fix by yourself. The others would require the intervention of the schema owner, or a power user with admin privileges (such as a DBA).
Now that you've posted your function, we can see that you are referencing an Oracle built-in package, DBMS_OUTPUT. Now that package should be installed and granted as part of a default install. But if you have a non-standard install or have accidentally dropped or revoked something you will need to get the SYS user to run the dbmsotpt.sql script which should fix it. The details are covered in the package's documentation. Find out more.

entity framework error after attached .mdf file

I attached an .mdf file in SQL Server 2008 and used that database for my entity framework database first project. Below is the error I got
Exception Details: System.Data.MappingException: Schema specified is not valid.
Error 2062: No mapping specified for instances of the EntitySet and AssociationSet in the EntityContainer"
I tried this link: How do I correctly set an association between two objects in the Entity Framework 4 Entitydesigner?
but it did not work for me. can anyone help me what can be the problem.
thanks,
michaeld
This exception usually occures if you have an entity in your model which doesn't mapped to a table (or an object) into the Database.
If you want that your project just starts debugging, Remove all entities from your model, Right-click in model designer and choose Update model from database
If you have an entity which it supposed to be mapped to a table into database, you should create a relative table in database, and map your entity to that table. You also can ghange your approach from db-first to code-first and enable migrations so that EF updates your db according to your model.
If you have an entity and you want to map it to a stored procedure in your db, see here

MVC3 EDMmetadata table not found

I am new in MVC3 i am going to create a MVC3 test project where i am create model class name WhiteAccount with ID,Name,Email,Password property. and successfully create a DB but when i add another new property in that WhiteAccount model class and in my DB table too but it give me some error. Some people say just delete the EDMmetadata table from your DB, But Here is the problem i have no EDMmetadata table in my DB ! I create my DB by EntityFramework v4.3.1 system automatically (CodeFirst). What should i do now ?
Check for the __MigrationHistory table.
Open the nuget package manager console and run
update-database -script
It will likely give you a message about having to enable it first, follow those directions
Run: Enable-Migrations
some more info on migrations
http://blogs.msdn.com/b/adonet/archive/2012/02/09/ef-4-3-code-based-migrations-walkthrough.aspx
Im gathering this table is there in your db (under system tables) and it contains your model information. Since your project changed you need to tell the migrations about the new field or delete the table (__MigrationsHistory)

InnerException {"Invalid object name 'dbo.Users'"}

I am currently trying to setup an ASP.Net MVC 3 Application for the first time. I know what I am doing with Ruby on Rails but completely lost with ASP.Net. I would like the app to create the database but not sure what I am doing wrong. I have an empty Database build called ssDB. I have setup the connectionStrings and built out the Model classes. According to everything I have read thus for, when I go to the run the App it should create the database but it doesn't look that way.
The Abbreviated Error I get is:
InnerException: System.Data.SqlClient.SqlException
Message=Invalid object name 'dbo.Users'.
Source=.Net SqlClient Data Provider
ErrorCode=-2146232060
Class=16
LineNumber=1
Number=208
Procedure=""
Server=TESTSVR01
State=1
I have an empty Database build called ssDB
You have created an empty database with no tables. Since there is a database EF assumes tables are also created. Hence it will not proceed to create the tables.
You can drop the database and allow EF to create the database and the tables.
I also experienced the same issue while using Database first approach. Connection string in my service's/service's host web.config was incorrect. I corrected the connection string and it worked.

Resources