Oracle DBLINK clarification - oracle

Below is the oracle fixed user private dblink "create statement" as it is defined in the server. This is working fine. Now my question is, does the password mentioned in the statement PWD mean that it fetches the password from ldap or from oracle vault or it is the actual password itself?

For fixed user database links, the passwords are stored in the data dictionary. In former Oracle versions the password was stored unencrypted, but this has changed now.

Related

how to grant select, different servers, same username/password different schema

I'm not a DB expert, my boss has retired and it's up to me now. He created a production database, and a test database on another server with same username/password and schema name test_SameAsOtherDB. I'm trying to pull the live data from the production table, into the test DB table, but there are no privileges for me to do so.
I tried by logging into my production DB and "grant select on mytable_name to testDB.mytable_name;" but it gives me the error "ORA-00933: SQL command not properly ended".
I've tried all the combinations of user/password/schema that I could think of, but none work.
Everything I've researched says use "GRANT select on tablename to USER" but the user is the same on each DB.
Hope I made sense, any help would be appreciated.
Thanks,
John
You access a database on another server through a DATABASE LINK, not with the syntax to access an object in another schema on the same server.
You must create the DBLINK using the "CONNECT TO user IDENTIFIED BY password" syntax. (And the user used to execute "CREATE DATABASE LINK" must have the privilege to do...)
Then you will be able to "SELECT ... FROM mytable_name#DBLINK_TESTDB" assuming you named the DBLINK "DBLINK_TESTDB" with the same rights the user used in the "CONNECT TO" statement has in the target DB.
(And change that policy having the same passwords in all environment...)

Can you reset/retrieve a username/password used in schema creation of a desktop Oracle database?

I have an Oracle 12C desktop database schema I created some time ago. I don't remember the username/password for when I created the schema.
Is there any way to retrieve it? I have full admin privileges for computer.
Thanks much.
Login as SYS (I suppose you are still able to do that) and then issue:
alter user <<schema>> identified by <<new_password>>;

DB User account Password Reset from oracle apex

Iam creating an app to change the password of selected Db user account.When an user select a particular db name and user of the db then click submit button i should call procedures that changes the password of the db user.So guide me how to connect to selected db from oracle Apex and do it.
As far as I can tell, there are two ways to change someone's password:
connect as that user
connect as a privileged user (such a SYS)
and run such a command:
alter user scott identified by tiger;
As you'd want to do that for any database you have a access to, as well as every user in those databases, I doubt that you know their passwords so I guess that you'll connect as a privileged user to all those databases. Of course, you have to know their passwords.
One option would be to
create the same stored procedure (which will modify someone's password) in every database
it'll accept username and its new password
as alter table is DDL, you'll have to use dynamic SQL (execute immediate)
create database links to those databases in a schema you use to connect to your Apex application
depending on database you choose, call appropriate procedure via database link and pass chosen username and its new password. This might also require some kind of dynamic SQL, if you want to use different DB link name
I don't know which database version you use, but - have a look at 11g's Accessing and Modifying Information in Multiple Databases, especially "Running a Stored Procedure in a Remote Oracle Database" chapter for more info.

Oracle 12c default pluggable DB in sqlplus

I have a pluggable database in Oracle 12c named PDBORCL.
After a server restart something changed in how to connect to it.
I created a user in that pluggable DB, for the example the user is PETER and the password is also PETER. Before the restart I used to be able to open a Command Prompt, run sqlplus, which would in turn ask for my username and then its password, and it would sign in. Now this does not work, it says invalid username/password. When I log in with SYS and check:
SELECT * FROM dba_users WHERE username = 'PETER';
I get no results.
However, if I sign in using the following from a command prompt, it works:
sqlplus PETER/PETER#PDBORCL
So, the DB is up and running, but it seems to be connecting by default to the wrong pluggable DB. I need to change it to the way it was before the restart, so that it connects by default to that specific pluggable DB.
How can I achieve this?
I found the solution. Change or create the environment variable LOCAL (in Windows) to PDBORCL. I think I read in linux the variable is TWO_TASK. After changing it, the following works:
sqlplus PETER/PETER
Also, just calling sqlplus and waiting to be prompted for username and password works.
You have created a user in pluggableDB and this user is not visible beyond the pluggable DB hence the reason you dont see user PETER when running the above query as sys..
If you want to connect to your pluggable DB directly what you have done above is right else you to connect to sys and the use CONNECT command.

Accessing unencrypted H2 database without credential knowledge

We are cleaning up servers for a customer and have stumbled upon an old application using an H2 database. While the accessing applications have credentials in their configuration files, none of them seem to work.
Even the "sa" user access is not known. As far as I can see, the password for "sa" defaults to an empty string, but access with "sa"/"" is denied (Wrong user name or password [28000-182] 28000/28000 (Help)).
As said, the database is not encrypted. Looking at the file, I can see the SQL statements for the tables, even some table contents.
Is there any way to gain access to that database? As far as my searches have shown it's only possible using the "sa" user. I'm looking for something along the lines of "--skip-grant-tables" from MySQL.
The easiest solution is probably:
Try to login to the database without password. This will fail (wrong user name or password), but it will run transaction log recovery so that the database is in a consistent state.
Then, use the Recover tool (org.h2.tools.Recover) to generate a SQL script.
Edit the script: Change the password for the default user.
Run the script. That way you get a new database.

Resources