Default username and password for Oracle database - database

I forgot to feed sys, system and hr password while Oracle DB installation and hit OK but now for SQ*Plus it needs those credentials for login in command prompt.How to get default user name and password?

You can simply login as :
sqlplus / as sysdba
Then give password to the respective users :
ALTER USER <username> IDENTIFIED BY <password>;
You can do that for all the three users.
I hope you are not on 12c. Else, you need to mention which CONTAINER are you working with. For example, if you are working on pluggable database, let's say PDBORCL, you need to do following steps :
connect / as sysdba;
alter session to set the container of which the respective users are a part of.
alter session set container=PDBORCL;
Then follow the same steps to change the passwords for the users.

CHANGE_ON_INSTALL is default password for sys and system.
You can directly login to database as sysdba from host machine and using installation user of oracle and execute below command to change system or sys password.
sqlplus "/as sysdba"
alter user sys identified by passwd;
Alternatively you can create password file to from host server
go to directory
$ORACLE_HOME\database (windows)
$ORACLE_HOME\dbs (unix\linux)
and execute
orapwd password=password file=orapwSID force=y entries=5
and login to database .

Related

Oracle PDB invalid username / password; logon denied

I have this problem:
When I create the TEST user with the password TEST but in the PDBDB1 container
ALTER SESSION SET CONTAINER= PDBDB1;
CREATE USER TEST IDENTIFIED BY TEST ;
GRANT "CONNECT" TO TEST ;
GRANT "RESOURCE" TO TEST ;
ALTER USER "TEST" DEFAULT ROLE "CONNECT","RESOURCE";
And when I try to connect with SQL Developer from my laptop and use the srvpdb1 service (from this container),
I have an error: invalid username / password; logon denied
But when I give it SYSDBA permission
GRANT SYSDBA TO TEST;
And in SQL Developer, I will change Role: SYSDBA
It connects correctly to the correct container right away.
show con_name
CON_NAME
------------------------------
PDBDB1
Make sure your connection looks like this -
It's likely you copied your SYS connection, and had your Role set to 'SYSDBA' - which will give you a bad user/password response if the user doesn't have the SYSDBA role granted.
PS Don't grant this role to someone unless they are truly the type who will be doing dba work or upgrading/repairing your database.
When will I do:
SQL> revoke sysdba from TEST;
And I set Role: Default in SQL Developer unable to connect.
And I have an invalid user / password error.
And when (for tests only) I set:
SQL> GRANT SYSDBA TO TEST;
And I set "SYSDBA" in SQL Developer, the TEST user connects correctly.
Of course, I don't want to leave SYSDBA, but how do I make it connect properly?
Problem solved!
SEC_CASE_SENSITIVE_LOGON parameter on CDB database must be TRUE !
ALTER SYSTEM SET SEC_CASE_SENSITIVE_LOGON = true;

Forgot the username and password of *fdb (firebird) database. Is there anyway I can crack this database?

I have database of firebird of more than 8 GB and I want to migrate all the data from it. But I have forgotten the username and password. Is there anyway or any tool through which I can crack this database and can get my data back?
In most Firebird setups, the username and password is kept in a central security database (security3.fdb in the case of Firebird 3). If you don't know the username and password of a user anymore, you have the following options.
Be aware, this answer uses Firebird 3 as its base, but most options also apply to Firebird 2.5 and earlier. Instead of security3.fdb, use security2.fdb. The create user and alter user steps only work in Firebird 2.5 or higher.
Use the sysdba account (or another user with RDB$ADMIN role in the security database) to reset the password of the user through any other database
Use gsec as SYSDBA in embedded mode to reset the password
Replace the security database with a copy with a known password for the user
If your database uses itself as its security database, you will first have to remove that setting from the databases.conf by commenting out the SecurityDatabase setting for that database.
For Firebird 3, this answer assumes the creation of a user for the Srp authentication mechanism, and the steps below assume that the firebird.conf in the Firebird installation has setting AuthServer = Srp (or at least that setting AuthServer contains Srp) and setting UserManager = Srp (or at least that Srp is the first entry for UserManager).
Option 1: reset a password
Works on Firebird 2.5 and higher
Connect to a database with SYSDBA (or another user with admin role on the security database), and use
ALTER USER <username> SET PASSWORD '<new password>';
This is probably not an option in your case though.
Option 1a: reset with embedded connection (passwordless)
Works on Linux for Firebird 2.5 or higher, on Windows requires Firebird 3.0 or higher.
Stop Firebird server, and use ISQL to connect to the database in embedded mode (which doesn't require a password):
isql -user sysdba <database>
With a default Firebird 3 installation, you can use employee for <database>, which will use the employee example database.
Alter the password as described above. Alternatively, try replacing sysdba with the actual username in the isql commandline.
Start Firebird server again.
Option 2: use gsec to change the password
Works on Linux for all version, on Windows this only works for Firebird 3.0 and higher.
Be aware that gsec is deprecated since Firebird 3 and may be removed from future Firebird versions.
Stop the Firebird server, open the command line, and in the Firebird installation folder do:
gsec -user sysdba
and on the gsec prompt
modify <username> -pw <new password>
or if the user doesn't exist yet:
add <username> -pw <new password>
Start Firebird server again.
Option 3: replace security database
Most of these steps also apply if you are using a new Firebird install; just skip the replacing of the security database.
Stop Firebird server and make a copy of your current security3.fdb as a backup.
Obtain a default security3.fdb for your platform (eg download a zipkit from the Firebird 3 download page) or use a security3.fdb with a known password, and replace your current security3.fdb with this default version. Don't start Firebird yet.
For earlier Firebird versions, look for your version on the download page.
The default password for sysdba is normally 'masterkey', but on Firebird 3 the default security3.fdb only contains this user for the legacy authentication mechanism, which is disabled in a default Firebird 3 installation.
To add a sysdba user, use an embedded connection to any database and create a sysdba account. On the command prompt from the Firebird installation folder, run:
isql -u sysdba <database>
Within ISQL execute:
create user sysdba password '<sysdba password>';
commit;
To add another user, connect using SYSDBA - similar to the previous step 2 - to any database and execute
create user <username> password '<new password>';
commit;
And exit isql (with quit;)
Then start Firebird server again, and you should be able to connect with this user and its password.
Most of these steps assume you already have a database to connect to, if you don't yet have one, then you'll need to create on first.
Start isql as user sysdba:
isql -u sysdba
And create a database
create database '<path-of-database>';
You can then use that database for the earlier steps.

Firebird database SYSDBA connection error

I just installed Firebird for Win64, and I was trying to connect to the employee database which comes pre-packaged with ISQL.
Following the steps from the Firebird official QuickStart Documentation I opened the ISQL utility and entered:
connect localhost:employee user sysdba password masterkey;
As a result I got:
Statement failed, SQLSTATE = 28000
Your user name and password are not defined. Ask your database administrator to set up a Firebird login.
Strangest thing is that if I navigate to the employee database sample itself and issue the isql command from there I can successfully connect.
The difference is that connecting directly to a database file doesn't require a password, it will even ignore the password, and just use the provided user to know which privileges to apply.
Without a hostname, ISQL will by default use Firebird embedded mode, and not the server. To compare, try using isql employee.fdb (or isql employee), it will just login with your current OS username, while isql localhost:employee will fail with a 'Your user name and password are not defined'.
It looks like you specified a different password than the default of masterkey, or somehow the sysdba account wasn't initialized. I recall there was a problem with the installer of an earlier Firebird 3 version, but I don't think 3.0.2 should be affected by this (or at least: it worked for me).
If the SYSDBA account wasn't initialized, then follow the steps of the Firebird 3 release notes, section Initializing the Security Database:
Initialization Steps
Initialization is performed in embedded mode using the isql utility.
For an embedded connection, an authentication password is not required
and will be ignored if you provide one. An embedded connection will
work fine with no login credentials and “log you in” using your host
credentials if you omit a user name. However, even though the user
name is not subject to authentication, creating or modifying anything
in the existing security database requires that the user be SYSDBA;
otherwise, isql will throw a privilege error for the CREATE USER
request.
The SQL user management commands will work with any open database.
Because the sample database employee.fdb is present in your
installation and already aliased in databases.conf, it is convenient
to use it for the user management task.
Stop the Firebird server. Firebird 3 caches connections to the security database aggressively. The presence of server connections may
prevent isql from establishing an embedded connection.
In a suitable shell, start an isql interactive session, opening the employee database via its alias:
> isql -user sysdba employee
Create the SYSDBA user:
SQL> create user SYSDBA password 'SomethingCryptic';
SQL> commit;
SQL> quit;
To complete the initialization, start the Firebird server again. Now you will be able to perform a network login to databases,
including the security database, using the password you assigned to
SYSDBA.
Where 'SomethingCryptic', should be your password.
If a SYSDBA user was created, you will need to change its password if you no longer remember what you set. Follow the same steps, but in step 3 do:
SQL> alter user SYSDBA set password '<new password>';
SQL> commit;
SQL> quit;
If this gives an error "record not found for user: SYSDBA", make sure you are really connected as SYSDBA, otherwise retry the original step 3. Not having admin access will behave as if the user doesn't exist, so the error is the same if the user really doesn't exist, or if you are connected with an unprivileged user.
CONNECT 'employee' user 'SYSDBA' password 'masterkey';
You need make sure that your alias.conf have something like this: employee=C:/examplepath/employee.fdb
make sure that the services of firebird is on

How can a user change their own password for an Azure SQL Server database with SQL Authentication?

After running these commands against an Azure SQL Server (in SSMS or using a command line utility):
-- run in the master table to create the login
CREATE LOGIN SusanDBA with password= 'U$3r---Pa55W0rd!!'
-- run against AnotherDB (not the master db)
CREATE USER SusanDBA from LOGIN SusanDBA
SusanDBA can login to open a connection to the AnotherDB but cannot execute the Alter Login command to change the password. This reportedly has to be done against the master database. But we don't want the user to connect to the master db for security reasons.
The command
Alter Login SusanDBA
with PASSWORD = 'U$3r---Pa55W0rd!!---'
OLD_PASSWORD='U$3r---Pa55W0rd!!'
Gets the response
Msg 5001, Level 16, State 3, Line 1 User must be in the master
database.
An administrator with appropriate master privileges can change the password but that kind of defeats the purpose: the administrator now knows the user's password.
Constraints:
- We are not in a position to use AD in this case so its SQL Authentication.
- We would like to use a command prompt utility like SQLCMD.
Correct syntax on March 2021
ALTER LOGIN [login] WITH PASSWORD='XXX' OLD_PASSWORD='NNN';
ALTER USER userName WITH PASSWORD='newPassword' OLD_PASSWORD='oldPassword';
also reference:
https://learn.microsoft.com/en-us/sql/t-sql/statements/alter-user-transact-sql?view=sql-server-ver15

How to change password of a database in DB2 software of IBM?

However, it seems very trivial - How to get the current username of a database in DB2 software in IBM; But, trust me, when it comes to entering the database username and password while connecting DB2 with eclipse, you might have to wait for a time which is tediously long. Let's get straight to the point:-
This is how you get the username of a database in DB2.
open DB2 Command Line Processor .
Connect to your database:-
db2 => connect to <database_name>
Enter this query in db2 clp:-
db2 => SELECT CURRENT USER FROM SYSIBM.SYSDUMMY1
You'll get the current user name of the current database that you have accessed.
Now, the main problem is :- How to get / change the password if one has forgotten the password. And, What is the difference between database password and the one that i entered while installing DB2 ?
DB2 does not have its own set of IDs and passwords; it relies on the operating system to perform authentication. So your ID and password are what you used to log in to Windows (or Linux, AIX, etc); and you change your password as you do normally on each platform.
The password you entered during installation is for a different ID - DB2 created a new user on your local machine. On Windows the ID is called db2admin by default.
db2 "CONNECT TO <database> USER <userid> USING <password> NEW <new_password> CONFIRM <new_password>"
http://www-01.ibm.com/support/docview.wss?uid=swg21984232

Resources