C:\Users\rajam>sqlplus edr/welcome
SQL*Plus: Release 10.2.0.1.0 - Production on Thu Jun 6 11:16:52 2019
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to:
Oracle Database 10g Express Edition Release 10.2.0.1.0 - Production
SQL> create table student (id number,name varchar2(200));
Table created.
SQL> grant all on student to load_sys;
Grant succeeded.
C:\Users\rajam>sqlplus load_sys/welcome
SQL*Plus: Release 10.2.0.1.0 - Production on Thu Jun 6 11:30:53 2019
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to:
Oracle Database 10g Express Edition Release 10.2.0.1.0 - Production
SQL> /* Formatted on 6/6/2019 11:30:14 AM (QP5 v5.256.13226.35510) */
SQL> SET SERVEROUTPUT ON;
SQL>
SQL> CREATE OR REPLACE PROCEDURE p_load
2 AS
3 BEGIN
4 FOR i IN 1 .. 10
5 LOOP
6 INSERT INTO edr.student
7 VALUES (i, 'NAME-' || I);
8 END LOOP;
9
10 COMMIT;
11
12 dbms_stats.gather_table_stats('EDR','STUDENT',estimate_percent=>100,cascade=>true,degree=>4);
13 EXCEPTION
14 WHEN OTHERS
15 THEN
16 DBMS_OUTPUT.put_line ('error=' || SQLERRM);
17 END;
18 /
Procedure created.
SQL> exec p_load;
error=ORA-20000: Unable to analyze TABLE "EDR"."STUDENT", insufficient
privileges or does not exist
PL/SQL procedure successfully completed.
C:\Users\rajam>sqlplus sys as sysdba
SQL*Plus: Release 10.2.0.1.0 - Production on Thu Jun 6 11:37:09 2019
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Enter password:
Connected to:
Oracle Database 10g Express Edition Release 10.2.0.1.0 - Production
SQL> GRANT ANALYZE ANY TO LOAD_SYS;
Grant succeeded.
SQL>
------------- after analyze grant ----------------------------------------
SQL> exec p_load;
PL/SQL procedure successfully completed.
SQL>
SQL*Plus: Release 10.2.0.1.0 - Production on Thu Jun 6 11:16:52 2019
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to:
Oracle Database 10g Express Edition Release 10.2.0.1.0 - Production
SQL> create table student (id number,name varchar2(200));
Table created.
SQL> grant all on student to load_sys;
Grant succeeded.
C:\Users\rajam>sqlplus load_sys/welcome
SQL*Plus: Release 10.2.0.1.0 - Production on Thu Jun 6 11:30:53 2019
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to:
Oracle Database 10g Express Edition Release 10.2.0.1.0 - Production
SQL> /* Formatted on 6/6/2019 11:30:14 AM (QP5 v5.256.13226.35510) */
SQL> SET SERVEROUTPUT ON;
SQL>
SQL> CREATE OR REPLACE PROCEDURE p_load
2 AS
3 BEGIN
4 FOR i IN 1 .. 10
5 LOOP
6 INSERT INTO edr.student
7 VALUES (i, 'NAME-' || I);
8 END LOOP;
9
10 COMMIT;
11
12 dbms_stats.gather_table_stats('EDR','STUDENT',estimate_percent=>100,cascade=>true,degree=>4);
13 EXCEPTION
14 WHEN OTHERS
15 THEN
16 DBMS_OUTPUT.put_line ('error=' || SQLERRM);
17 END;
18 /
Procedure created.
SQL> exec p_load;
error=ORA-20000: Unable to analyze TABLE "EDR"."STUDENT", insufficient
privileges or does not exist
PL/SQL procedure successfully completed.
C:\Users\rajam>sqlplus sys as sysdba
SQL*Plus: Release 10.2.0.1.0 - Production on Thu Jun 6 11:37:09 2019
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Enter password:
Connected to:
Oracle Database 10g Express Edition Release 10.2.0.1.0 - Production
SQL> GRANT ANALYZE ANY TO LOAD_SYS;
Grant succeeded.
SQL>
------------- after analyze grant ----------------------------------------
SQL> exec p_load;
PL/SQL procedure successfully completed.
SQL>
No comments:
Post a Comment