oracle-new(2)
- 格式:ppt
- 大小:313.00 KB
- 文档页数:45


Oracle系统中用户权限的赋予,查看和管理.在Oracle数据库中,用户的权限分为两种(在这里我们不讨论dba或oper的权限,只考虑普通用户的权限),分别是System Privilege系统权限和User Table Privilege用户数据表权限.1.首先,创建用户,以下几条命令可以创建一个用户,前提是必须以DBA的身份登录(如果你不是DBA,不要看下去了):create user DB_USER identified by DB_USER_PW '创建用户DB_USER,密码为DB_USER_PW grant create session to DB_USER '给用户创建会话的权限grant resource to DB_USER2.当用户建立后,会自动在Oracle数据库系统中生成属于该用户的Scheme (可以理解为所有属于该用户的表,视图....等对象的集合).该用户可以将对这些对象的访问权限赋予其它的系统用户.3.该用户用sqlplus登录后,以下命令可以看到该用户的权限(该部分取自于CNOUG网站):本用户读取其他用户对象的权限:select * from user_tab_privs;本用户所拥有的系统权限:select * from user_sys_privs;ORACLE数据库用户与权限管理ORACLE是多用户系统,它允许许多用户共享系统资源。
为了保证数据库系统的安全,数据库管理系统配置了良好的安全机制。
2. 1 ORACLE数据库安全策略建立系统级的安全保证系统级特权是通过授予用户系统级的权利来实现,系统级的权利(系统特权)包括:建立表空间、建立用户、修改用户的权利、删除用户等。
系统特权可授予用户,也可以随时回收。
ORACLE系统特权有80多种。
建立对象级的安全保证对象级特权通过授予用户对数据库中特定的表、视图、序列等进行操作(查询、增、删改)的权利来实现。
oracle常⽤函数汇总(分享)算术运算符:+ - * / 可以在select 语句中使⽤连接运算符:|| select deptno|| dname from dept;⽐较运算符:> >= = != < <= like between is null in逻辑运算符:not and or集合运算符: intersect ,union, union all, minus对应集合的列数和数据类型相同查询中不能包含long 列列的标签是第⼀个集合的标签使⽤order by时,必须使⽤位置序号,不能使⽤列名例:集合运算符的使⽤:复制代码代码如下:intersect ,union, union all, minusselect * from emp intersect select * from emp where deptno=10 ;select * from emp minus select * from emp where deptno=10;select * from emp where deptno=10 union select * from emp where deptno in (10,20); --不包括重复⾏select * from emp where deptno=10 union all select * from emp where deptno in (10,20); --包括重复⾏ TO_DATE格式(以时间:2007-11-02 13:45:25为例)Year:yy two digits 两位年显⽰值:07yyy three digits 三位年显⽰值:007yyyy four digits 四位年显⽰值:2007Month:mm number 两位⽉显⽰值:11mon abbreviated 字符集表⽰显⽰值:11⽉,若是英⽂版,显⽰novmonth spelled out 字符集表⽰显⽰值:11⽉,若是英⽂版,显⽰novemberDay:dd number 当⽉第⼏天显⽰值:02ddd number 当年第⼏天显⽰值:02dy abbreviated 当周第⼏天简写显⽰值:星期五,若是英⽂版,显⽰friday spelled out 当周第⼏天全写显⽰值:星期五,若是英⽂版,显⽰fridayddspth spelled out, ordinal twelfthHour:hh two digits 12⼩时进制显⽰值:01hh24 two digits 24⼩时进制显⽰值:13Minute:mi two digits 60进制显⽰值:45Second:ss two digits 60进制显⽰值:25其它Q digit 季度显⽰值:4WW digit 当年第⼏周显⽰值:44W digit 当⽉第⼏周显⽰值:124⼩时格式下时间范围为: 0:00:00 - 23:59:59....12⼩时格式下时间范围为: 1:00:00 - 12:59:59 ....select to_char(sysdate,'yyyy-mm-dd hh24:mi:ss') as nowTime from dual; //⽇期转化为字符串select to_char(sysdate,'yyyy') as nowYear from dual; //获取时间的年select to_char(sysdate,'mm') as nowMonth from dual; //获取时间的⽉select to_char(sysdate,'dd') as nowDay from dual; //获取时间的⽇select to_char(sysdate,'hh24') as nowHour from dual; //获取时间的时select to_char(sysdate,'mi') as nowMinute from dual; //获取时间的分select to_char(sysdate,'ss') as nowSecond from dual; //获取时间的秒select to_date('2004-05-07 13:23:44','yyyy-mm-dd hh24:mi:ss') from dual//显⽰Two Hundred Twenty-Twoselect to_char(to_date('2002-08-26','yyyy-mm-dd'),'day') from dual;星期⼀select to_char(to_date('2002-08-26','yyyy-mm-dd'),'day','NLS_DATE_LANGUAGE = American') from dual; monday设置⽇期语⾔ALTER SESSION SET NLS_DATE_LANGUAGE='AMERICAN';也可以这样TO_DATE ('2002-08-26', 'YYYY-mm-dd', 'NLS_DATE_LANGUAGE = American')select floor(sysdate - to_date('20020405','yyyymmdd')) from dual;select id, active_date from table1UNIONselect 1, TO_DATE(null) from dual;注意要⽤TO_DATE(null)a_date between to_date('20011201','yyyymmdd') and to_date('20011231','yyyymmdd')那么12⽉31号中午12点之后和12⽉1号的12点之前是不包含在这个范围之内的。
一、开始开发标准FORM1.输出不必要的BLOCKNAME,DETAILBLOCK。
(包括数据块,画布,窗口)2.修改触发器:PRE-FORMFND_STANDARD.FORM_INFO(版本号,名称,模块,日期,作者);APP_WINDOW.SET_WINDOW_POSITIN(‘第一个窗口名称’,’FIRST_WINDOW’);FND_ORG.CHOOSE_ORG;――选择组织APP_WINDOW.SET_TITLE(‘窗体名称’,:_code);3.修改程序单元:app_customer:close_window4.编译f60gen module=/porcli/applmgr/1159/au/11.5.0/forms/ZHS/IAQTEST01.fmb userid=apps/simple4uoutput_file=/porcli/applmgr/1159/inv/11.5.0/forms/ZHS/IAQTEST01.fmxmodule_type=form batch=no compile_all=yesf60gen <Form Name> apps/<apps password>pre_insert, pre_update中加入代码:fnd_standard.set_who二、QUERY FIND 制作一.把APPSTAND 的QUERY FIND 对象组拉到开发的FORM上,选择子类。
二.在目的数据块的添加QUERY FIND (BLOCK LEVEL,注:可以从FORM LEVEL拷贝),然后修改代码app_find.query_find (block_window V ARCHAR2, --目的数据块find_window V ARCHAR2, --查询窗口find_block V ARCHAR2) --查询数据块4.在QUERY FIND里面添加文本项等查询内容。
Oracle根据现有表创建新表1.新表不存在复制表结构即数据到新表1 2create table new_table select* from old_talbe;这种⽅法会将old_table中所有的内容都拷贝过来,⽤这种⽅法需要注意,new_table中没有了old_table中的primary key,Extra,auto_increment等属性,需要⾃⼰⼿动加,具体参看后⾯的修改表即字段属性.只复制表结构到新表1 2 3 4 5 6# 第⼀种⽅法,和上⾯类似,只是数据记录为空,即给⼀个false条件create table new_tableselect* from old_table where1=2;# 第⼆种⽅法create table new_table like old_table;2.新表存在复制旧表数据到新表(假设两个表结构⼀样)1 2insert into new_table select* from old_table;复制旧表数据到新表(假设两个表结构不⼀样)1 2insert into new_table(field1,field2,.....) select field1,field2,field3 from old_table;复制全部数据1select* into new_table from old_table;只复制表结构到新表1select* into new_talble from old_table where1=2;create table a like b;create table c_relation as select c.memberId,m.merchantId,memb.phone from c_merchant as m inner join c_customer c on erId=erId inner join c_member memb on memb.id=c.memberId where memb.status=10;由上⾯的使⽤ CREATE TABLE 表名 AS SELECT 语句可以看出:1:只会复制表数据和表结构,不会有任何约束。