[ת]Oracle½ÇÉ«¡¢È¨ÏÞ
OracleÄÚÖýÇÉ«connectÓëresourceµÄȨÏÞ
============================================================
Ò»¡¢ºÎΪ½ÇÉ«£¿
¡¡¡¡Èç¹ûÓÐÒ»×éÈË£¬ËûÃǵÄËùÐèµÄȨÏÞÊÇÒ»ÑùµÄ£¬¶ÔËûÃǵÄȨÏÞ½øÐйÜÀíµÄʱºò»á²»·½±ã¡£ÒòΪÄãÒª¶ÔÕâ×éÖеÄÿ¸öÓû§µÄȨÏÞ¶¼½øÐйÜÀí¡£
¡¡¡¡ÓÐÒ»¸öºÜºÃµÄ½â¾ö°ì·¨¾ÍÊÇ£º½ÇÉ«¡£½ÇÉ«ÊÇÒ»×éȨÏ޵ļ¯ºÏ£¬½«½ÇÉ«¸³¸øÒ»¸öÓû§£¬Õâ¸öÓû§¾ÍÓµÓÐÁËÕâ¸ö½ÇÉ«ÖеÄËùÓÐȨÏÞ¡£ÄÇôÉÏÊöÎÊÌâ¾ÍºÜºÃ´¦ÀíÁË£¬Ö»ÒªµÚÒ»´Î½«½ÇÉ«¸³¸øÕâÒ»×éÓû§£¬½ÓÏÂÀ´¾ÍÖ»ÒªÕë¶Ô½ÇÉ«½øÐйÜÀí¾Í¿ÉÒÔÁË¡£ Æäʵ£º½ÇÉ«¾ÍÊÇÒ»×éȨÏ޵ļ¯ºÏ¡£ÏÂÃæ·ÖÁ½¸ö²¿·ÖÀ´¶Ôoracle½ÇÉ«½øÐÐ˵Ã÷¡£
============================================================
¶þ¡¢ÏµÍ³Ô¤¶¨Òå½ÇÉ«
¡¡¡¡Ô¤¶¨Òå½ÇÉ«ÊÇÔÚÊý¾Ý¿â°²×°ºó£¬ÏµÍ³×Ô¶¯´´½¨µÄһЩ³£ÓõĽÇÉ«¡£Ï½é¼òµ¥µÄ½éÉÜÒ»ÏÂÕâЩԤ¶¨½ÇÉ«¡£½ÇÉ«Ëù°üº¬µÄȨÏÞ¿ÉÒÔÓÃÒÔÏÂÓï¾ä²éѯ£º
sql>select * from role_sys_privs where role='½ÇÉ«Ãû'; (×¢Òâ:ÕâÀïµÄROLE¾¹ýϵͳ×Ô¶¯×ª»¯Îª´óд,²éѯµÄʱºòÒª´óд)
»òÕß
select grantee,privilege from dba_sys_privs
where grantee = '½ÇÉ«Ãû' order by privilege;
¾ÙÀý:²é¿´RESOURCE½ÇÉ«µÄȨÏÞ
select grantee,privilege from dba_sys_privs where grantee = 'RESOURCE' order by privilege;
GRANTEE PRIVILEGE
------------ ----------------------
RESOURCE CREATE CLUSTER
RESOURCE CREATE INDEXTYPE
RESOURCE CREATE OPERATOR
RESOURCE CREATE PROCEDURE
RESOURCE CREATE SEQUENCE
RESOURCE CREATE TABLE
RESOURCE CREATE TRIGGER
RESOURCE CREATE TYPE
¸³ÓèuserÓû§connect½ÇÉ«ºÍresource½ÇÉ«£º
grant connect,resource to user;
ÔËÐгɹ¦ºóÓû§°üÀ¨µÄȨÏÞ:
CONNECT½ÇÉ«£º --ÊÇÊÚÓè×îÖÕÓû§µÄµäÐÍȨÀû£¬×î»ù±¾µÄ
ALTER SESSION --Ð޸ĻỰ
CREATE CLUSTER --½¨Á¢¾Û´Ø
CREATE DATABASE LINK --½¨Á¢Êý¾Ý¿âÁ´½Ó
CREATE SEQUENCE --½¨Á¢ÐòÁÐ
CREATE SESSION --½¨Á¢»á»°
CREATE SYNONYM --½¨Á¢Í¬Òå´Ê
CREATE VIEW --½¨Á¢ÊÓͼ
RESOURCE ½ÇÉ«£º --ÊÇÊÚÓ迪·¢ÈËÔ±µÄ
CREATE CLUSTER --½¨Á¢¾Û´Ø
CREATE PROCEDURE --½¨Á¢¹ý³Ì
CREATE SEQUENCE --½¨Á¢ÐòÁÐ
CREATE TABLE --½¨±í
Ïà¹ØÎĵµ£º
Ö÷ÒªÊÇͨ¹ýreplaceºÍtranslateÀ´ÊµÏÖ
SQL> create view v_tt
2 as
3 select ename||' '||deptno as data
4 from emp;
View created.
SQL> select * from v_tt;
DATA
---------------------------------------------------
SMITH 20
ALLEN 30
WARD 30
JONES 20
MARTIN 30
BLAKE 30
CLARK 10
......
Ö÷Òª·½·¨ÊÇͨ¹ýʹÓÃCASE±í´ïʽÀ´“±ê¼Ç”Ò»¸öÖµÊÇ·ñΪNULL¡£ÕâÀï±ê¼ÇÓÐÁ½¸öÖµ£¬Ò»¸ö±íʾNULL£¬Ò»¸ö±íʾ·ÇNULL¡£ÕâÑù£¬Ö»ÒªÔÚORDER BY×Ó¾äÖÐÔö¼Ó±ê¼ÇÁУ¬±ã¿ÉÒÔºÜÈÝÒ׵ĿØÖÆ¿ÕÖµÊÇÅÅÔÚÇ°Ã滹ÊÇÅÅÔÚºóÃ棬¶ø²»»á±»¿ÕÖµËù¸ÉÈÅ¡£
SQL> select ename,sal,comm from emp;
ENAME SAL COMM
----- ......
ROLLUPºÍCUBEÓï¾ä¡£
OracleµÄGROUP
BYÓï¾ä³ýÁË×î»ù±¾µÄÓï·¨Í⣬»¹Ö§³ÖROLLUPºÍCUBEÓï¾ä¡£Èç¹ûÊÇROLLUP(A, B, C)µÄ»°£¬Ê×ÏÈ»á¶Ô(A¡¢B¡¢C)½øÐÐGROUP
BY£¬È»ºó¶Ô(A¡¢B)½øÐÐGROUP BY£¬È»ºóÊÇ(A)½øÐÐGROUP BY£¬×îºó¶ÔÈ«±í½øÐÐGROUP BY²Ù×÷¡£Èç¹ûÊÇGROUP BY
CUBE(A, B, C)£¬ÔòÊ×ÏÈ»á¶Ô(A¡¢B¡¢C)½øÐÐGROUP
BY£¬È»ºóÒÀ´ÎÊÇ(A¡ ......
1¡¢²é¿´±í¿Õ¼äµÄÃû³Æ¼°´óС
select t.tablespace_name, round(sum(bytes/(1024*1024)),0) ts_size
from dba_tablespaces t, dba_data_files d
where t.tablespace_name = d.tablespace_name
group by t.tablespace_name;
2¡¢²é¿´±í¿Õ¼äÎïÀíÎļþµÄÃû³Æ¼°´óС
select tablespace_name, file_id, file_name,
round(by ......
ORACLEºÍSQLÓï·¨Çø±ð¹éÄÉ
Êý¾ÝÀàÐͱȽÏ
ÀàÐÍÃû³Æ
Oracle
SQLServer
±È½Ï
×Ö·ûÊý¾ÝÀàÐÍ CHAR CHAR ¶¼Êǹ̶¨³¤¶È×Ö·û×ÊÁϵ«oracleÀïÃæ×î´ó¶ÈΪ2kb£¬SQLServerÀïÃæ×î´ó³¤¶ÈΪ8kb
±ä³¤×Ö·ûÊý¾ÝÀàÐÍ VARCHAR2 VARCHAR OracleÀïÃæ×î´ó³¤¶ÈΪ4kb£¬SQLServerÀïÃæ×î´ó³¤¶ÈΪ8kb
¸ù¾Ý×Ö·û¼¯¶ø¶¨µÄ¹Ì¶¨³¤¶È×Ö·û´® NCHAR NCHA ......