Database Link ORA-01017: invalid username/password; logon denied - streaming

Please help with this database link error i have been struggling for 2 days, Btw, fix this with get my oracle stream works. Stream error: WAITING FOR INACTIVE DEQUEUERS". Checked problem comes from db-link, so here is the problem:
--user: sys
--environmentL appuat1
CREATE PUBLIC DATABASE LINK "ANAUAT0" USING 'anauat0
--user: STRMADMIN_FORM
--environmentL appuat1
CREATE DATABASE LINK ANAUAT0
CONNECT TO "STRMADMIN_FORM" IDENTIFIED BY "STRMADMIN_FORM"
USING 'anauat0';
--user: STRMADMIN_FORM
--environmentL appuat1
select * from STRMADMIN_FORM.Table#'anauat0;
ERROR:
ORA-01017: invalid username/password; logon denied
ORA-02063: preceding line from ANAUAT0
01017. 00000 - "invalid username/password; logon denied"
Question1: Given that username & password are correct, what is the problem?
--user: SYS
--environmentL appuat1
select * from STRMADMIN_FORM.Table#'anauat0;
ERROR:
ORA-28000: the account is locked
ORA-02063: preceding line from ANAUAT0
28000. 00000 - "the account is locked"
*Cause: The user has entered wrong password consequently for maximum
number of times specified by the user's profile parameter
FAILED_LOGIN_ATTEMPTS, or the DBA has locked the account
*Action: Wait for PASSWORD_LOCK_TIME or contact DBA
Question 2: Checked no account are locked, what is locked?
From the other way round can select table using opposit direction Db-link.
update: a trade of to prevent error is to use tns information :
CREATE DATABASE LINK "ANAUAT0"
CONNECT TO "STRMADMIN_ADM" IDENTIFIED BY "STRMADMIN_ADM"
USING '(DESCRIPTION=
(ADDRESS=
(PROTOCOL=TCP)
(HOST=xx.xx.xx.xxx)
(PORT=1521)
)
(CONNECT_DATA=
(SERVICE_NAME=anauat0)
)
)';
But using service name is what I want to do. Obviously service name is cause of problem (the service name is working fine)
Thanks!!

Somebody added a same name TNS on the server cause comflict.
Thanks!

Related

Postgres dblink: Getting "[2F003] ERROR: password is required Detail: Non-superusers must provide a password in the connection string."

When I try to run the following query, I get the following error message, and so my dblink queries are failing. All the hosts, roles, network connections and usernames have been set up correctly, yet it is not working.
select abc from dblink(
'port=5439 host=some_dbhost.mycompany.com dbname=my_db username=my_user password=<...>',
'select 1 as x') as t1 (abc int);
[2F003] ERROR: password is required Detail: Non-superusers must provide a password in the connection string.
No, there IS a password. What's going on?
This error message is TOTALLY misleading.
The REAL error is that the username was incorrectly specified as username.
The correct form specified as user (while the db is specified as dbname, so annoying!)
The fix is:
select abc from dblink(
'port=5439 host=some_dbhost.mycompany.com dbname=my_db user=my_user password=<...>',
'select 1 as x') as t1 (abc int);
So the error probably should have read as one of:
argument user missing
unknown argument username specified
instead of this stay up until 3am screaming to the heavens thing.

What does the "dmlreadexception" error mean on Moodle live logs when I try to pull from an external db log? And any suggestions to fix?

I am trying to use the external database log plugin in Moodle to copy over the standard log table into an external database for easier access to do some analytics work.
I activated the external db log and added all correct settings on the settings page. I clicked "test connection" and it connected successfully and returned the table column headers successfully. But if I click around and make some logs, they are visible in the standard log store but my external db table is still empty.
So I tried connecting to my external db locally in TablePlus using identical credentials as I put in the external db log store settings, and I could connect and write successfully.
Next I went into the live logs and picked standard logs, and they showed up just fine. Then I clicked on external db logs (nothing inside except for 2 manually entered rows of data), and got this error:
URL: https://ohsu.mrooms3.net/
Debug info: ERROR: syntax error at or near "{" LINE 1: SELECT COUNT('x') FROM {OpenLMSLog} WHERE courseid = $1 AND ... ^ SELECT COUNT('x') FROM {OpenLMSLog} WHERE courseid = $1 AND timecreated > $2 AND anonymous = $3 [array ( 0 => '1', 1 => 1604556625, 2 => 0, )] Error code: dmlreadexception
Stack trace:
* line 486 of /lib/dml/moodle_database.php: dml_read_exception thrown
* line 329 of /lib/dml/pgsql_native_moodle_database.php: call to moodle_database->query_end()
* line 920 of /lib/dml/pgsql_native_moodle_database.php: call to pgsql_native_moodle_database->query_end()
* line 1624 of /lib/dml/moodle_database.php: call to pgsql_native_moodle_database->get_records_sql()
* line 1697 of /lib/dml/moodle_database.php: call to moodle_database->get_record_sql()
* line 1912 of /lib/dml/moodle_database.php: call to moodle_database->get_field_sql()
* line 1895 of /lib/dml/moodle_database.php: call to moodle_database->count_records_sql()
* line 262 of /admin/tool/log/store/database/classes/log/store.php: call to moodle_database->count_records_select()
* line 329 of /report/loglive/classes/table_log.php: call to logstore_database\log\store->get_events_select_count()
* line 48 of /report/loglive/classes/table_log_ajax.php: call to report_loglive_table_log->query_db()
* line 59 of /report/loglive/classes/renderer_ajax.php: call to report_loglive_table_log_ajax->out()
* line 462 of /lib/outputrenderers.php: call to report_loglive_renderer_ajax->render_report_loglive()
* line 53 of /report/loglive/loglive_ajax.php: call to plugin_renderer_base->render()
This is the only error message I get even after turning on debugging in the developer settings. My goal is to successfully configure an external db to track logs, but due to a lack of error messages when testing the connection it is hard to debug.
Environment configuration: Open LMS 3.8 MP2 (Build: 20201008)
The external db is a postgres db so we set it on the postgres driver.
It looks like the SQL used by the external db log store plugin is not compatible with Postgres, despite using the Postgres driver in the external db log store plugin settings, as shown by the '{' error in the SQL shown in the question. See here for documentation.
To fix this, we used MariaDB instead of Postgres, and we ended up getting the external db log store working.
Another note, you have to match your columns and data types exactly to the schema in the Moodle db, and then you have to set the ID column of your db table to auto-increment. If you don't know what the schema looks like, there is an Admin SQL interface under "Reports" that lets you run SQL. On the side, there a button to view the schema for any table in the db.

ORA-01017: invalid username/password; logon denied on Pluggable database

I created a local user under a pluggable database. I granted some privileges required to open and use it. I check the username and the password. Still it keep saying invalid username/password.
Step that I take:
1. alter session set container = xxxxpdb
2. alter pluggable database xxxpdb open
3. SQL> alter user #### identified by #### container = current;
User altered. -----i did this one to make sure that i have a correct password
4. connect ###/####XXXXpdb;
ERROR:
ORA-01017: invalid username/password; logon denied
5. Then tried to connect to it this way
$ sqlplus ###/####xxxxpdb
ERROR:
ORA-01017: invalid username/password; logon denied
I am new to container database. I would appreciate any detailed explanation! Thank you.
Based on error message, it looks like the user doesn't exist in PDB.
For an existing user you may get a relevant error related to privilege. For example:
SQL> conn <existing_uname_without_required_privileges>/<upass>#<pdb_name>
ERROR:
ORA-01045: user <uname> lacks CREATE SESSION privilege; logon denied
Warning: You are no longer connected to ORACLE.
SQL>
For a non-existing user, the error you have observed will be returned:
SQL> conn <non_existing_user>/<upass>#<pdb_name>
ERROR:
ORA-01017: invalid username/password; logon denied
SQL>
This OraDoc Page provides the local user related information in CDB.

postgresql pg_database_size throwing exception on random times

We are using Azure database for PostgreSQL ( Service ) for creating DB for each user when user register to the application ( less than 25 users databases right now ).
For reporting purpose we need information which each user's DB size.
To retrieve database size we have a Postgres function which fires the following query
SELECT pg_database.datname , pg_database_size(pg_database.datname) FROM
pg_database
We execute this function every hour throw azure function but at random time Postgres throw exceptions
Exception: Npgsql.PostgresException (0x80004005): 58P01: could not read directory "base/16452": No such file or directory at...
Exception remain same at most of the time with different directory or file location
Sometimes it also throws the exception
Exception: Npgsql.NpgsqlException (0x80004005): Exception while reading from stream ---> System.IO.IOException: Unable to read data from the transport connection: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. ---> System.Net.Sockets.SocketException
Working on the solution at the MSDN forums here.

iReport Designer: permission denied for relation

I didn't face this error before. I have a database db, that contains a table tb_name, I create a connection in iReport Designer with credentials of the db owner. Then I create new report, but the query select * from tb_name; throws the following error:
SQL problems: ERROR: permission denied for relation tb_name
Query error
Message:
net.sf.jasperreports.engine.JRException: SQL problems: ERROR: permission denied for relation tb_name Level:
SEVERE Stack Trace: SQL problems: ERROR: permission denied for relation tb_name
com.jaspersoft.ireport.designer.data.fieldsproviders.SQLFieldsProvider.getFields(SQLFieldsProvider.java:435)
com.jaspersoft.ireport.designer.connection.JDBCConnection.readFields(JDBCConnection.java:470)
com.jaspersoft.ireport.designer.wizards.ConnectionSelectionWizardPanel.validate(ConnectionSelectionWizardPanel.java:146)
org.openide.WizardDescriptor$7.run(WizardDescriptor.java:1357)
org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:572)
org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:997)
When I test connection everything's fine. What can be a reason of this error? Thanks in advance.
Please check if the user has rights to execute statements. Some database changes might have caused the user to lose query permission.