--建立唯讀權限帳號
CREATE USER readonly_user
IDENTIFIED BY readonly_user
DEFAULT TABLESPACE users
TEMPORARY TABLESPACE temp;
IDENTIFIED BY readonly_user
DEFAULT TABLESPACE users
TEMPORARY TABLESPACE temp;
GRANT CREATE SESSION to readonly_user
--建立JOB,每日00:00 GRANT一次權限
DECLARE
x NUMBER;
BEGIN
SYS.DBMS_JOB.SUBMIT
( job => x
,what => 'BEGIN
FOR i IN (SELECT table_name FROM all_tables WHERE owner='myuser')
LOOP
EXECUTE IMMEDIATE 'GRANT SELECT ON myuser.' || i.table_name || ' TO readonly_user';
END LOOP;
END;'
,next_date => to_date('20/06/2019 00:00:00','dd/mm/yyyy hh24:mi:ss')
,interval => 'null'
,no_parse => FALSE
);
SYS.DBMS_OUTPUT.PUT_LINE('Job Number is: ' || to_char(x));
COMMIT;
END;
x NUMBER;
BEGIN
SYS.DBMS_JOB.SUBMIT
( job => x
,what => 'BEGIN
FOR i IN (SELECT table_name FROM all_tables WHERE owner='myuser')
LOOP
EXECUTE IMMEDIATE 'GRANT SELECT ON myuser.' || i.table_name || ' TO readonly_user';
END LOOP;
END;'
,next_date => to_date('20/06/2019 00:00:00','dd/mm/yyyy hh24:mi:ss')
,interval => 'null'
,no_parse => FALSE
);
SYS.DBMS_OUTPUT.PUT_LINE('Job Number is: ' || to_char(x));
COMMIT;
END;
Strange "water hack" burns 2lbs overnight
回覆刪除Over 160 thousand women and men are losing weight with a easy and secret "water hack" to burn 1-2 lbs each and every night in their sleep.
It's easy and works every time.
Here's how you can do it yourself:
1) Go get a glass and fill it half full
2) Then follow this awesome HACK
so you'll be 1-2 lbs skinnier in the morning!