I got the following error when using several ways to connect to database using a sqlplus preliminary connection sqlplus -prelim / as sysdba :
ORA-01012: not logged on
Process ID: 0
Session ID: 0 Serial number: 0
However I can connect to database sqlplus / as sysdba
Finally figured out the reason. sqlplus login.sql access database after connected to database even when the connection is preliminary connection.