How to refresh Materialized View using DB link in Oracle - oracle

I have 3 schemas in Oracle. There's a Materialized View in the 3rd schema which I need to refresh from the 1st schema.
Below is the elaboration of the requirement:
uv1 (1st schema) --> db link to nwdb2 (2nd schema) --> nwdb3 (3rd schema) --> emp_de_mv (MV)
I need to refresh the emp_de_mv from uv1.
I'm already executing a SELECTstatement on MV from uv1 as follows, which is working successfully:
SELECT * FROM nwdb3.emp_de_mv#nwdb2;
I tried refreshing the MV from uv1 as follows as suggested here.
EXEC DBMS_MVIEW.refresh('nwdb3.emp_de_mv#nwdb2', 'C');
But it's giving me following error:
Error starting at line : 25 in command -
EXEC DBMS_MVIEW.refresh('nwdb3.emp_de_mv#nwdb2', 'C')
Error report -
ORA-20000: ORA-00979: illegal reference to remote database
ORA-06512: at "SYS.DBMS_SNAPSHOT", line 2809
ORA-06512: at "SYS.DBMS_SNAPSHOT", line 3025
ORA-06512: at "SYS.DBMS_SNAPSHOT", line 2994
ORA-06512: at line 1
20000. 00000 - "%s"
*Cause: The stored procedure 'raise_application_error'
was called which causes this error to be generated.
*Action: Correct the problem as described in the error message or contact
the application administrator or DBA for more information.
Can anyone help me with above requirement?
Please note, I won't be able to create new DB link in uv1 due to security reasons.

ORA-20000: ORA-00979: illegal reference to remote database
You get this error message because, as the documentation for refresh() states:
"These materialized views can be located in different schemas and have different master tables or master materialized views. However, all of the listed materialized views must be in your local database."
The solution is to execute the refresh on the remote database, by invoking DBMS_MVIEW across the database link:
EXEC DBMS_MVIEW.refresh#nwdb2('nwdb3.emp_de_mv', 'C');
how am I able to access nwdb3 from nwdb2 directly, without DB link & why can't I access nwdb2 directly from uv1, without DB link?
It's your environment so I don't - can't - know the architecture. You describe nwdb2 as a schema but also describe it as a database link. I'm guessing you have a database link called nwdb2 which connects to a schema also called nwdb2 that has privileges on another schema nwdb3 in the remote database server. On the remote server nwdb2 can reference objects in nwdb3 schema without a database link because those schemas are local to each other. But nwdb1 must use a database link because it is not local to either schema.

Related

How creating a new database schema for an Oracle 18c XE installation

I've an Oracle 18c XE installation on my machine.
I've tried to create a new schema, but unsuccessfully.
I've used these statements:
CREATE SCHEMA test
CREATE SCHEMA test AUTHORIZATION test
but I've always the same error:
Report error -
02420. 00000 - "missing schema authorization clause"
*Cause: the AUTHORIZATION clause is missing from a create schema
statement.
*Action: Preceed the schema authorization identifier with the
AUTHORIZATION keyword
I've also tried to specify: CREATE SCHEMA AUTHORIZATION test
but I've this error:
Report error -
02421. 00000 - "missing or invalid schema authorization identifier"
*Cause: the schema name is missing or is incorrect in an authorization
clause of a create schema statement.
*Action: If the name is present, it must be the same as the current
schema.
I cannot to create a new user.
Now, can I create a schema and/or an user in Oracle 18c XE installation?
Thanks
To create a user that can then do the "usual" stuff like create tables and the like, you use the CREATE USER command and assign some privs. The following should suffice:
create user DEMO
identified by MySuperCoolPassword;
grant RESOURCE, CONNECT to DEMO;
alter user DEMO quota unlimited on USERS;
If you only want to do this with the GUI in SQL Developer, here's a complete video walkthrough
https://www.youtube.com/watch?v=WDJacg0NuLo

Experiencing issues using DBMS_CLOUD.GET_OBJECT in oracle cloud infrastructure Autonomous Database serverless

I am trying to create a DB Link between 2 Autonomous databases (Serverless) in OCI
List of steps i followed
I created the necessary credentials for the user using dbms_cloud.create_credential
Now, i try to upload the Wallet file (which i have stored in Object storage) using "dbms_cloud.get_object". It produces the following error
ORA-20000: ORA-29283: invalid file operation: nonexistent file or path [29434]
ORA-06512: at "C##CLOUD$SERVICE.DBMS_CLOUD", line 983
ORA-06512: at "C##CLOUD$SERVICE.DBMS_CLOUD", line 2622
ORA-06512: at line 2
If i use the wrong credential or if i change the uri, the error that the system produces are different. I believe oracle is able to get to the object, yet it produces this error.
Any ideas?
DBMS_CLOUD.GET_OBJECT supports ability to read data from an object store file and return the contents as a BLOB, or save the contents to a file in the given directory object in your Autonomous Database.
https://docs.oracle.com/en/cloud/paas/autonomous-database/adbsa/dbms-cloud-subprograms.html#GUID-3DB888C9-18C7-4A26-8DA8-EDFB260E2B14
It seems that you are trying to download a Wallet file to directory object for creating a database link. Autonomous Database automatically provisions a database file system to store files. Although the exact SQL syntax is not posted, but the error indicates that the syntax is correct. The error appears like the database file system is not accessible, and it is an internal error for the service.
You could workaround the issue by restarting the Autonomous Database. As this is an old question, the issue could be automatically addressed by now with automatic maintenance of Autonomous Database.
Out of curiosity, what region are you experiencing this in? Free tier or paid?
Ultimately, there is nothing wrong with your syntax used or a wrong usage. Unfortunately the issue you're experiencing is likely an internal error/bug, and can be fixed by OCI ops. I highly recommend submitting a service request.
If you have not submitted one in the past, you can read up on how to here - https://docs.cloud.oracle.com/en-us/iaas/Content/GSG/Tasks/contactingsupport.htm#3Openasupportservicerequest

Getting the writable operation error while using oracle cdc

I am getting the following error while connecting through oracle cdc client and my origin database is read only database but the error is database required for writable operation. please help
Caused by: java.sql.SQLException: ORA-01300: writable database required for specified LogMiner options
ORA-06512: at "SYS.DBMS_LOGMNR", line 58
ORA-06512: at line 1
This is a limitation of LogMiner itself - the LogMiner dictionary requires write access to the database for all modes except Extracting the LogMiner Dictionary to a Flat File, which does not guarantee transactional consistency. Oracle recommends using the online catalog or extracting the dictionary from redo log files, which are the options that Data Collector offers.
See the Oracle LogMiner documentation.

RedGate loading oracle tables metadata fails

I’m using Redgate Data Compare for Oracle 5. I’ve (successfully) created Source and Target connections (both Oracle 11g), defined schema names on both side, then switched to "Tables & Views" tab. There was Initializing process popped-up, like connecting to db, populating metadata from oracle tables etc. and get list of tables from both connections. Later, I switched back to “main” screen "Data Sources" and changed one of the connections to another database (Oracle 12c). This time "Tables and Views" initialization failed with bunch of ORA errors.
ORA-19202: Error occurred in XML processing ORA-29913: error in
executing ODCIEXTTABLEOPEN callout ORA-29400: data cartridge
error KUP-04040: file PSImetalsParameters.csv in TEST not
found ORA-06512: at "SYS.DBMS_XMLGEN", line 288 ORA-06512:
at "SYS.DBMS_XMLGEN", line 237 ORA-06512: at "SYS.DBMS_XMLGEN",
line 280 ORA-06512: at line 1
(I have doubt that it may be some privileges issue for that user/schema. But not sure which Oracle tables or schemas RedGate needs to access.)
Any help on it?

jdbc connection error-java.sql.SQLSyntaxErrorException: ORA-00942: table or view does not exist

I have a user in oracle, if I am selecting some data with the user in sqldeveloper its working fine
But when I am trying to connect to the same database and with the same username and password, I am getting error as java.sql.SQLSyntaxErrorException: ORA-00942: table or view does not exist
I can see the table exists in the database as I can query via sqldeveloper.
I tried searching forums but no answer yet. Do I need to give special permission to the user when connecting from Java (basically Java program using eclipse)

Resources