ORA-01940 error when running AVDB_Import_AVUSER.sh in RSA Identity Governance and Lifecycle
4 years ago
Originally Published: 2017-08-07
Article Number
000045630
Applies To
RSA Product Set: Identity Governance and Lifecycle
RSA Version/Condition: 6.9.1, 7.0.1, 7.0.2
Issue
The AVDB_Import_AVUSER.sh is a script that is used for restoring the database for an RSA appliance.

The procedure for using the script is documented in the online help under Administration > Managing the Appliance > Restoring the Database for an RSA Appliance.

However, when running the script, the following error may be encountered.
Dropping the user "avuser"..
DECLARE
*
ERROR at line 1:
ORA-01940: cannot drop a user that is currently connected
ORA-06512: at line 8

Database is not running.
Database is running.
 drop a user that is currently connected
ORA-06512: at line 8
It should be noted that the script calls Drop_User.sql, and this is where the DROP USER SQL statement is actually issued.
Cause
The Oracle description for the error is as follows.
ORA-01940: cannot drop a user that is currently connected 
Cause: Attempt was made to drop a user that is currently logged in. 
Action: Make sure user is logged off, then repeat command.
The error occurs when the avuser is still logged in to the database.
 
Resolution
Use the -f option when running the AVDB_Import_AVUSER.sh script.  Using -f forces the import by terminating any existing sessions.  For example: 
cd /home/oracle/database/DBA/AVDB/scripts
AVDB_Import_AVUSER.sh -f Export_AVDB_avuser2011-10-21-17-16-00.dmp
Workaround
Alternately, the error can be overcome by connecting to the database as SYSDBA and manually dropping the avuser.
# sqlplus / as sysdba
SQL> shutdown immediate; 
SQL> startup restrict; 
SQL> drop user AVUSER cascade 
SQL> shutdown immediate 
SQL> startup
Once the user has been dropped, the AVDB_Import_AVUSER.sh script can then be run without the -f option.