-
Notifications
You must be signed in to change notification settings - Fork 4
/
grants.sql
64 lines (54 loc) · 2.33 KB
/
grants.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
prompt ######################################################################
prompt *** Attention! ***
prompt This script will add java.io.FilePermission permissions!!!
prompt ;
accept _grantee prompt "Grantee[default &_USER]: " default "&_USER";
prompt ;
prompt *** Choose files or directories ***
doc
If you are granting FilePermission, then you must provide the physical name
of the directory or file, such as /private/oracle.
You cannot provide either an environment variable, such as $ORACLE_HOME,
or a symbolic link.
To denote all files within a directory, provide the * symbol, as follows:
/private/oracle/*
To denote all directories and files within a directory, provide the - symbol, as follows:
/private/oracle/-
#
accept _files prompt "Files or directories[default <<ALL FILES>>]: " default '<<ALL FILES>>';
accept _permissions prompt "Choose operations[default 'read,write,execute']: " default "read,write,execute";
prompt ######################################################################
prompt Will be executed this code:
prompt dbms_java.grant_permission( upper('&_grantee'), 'SYS:java.io.FilePermission', '&_files', '&_permissions' );
prompt ######################################################################
accept _check prompt "Enter 'Y' if you want to add such permissions:"
set serverout on;
begin
if upper('&_check')='Y'
then
dbms_java.grant_permission( upper('&_grantee'), 'SYS:java.io.FilePermission', '&_files', '&_permissions' );
dbms_output.put_line('Permission was granted successfully.');
else
dbms_output.put_line('*** Cancelled ***');
end if;
end;
/
prompt
prompt ######################################################################
prompt *** Current permissions for grantee:
col kind for a8;
col grantee for a20;
col type_schema for a20;
col type_name for a25;
col name for a50 word;
col action for a20 word;
col enabled for a10;
select kind,grantee,type_schema,type_name,name,action,enabled from dba_java_policy where grantee=upper('&_grantee');
col kind clear;
col grantee clear;
col type_schema clear;
col type_name clear;
col name clear;
col action clear;
col enabled clear;
undef _files _grantee _permissions _check;