--================================
--Oracle用户、对象权限、系统权限
--================================
建立表空间和用户的步骤:
用户
建立:createuser用户名identifiedby"密码";
授权:grantcreatesessionto用户名;
grantcreatetableto用户名;
grantcreatetablespaceto用户名;
grantcreateviewto用户名;
grant resource to grant connect,resource,dba to 用户; select * from user_sys_privs;查询当前用户权限 grant connect,dba to 用户;给dba权限 grant connect,resource to 用户; grant unlimited tablespace to 用户; grant create database link to 用户; grant select any sequence,create materialized view to 用户; grant unlimited tablespace to 用户;//授予不限制的表空间 grant select any table to 用户;//授予查询任何表 grant是关键字,select any table是权限,to后面是用户账号
[sql]view plaincopy
表空间
建立表空间(一般建N个存数据的表空间和一个索引空间):
createtablespace表空间名
datafile'路径(要先建好路径)***.dbf'size*M
tempfile'路径***.dbf'size*M
autoextendon
defaultstorage(
initial100K,
next100k,
);
[sql]view plaincopy
例子:创建表空间
createtablespaceDEMOSPACE
datafile'E:/oracle_tablespaces/DEMOSPACE_TBSPACE.dbf'
size1500M
autoextendonnext5Mmaxsize3000M;
删除表空间
droptablespaceDEMOSPACEincludingcontentsanddatafiles
[sql]view plaincopy
用户权限
授予用户使用表空间的权限:
alteruser用户名quotaunlimitedon表空间;
或alteruser用户名quota*Mon表空间;
完整例子:
[sql]view plaincopy
CREATETABLESPACEsdt
DATAFILE'F:tablespacedemo'size800M
EXTENTMANAGEMENTLOCALSEGMENTSPACEMANAGEMENTAUTO;
CREATETABLESPACEsdt_Index
DATAFILE'F:tablespacedemo'size512M
EXTENTMANAGEMENTLOCALSEGMENTSPACEMANAGEMENTAUTO;
createuserdemoidentifiedbydemo
defaulttablespacedemo;
grantconnect,resourcetodemo;
grantcreateanysequencetodemo;
grantcreateanytabletodemo;
grantdeleteanytabletodemo;
grantinsertanytabletodemo;
grantselectanytabletodemo;
grantunlimitedtablespacetodemo;
grantexecuteanyproceduretodemo;
grantupdateanytabletodemo;
grantcreateanyviewtodemo;
[sql]view plaincopy
ip导出方式:expdemo/demo@127.0.0.1:1521/orclfile=f:/f.dmpfull=y
expdemo/demo@orclfile=f:/f.dmpfull=y
impdemo/demo@orclfile=f:/f.dmpfull=yignore=y 大脸猫运维博客更多姿势www.itlinux.cn
(编辑:李大同)
【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!
|