Revoke default database administrator privileges
- Last Updated: January 17, 2024
- 2 minute read
- OpenEdge
- Version 12.8
- Documentation
The default database administrator of the OpenEdge database is the user who
creates that database. To revoke the default database administrator SQL privileges on
one or more data, system or virtual tables; another database administrator must first
revoke the RESOURCE and DBA privileges of the default database administrator. Then,
select the GRANTED BY ANY_USER option of the REVOKE
statement to revoke specific privileges.
For example, to revoke all privileges on the customer table from the default
database administrator named John, another database administrator executes the following
SQL
statements:
REVOKE RESOURCE , DBA FROM John;
REVOKE ALL ON PUB.Customer FROM John GRANTED BY ANY_USER;
COMMIT;
Here
John is the default database administrator who created the
database.The ABL script to automate the creation of the SQL commands described above would look
like:
OUTPUT TO removeEntries.SQL.
FOR EACH _file WHERE _file._file-num GT 0 AND _file._file-num LT 32000 NO-LOCK:
PUT UNFORMATTED 'grant all on pub."' + _file._file-name + '" to "John" ~;'
SKIP.
PUT UNFORMATTED 'revoke all on pub."' + _file._file-name + '" from "John" granted by any_user ~;'
SKIP.
END.
PUT UNFORMATTED 'COMMIT;'
SKIP.
The generated text file is then executed from an OpenEdge
proenv command prompt window with a command, for
example:sqlexp testdb -S 5555 -user sysprogress -password sysprogress -infile removeEntries.SQLThe SQL command confirms that the entries related to John are not present anymore in the
_Systabauth
table:SELECT * FROM "PUB"."_Systabauth";
or
SELECT * FROM "PUB"."_Systabauth" where "_Grantee" = 'John';Note: The ABL script only generates SQL
commands to revoke SQL rights from existing database tables, to remove entries for
renamed, dropped, or not yet created tables in the database, use SQL statements such
as:
create table PUB."nonExistingTableName" (deleteMe integer) ;
grant all on pub."nonExistingTableName" to "John" ;
revoke all on pub."nonExistingTableName" from "John" granted by any_user ;
drop table PUB."nonExistingTableName" ;
COMMIT;