How to Diagnose and Fix the ORA-01311 Error: WITH GRANT OPTION not allowed for PUBLIC

If you encounter the ORA-01311 error in Oracle, it means that you are trying to grant a privilege to the PUBLIC role using the WITH GRANT OPTION, which is not allowed. This error occurs because giving the WITH GRANT OPTION to the PUBLIC role can pose security risks and is therefore restricted.

To diagnose and fix this error, you can follow the steps below:

Diagnosing the ORA-01311 Error

1. Check the SQL statement that is causing the error. Look for any grants to the PUBLIC role with the WITH GRANT OPTION.

2. Review the Oracle documentation for the specific privilege that you are trying to grant. Ensure that the privilege is not being granted to the PUBLIC role with the WITH GRANT OPTION.

Fixing the ORA-01311 Error

There are several ways to fix the ORA-01311 error, depending on the specific situation. Here are a few possible solutions:

1. Revoke the Grant

If you have mistakenly granted a privilege to the PUBLIC role with the WITH GRANT OPTION, you can revoke the grant using the following SQL statement:


Replace with the specific privilege that was granted.

2. Grant the Privilege to Specific Users or Roles

Instead of granting the privilege to the PUBLIC role, consider granting it to specific users or roles that require the privilege. Use the following SQL statement to grant the privilege:

GRANT </privilege><privilege> TO <user_or_role>;

Replace with the specific privilege and with the username or role name.

3. Review and Update Application Logic

If the error is occurring within an application, review the application logic to ensure that it is not attempting to grant privileges to the PUBLIC role with the WITH GRANT OPTION. Update the application logic to grant privileges in a more secure manner.


In conclusion, the ORA-01311 error in Oracle indicates that the WITH GRANT OPTION is not allowed for the PUBLIC role. By diagnosing the error and implementing the appropriate fix, you can ensure that your database remains secure and compliant with Oracle’s best practices.

For more information on managing privileges and roles in Oracle, refer to the Oracle documentation or seek assistance from a qualified Oracle database administrator.

Leave a Comment