Skip to content
pvmehta.com

pvmehta.com

  • Home
  • About Me
  • Toggle search form
  • tab.sql Oracle
  • Search and replace pattern Linux/Unix
  • Good Site for Oracle Internals Oracle
  • create database link syntax Oracle
  • How to set Processes Parameter Oracle
  • pvm_rbs1.sql (to collect rbs info from db) Oracle
  • How to find pinned objects from shared pool. (pinned via dbms_shared_pool.keep) Oracle
  • Finding Oracle Patches with opatch Oracle
  • Goog notes on X$ tables Oracle
  • chk_space_SID.ksh Linux/Unix
  • fuser to check who is using diretory Linux/Unix
  • note id 373303.1 Linux/Unix
  • Oracle Recommended Patches — Oracle Database ID 756671.1 Oracle
  • Standby Database Behavior when a Datafile is Resized on the Primary Database Note:123883.1 Oracle
  • Rownum with Order by Oracle

Recovering lost SYS password

Posted on 22-May-2009 By Admin No Comments on Recovering lost SYS password

Recovering from lost sys password using OS authentication on Unix.

#1. make sure that the OS user that is logged on is member of the dba group. If the dba group is not known, check the file:

$ORACLE_HOME/rdbms/lib/config.c (or config.s)

#2. make sure that the sqlnet.ora file does not contain the:

sqlnet.authentication_services

parameter. If this parameter exist, it should be commented.

#3. check the ORACLE_HOME, ORACLE_SID and PATH parameters. They must correspond to the parameters of the Oracle instance where the sys password has been lost.

If the instance is already started, use the note:

Note 373303.1 How to Check the Environment Variables for an Oracle Process

to determine the environment variables that were used when the instance was started.

#4. connect to the instance using:

sqlplus /nolog

connect / as sysdba

#5. change the sys password using:

alter user sys identified by ;

If a passwordfile is in use, the command would update the password file as well, so there is no need to recreate this file.

Recovering the lost sys password using passwordfile authentication on Unix

If the sys password is not known and the OS authentication is not an option, this method can be used. This method assumes that the sys account is not accessible, hence an abrupt shutdown for the database could be needed.

#1. make sure that the initialization parameter REMOTE_LOGIN_PASSWORDFILE is set to SHARED or EXCLUSIVE.

#2. disable OS authentication, if it is enabled for some reason, by setting:

sqlnet.authentication_services=(none)

in the sqlnet.ora file.

#3. go to the OS destination for the passwordfile:

cd $ORACLE_HOME/dbs

#4. make a backup of the previous passwordfile:

cp orapw orapw.bak

#5. recreate the passwordfile using the orapwd command:

orapwd file=orapw password=

#6. try to connect using the new password.

sqlplus /nolog

connect sys as sysdba

#7. as an additional check, if the above is successful, query:

select * from v$pwfile_users;

If it returns at least one line, then everything is ok and the new passwordfile is in use.

#8. change the sys password in the data dictionary using:

alter user sys identified by ;

Of course, the new password must match the new password of the passwordfile, if that password is to be kept, or it can be set to something else, if the initial password is to be changed. This command would update the passwordfile as well.

#9. if the test in step does not succeed, the instance must be restarted. It could be that, if no sysdba or sysoper access are possible, that the instance must be brought down abruptly, either by:

+ killing a background process

+ removing the shared memory resources using ipcrm

#10. after restarting the instance, check if the sys password is operational and if there is at least one entry in v$pwfile_users.

Recovering from lost sys password using NTS authentication on Windows

1. make sure that the OS user that is logged on is member of the ora_dba group.

#2. make sure that the sqlnet.ora file has the following line:

sqlnet.authentication_services = (nts)

#3. connect to the instance using:

sqlplus /nolog

connect / as sysdba

#4. change the sys password using:

alter user sys identified by ;

If a passwordfile is in use, the command would update the password file as well, so there is no need to recreate this file.

Recovering the lost sys password using passwordfile authentication on Windows

If the sys password is not known and the OS authentication is not an option, this method can be used. This method assumes that the sys account is not accessible, hence a shutdown for the database could be needed.

#1. make sure that the initialization parameter REMOTE_LOGIN_PASSWORDFILE is set to SHARED or EXCLUSIVE.

#2. disable OS authentication, if it is enabled for some reason, by setting:

sqlnet.authentication_services=(none)

in the sqlnet.ora file

#3. go to the OS destination for the passwordfile:

cd $ORACLE_HOME/database

#4. make a backup of the previous passwordfile:

cp pwd.ora pwd.ora.bak

#5. recreate the passwordfile using the orapwd command:

orapwd file=orapw password=

#6. try to connect using the new password.

sqlplus /nolog

connect sys as sysdba

#7. as an additional check, if the above is successful, query:

select * from v$pwfile_users;

If it returns at least one line, then everything is ok and the new passwordfile is in use.

#8. change the sys password in the data dictionary using:

alter user sys identified by ;

Of course, the new password must match the new password of the passwordfile, if that password is to be kept, or it can be set to something else, if the initial password is to be changed. This command would update the passwordfile as well.

#9. if the test in step does not succeed, the instance must be restarted. This can be done by restarting the service.

#10. after restarting the instance, check if the sys password is operational and if there is at least one entry in v$pwfile_users.

Oracle, SQL scripts

Post navigation

Previous Post: tar and untar a dolder with all its subfolder.
Next Post: Which environment is used by currently running process ( Very good)

Related Posts

  • DBMS_STATS Metalinks Notes Oracle
  • Wait time tuning research Oracle
  • How to Decide upto what level you can decrement your datafile size. ( Shrink Datafile) Oracle
  • Reclaim temp tablespace for oracle 8, 8i Oracle
  • SQL_PLAN.sql for checking real execution plan Oracle
  • SYSOPER Mystery Oracle

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Categories

  • Ansible (0)
  • AWS (2)
  • Azure (1)
  • Linux/Unix (149)
  • MYSQL (5)
  • Oracle (393)
  • PHP/MYSQL/Wordpress (10)
  • POSTGRESQL (0)
  • Power-BI (0)
  • Python/PySpark (7)
  • RAC (17)
  • rman-dataguard (26)
  • shell (149)
  • SQL scripts (342)
  • SQL Server (6)
  • Uncategorized (0)
  • Videos (0)

Recent Posts

  • Trace a SQL session from another session using ORADEBUG30-Sep-2025
  • SQL Server Vs Oracle Architecture difference25-Jul-2025
  • SQL Server: How to see historical transactions25-Jul-2025
  • SQL Server: How to see current transactions or requests25-Jul-2025
  • T-SQL Vs PL/SQL Syntax25-Jul-2025
  • Check SQL Server edition25-Jul-2025
  • Checking SQL Server Version25-Jul-2025
  • Oracle vs MYSQL Architecture differences (For DBAs)24-Jul-2025
  • V$INSTANCE of Oracle in MYSQL24-Jul-2025
  • Day to day MYSQL DBA operations (Compared with Oracle DBA)24-Jul-2025

Archives

  • 2025
  • 2024
  • 2023
  • 2010
  • 2009
  • 2008
  • 2007
  • 2006
  • 2005
  • Passing from Unix to PLSQL using bind variables Linux/Unix
  • segment_wise_space.sql segspace.sql Segment wise space usage (allocated and used) Oracle
  • Monitor Long Running Job Oracle
  • USER_TABLES.Freelists Oracle
  • Finding last recovered file on DR and remove all chanracters before any “/” Linux/Unix
  • Validating ORACLE_SID againt oratab file. Linux/Unix
  • eplan9i.sql Oracle
  • sbind.sql Find Bind variable from sql_id sqlid Oracle

Copyright © 2025 pvmehta.com.

Powered by PressBook News WordPress theme