This is the 27th day of my participation in the August More Text Challenge

Error message

The following error message is displayed when the database client is connected to the sys user:

Troubleshoot and locate the cause of the error

In view of the above error message, the first thought of the password error, log in to the server, access the database without secret authentication manually change the password:

[oracle@dj ~]$ sqlplus / as sysdba SQL*Plus: Release 11.2.0.4.0 Production on Fri Aug 27 09:57:39 2021 Copyright (C) 1982, 2013, Oracle. All rights reserved. Connected to: Oracle Database 11G Enterprise Edition Release 11.2.0.4.0-64bit Production With the Partitioning Data Mining and Real Application Testing options SQL> alter user sys identified by oracle; User altered.Copy the code

Try the client connection again and the error is still reported:If no result is displayed, the following information is displayed:

SQL> select * from v$pwfile_users;

no rows selected
Copy the code

Because the client is connected to the sys user, the password file (password file) that should be the sys user of the database is invalid.

To solve

Rebuild password file:

[oracle@dj ~]$ cd $ORACLE_HOME/dbs [oracle@dj dbs]$ ll total 20 -rw-rw---- 1 oracle oinstall 1544 Aug 14 23:06 hc_orcl.dat -rw-r--r-- 1 oracle oinstall 2851 May 15 2009 init.ora -rw-r----- 1 oracle oinstall 24 Dec 30 2020 lkORCL -rw-r----- 1 oracle oinstall 1536 Jun 8 09:44 orapworcl -rw-r----- 1 oracle oinstall 3584 Aug 26 22:11 spfileorcl.ora [oracle@dj dbs]$ mv orapworcl orapworcl.bak [oracle@dj dbs]$ ll total 20 -rw-rw---- 1 oracle oinstall 1544 Aug 14 23:06 hc_orcl.dat -rw-r--r-- 1 oracle oinstall 2851 May 15 2009 init.ora -rw-r----- 1 oracle oinstall 24 Dec 30 2020 lkORCL -rw-r----- 1 oracle oinstall 1536 Jun 8 09:44 orapworcl.bak -rw-r----- 1 oracle oinstall 3584 Aug 26 22:11 Spfileorcl. Ora [oracle @ DJ DBS] $PWD/msun/app/oracle/product / 11.2.0 / dbhome_1 / DBS $orapwd [oracle @ DJ DBS] The file = / msun/app/oracle/product / 11.2.0 / dbhome_1 / DBS/orapworcl password = oracle force = y; [oracle@dj dbs]$ ll total 24 -rw-rw---- 1 oracle oinstall 1544 Aug 14 23:06 hc_orcl.dat -rw-r--r-- 1 oracle oinstall 2851 May 15 2009 init.ora -rw-r----- 1 oracle oinstall 24 Dec 30 2020 lkORCL -rw-r----- 1 oracle oinstall 1536 Aug 27 10:06 orapworcl -rw-r----- 1 oracle oinstall 1536 Jun 8 09:44 orapworcl.bak -rw-r----- 1 oracle oinstall 3584 Aug 26 22:11 spfileorcl.oraCopy the code

Check the password file information in the database again, the display is effective:

SQL> select * from v$pwfile_users;

USERNAME                       SYSDB SYSOP SYSAS
------------------------------ ----- ----- -----
SYS                            TRUE  TRUE  FALSE
Copy the code

The client is connected again and can log in normally: