日期:2014-05-16  浏览次数:20468 次

oracle自己工作中的整理
--sysdba用户登陆
--1.建立用户:
/*
10.163.201.245
root hwmtv
su - oracle
sqlplus / as sysdba
*/
create user iassess identified by iassess default tablespace imp;
--2赋权
---2.1.基本权限
grant connect to iassess;
grant resource to iassess;
grant execute on dbms_lock to iassess;
---2.2.扩展权限
----2.2.1对象权限
grant select on dba_kgllock     to iassess;
grant select on v_$lock         to iassess;
grant select on v_$mystat       to iassess;
grant select on v_$parameter    to iassess;
grant select on v_$process      to iassess;
grant select on v_$session_wait to iassess;
grant select on v_$sqltext      to iassess;
grant select on v_$session      to iassess;
grant select on v_$statname     to iassess;
grant select on v_$sesstat      to iassess;
----2.2.2系统权限
grant alter any trigger to iassess;
grant alter any type to iassess;
grant alter system to iassess;
grant create any directory to iassess;
grant create any index to iassess;
grant create any table to iassess;
grant create any trigger to iassess;
grant create any type to iassess;
grant create any view to iassess;
grant drop any index to iassess;
grant drop any table to iassess;
grant drop any trigger to iassess;
grant drop any type to iassess;
grant drop any view to iassess;
grant query rewrite to iassess;
grant select any table to iassess;
grant create sequence to  iassess;
grant create database link to iassess;
-----收回权限
revoke drop any index from iassess;
-----------删除用户
--需要sysdba用户登陆操作
drop user iassess cascade;
----------------------------------------------------------------------------
----------------------------------------------------------------------------
--定时任务
select sysdate from dual;
--创建job(如果为过程,则过程不要有入参和出参)
begin
  sys.dbms_scheduler.create_job(job_name        => 'P_CMDINFO_TRANS_JOB',
                                job_type        => 'STORED_PROCEDURE',
                                job_action      => 'p_dispose_queue_add',
                                start_date      => to_date('10-07-2013 14:08:20',
                                                           'dd-mm-yyyy hh24:mi:ss'),
                                repeat_interval => 'Freq=Minutely;Interval=1',--Monthly
                                end_date    &nb