Unable to create REFRESH FAST ON DEMAND materialized view - oracle11g

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.

Related

Asp.net Register Stored Procedure gives error

I am using asp.net 4.6.1 and am unable to create an account via Register Page.
The stored procedure aspnet_Membership_CreateUser gives the following error:
The conversion of a datetime data type to a smalldatetime data type resulted in an out-of-range value.
The statement has been terminated.
I have tried googling it but have failed to find the solution to it.
The same functionality works fine locally creating an account on my local Sql db.
But does not create the account on server db.
Yep Buddy! Got that Fixed!
I was right about the aspnet_membership table.
Instead of importing membership and identity records, I had to create new entries in membership tables.
This time the Register page was able to create the User Account.
Thanks for being patient though, buddy..
Jamshaid Kamran, you kept my juices running.

OrientDB Console.bat errors out with invalid username password for drop database command

Using the OrientDB Console.bat for manage oreient-db databases shows some inconsistent behaviour.
1) I created a new db named demox using the below command :
orientdb> create database plocal:../databases/demox root root plocal graph
Creating database [plocal:../databases/demox] using the storage type [plocal]...
2018-04-12 19:10:26:775 INFO Storage 'plocal:../databases/demox' is
created under OrientDB distribution : 2.2.33 (build 77584cd6827f647cf4aa231cf27bd6f10bc04e2c, branch 2.2.x)
Database created successfully.
Current database is: plocal:../databases/demox
2) Next i try to run the drop database command and it errors out saying invalid username or password
orientdb {db=demox}> drop database plocal:../databases/demox root root
Error: com.orientechnologies.orient.core.exception.OSecurityAccessException: User or password not valid for database: 'demox'
DB name="demox"
orientdb {db=demox}>
However If you see the credentials used in step1 and step2 both are same.
I am not sure where the issue is , or am i missing something in the drop database command.
Why would the console error out even when i am using the same credentials for drop-database command as the one i have used while creating the database
use the same command but with the credentials of admin (user:admin pass:admin)
drop database plocal:../databases/demox admin admin
If you have any more questions about this feel free to ask.

Not able to delete user in Oracle DB

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.

Dynamic Data Entities Web Application Handle delete statement conflicted

I've created an ASP.NET Dynamic Data Entities Web Application project with visual studio 2010.
I've added a ADO.NET Entity Data Model connected to a sql Server database.
The application works fine.
I'd like to handle an exception when deleting a row in a table that has a column which is a foreign key for another table.
The exception is :
The DELETE statement conflicted with the REFERENCE constraint "FK_name". The conflict
occurred in database "NAME", table "dbo.dbname", column 'Column_name'.
What I'd like to do is display a user friendly message to explain that the operation cannot be made before other rows in other table are delete.
I did some step by step debugging, but I can't find where the application does the database request, so that I can customize the code.
Thanks.
I did some research and i found two options :
- I can handle the delete directly with gridview attribute OnRowDeleting. This mean a lot of entity manipulation
- I can handle entity framework SavingChanges and check for entities on EntityState.Deleted, then check entity navigation properties and throw an explicit message if necessary. This works with a custom validation error to show user friendly message.

Restoring a database into a different instance of tridion

I have got most of the way but there seems to be a permissions issue somewhere:
Before the restore everything is working fine in my target environment - target has a server login account TCMDBUser which is mapped to my tridion_cm database user TCMDBUser
My source tridion_cm database has user TCMDBUser_DEV.
After restoring the source .bak into my target TCMDBUser_DEV is orphaned.
I edit the TRUSTEES table to correct MTSUser and my admin log accounts for my target environment and run the following to fix up my orphaned database user:
sp_change_users_login #Action='update_one',
#UserNamePattern='TCMDBUser_DEV',
#LoginName='TCMDBUser'
GO
I can log back in to Tridion explorer and see the expected list of publications and can walk through the tree structure but when I come to a folder which should contain items I see nothing with error:
and the corresponding event log error is:
Unable to get list of SDL Tridion Content Manager items.
DESCRIPTION
Error Code:
0x80040000 (-2147221504)
Call stack:
System.Data.ProviderBase.FieldNameLookup.GetOrdinal(String)
System.Data.SqlClient.SqlDataReader.GetOrdinal(String)
System.Data.SqlClient.SqlDataReader.get_Item(String)
Tridion.ContentManager.Data.AdoNet.DatabaseUtilities.ConvertToFieldDictionary(IDataRecord,IDictionary`2)
Tridion.ContentManager.Data.AdoNet.IdentifiableObjectDataMapper.Read(TcmUri,IDataRecord,IDictionary`2)
Tridion.ContentManager.Data.AdoNet.ContentManagement.OrganizationalItemDataMapper.GetListItemsPost(IDataReader,TcmUri,OrganizationalItemItemsFilterData)
Tridion.ContentManager.Data.AdoNet.ContentManagement.OrganizationalItemDataMapper.Tridion.ContentManager.Data.ContentManagement.IOrganizationalItemDataMapper.GetListItems(TcmUri,OrganizationalItemItemsFilterData)
Tridion.ContentManager.ContentManagement.OrganizationalItem.GetListItemsData(OrganizationalItemItemsFilter)
Tridion.ContentManager.ContentManagement.OrganizationalItem.GetListItemsStream(OrganizationalItemItemsFilter)
Tridion.ContentManager.BLFacade.ContentManagement.OrganizationalItemFacade.GetListItemsXml(UserContext,String,ListFilter,ListColumnFilter)
Tridion.ContentManager.BLFacade.ContentManagement.OrganizationalItemFacade.GetListData(UserContext,String,EnumListKind,ListColumnFilter,String)
Folder.GetListItems
You will need to delete/drop the TCMDBUser_DEV form the DB and then create a new one with the same name and password (or reattach it to your cm DB). That should fix your problem.
I normally use the delete method with MS SQL server. I believe this occurs due to the ownership status that the TCMDBUser has on the database Schema.
When complete your TCMDBUser user should have the following permissions on your Tridion_CM database
Like Chris mentioned, I always drop the user from the database and then assign the existing TCMDBUser in SQL Server the rights to the restored database. You can drop the user with the following command (on the restored database):
EXEC sp_dropuser TCMDBUser
Then through the SQL Server - Security - Logins, you request the properties of your TCMDBUser and in the User Mapping add the following database roles: db_datareader, db_datawriter and db_ddladmin.
That's what I've always done in the past and works for me, not sure if its all required, but worth a try I guess
Try creating new user TCMDBUser in the database and run the following command
EXEC sp_change_users_login 'Update_One', 'TCMDBUser', 'TCMDBUser'

Resources