oracle 11g Grant on dbms_lock not persisting
From Oracle documentation-


  When you create an Oracle Database, the user SYSTEM is also automatically created and granted the DBA role. 


SQL&gt; conn system
Password:


SQL&gt; select * from session_roles;

ROLE
------------------------------
CONNECT
RESOURCE
DBA

SQL&gt; show user;
USER is "SYSTEM"

SQL&gt; grant execute on dbms_lock to jay;
grant execute on dbms_lock to jay
                 *
ERROR at line 1:
ORA-01031: insufficient privileges


The error has occurred because the SYSTEM user has no 'EXECUTE' privilege with GRANT option on DBMS_LOCK.

SQL&gt;conn / as sysdba

SQL&gt; select * from user_tab_privs where grantee='SYSTEM' and table_NAME='DBMS_LOCK';

no rows selected


Also, the DBA role has no 'EXECUTE' object privilege on DBMS_LOCK package.

SQL&gt;  select * from role_tab_privs where role='DBA' and table_name='DBMS_LOCK';

no rows selected


In order to grant execute privilege, you need to connect as SYSDBA which connects to SYS schema, owner of DBMS_LOCK, or grant 'EXECUTE' privilege with GRANT option to the user performing the grant.

[oracle@myserver ~]$ sqlplus system as sysdba

SQL*Plus: Release 11.2.0.4.0 Production on Tue May 2 14:45:27 2017

Copyright (c) 1982, 2013, Oracle.  All rights reserved.

Enter password: 

Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, Automatic Storage Management, OLAP, Data Mining
and Real Application Testing options

SQL&gt; show user;
USER is "SYS"

SQL&gt; grant execute on dbms_lock to jay;

Grant succeeded.



  When logged in from sqlplus (as SYSDBA), don't the grants assigned to a given user persist even after we exit sqlplus?


Yes, they persist.


  Is there no way we can log in as SYSDBA via JDBC since when I tried it, it didn't allow me.


Here is a sample connection string which works fine for me.

Connection conn=DriverManager.getConnection("jdbc:oracle:thin:@host:port/SID","sys as sysdba","password");