Oracle补习班第八天
The best hearts are always the bravest.
心灵最高尚的人,也总是最勇敢的人。
1,权限、角色、与用户
创建用户
create user aa identified by 123456;
create user bb identified by 123456;
create user cc identified by 123456;
创建角色
create role hr_clerk;
create role hr_mgr;
给角色赋权
grant create table to hr_mgr;
grant select on scott.emp to hr_mgr;
grant create session to hr_mgr;
grant select on scott.emp to hr_clerk;
grant create session to hr_clerk;
grant insert on scott.emp to hr_clerk;
grant update on scott.emp to hr_clerk;
给用户角色
grant hr_mgr,hr_clerk to aa;
grant hr_clerk to bb,cc;
总结:角色是权限的集合
oracle是有预定义角色的,常用的CONNECT,RESOURCE,DBA
2,将数据加载到数据库中使用SQL loader工具
操作步骤逻辑如下:
新建一个txt文档,写入需要插入的数据;
新建一个ctl文件,写入参数;
sqlldr scott/tiger@orcl02 control=/tmp/sqlldr.ctl;
实验具体步骤如下:
select ename from scott.emp;
vim /tmp/'the data need to be insert.txt' #粘贴上面数据到txt
vim/tmp/sqlldr.ctl
load data
infile '/tmp/'the data need to be insert.txt''
into table emp1
fields terminated by ','
(ename)
sqlldr scott/tiger@orcl2 control=/tmp/sqlldr.ctl
select * from emp1;
实验插入两行数据步骤如下:
select ename||','||empno from scott.emp
vim /tmp/'the data need to be insert2.txt'
vim /tmp/sqlldr2.ctl
load data
infile '/tmp/'the data need to be insert2.txt''
into table emp2
fields terminated by ','
(ename,empno)
sqldr scott/tiger control=/tmp/sqlldr2.ctl
3,在数据库之间传输数据,使用工具exp,imp
交互式导出用户
exp
username:scott
passwd:tiger
enter array fetch buffer size:4096>1000000
export file:expdat.dmp>/tmp/scott.dmp
user,or table>U
export grants>yes
export table data>yes
compress extents>no
命令式导出用户
exp "'sys/oracle as sysdba'" BUFFER=1000000 FILE=/tmp/sys.dmp OWNER=sys
参数文件方式导出
vim /tmp/scott.par
USERID=scott/tiger
FILE=/tmp/sys.dmp
BUFFER=1000000
OWNER=sys
LOG=/tmp/sys_exp.log
exp parfile=/tmp/scott.par
总结:exp导出有三种方法,交互式,命令行,参数式。
关键字:数据库full=y,用户owner,表空间tablespaces,表tables,查看exp help=y
exp scott/tiger buffer=1000000 file=/tmp/test.dmp tables=emp quary=\'where deptno=30\'
exp scott/tiger buffer=1000000 file=/tmp/test.dmp tables=emp row=no #表结构
4,在数据库之间传输数据,使用工具expdp,impdp
$ mkdir /tmp/dmpdir
> create or replace directory dmpdir as '/tmp/dmpdir';
> grant read,write on directory dmpdir to scott;
$ expdp scott/tiger dumpfile=scott.dmp directory=dmpdir
$ expdp system/oracle dumpfile=system_scott.dmp directory=dmpdir schemas=system,scott
Oracle补习班第八天的更多相关文章
- Oracle补习班第三天
In every triumph, there's a lot of try. 每个胜利背后都有许多尝试 Oracle管理实例组件 主要组件分为两部分例程,与数据库: 例程分为两部分SGA跟进程: S ...
- Oracle补习班第四天
Everything has its time and that time must be watched. 万物皆有时,时来不可失 1,管理参数文件 参数文件分两种spfile二进制文件和pfile ...
- Oracle补习班第五天
Great minds have purpose,others have wishes. 杰出的人有着目标,其他人只有愿望 控制文件是小型二进制文件,只能在mount阶段新建 1,重做控制文件 alt ...
- Oracle补习班第七天
Keep conscience clear, then never fear. 问心无愧,永无畏惧 服务端监听 lsnrctl status #查看监听服务 netca #配置动态监听 lsnrct ...
- Oracle补习班第九天
Better to light one candle than to curse the darkness. 与其诅咒黑暗,不如点亮烛光! 1,用SQL备份数据库数据文件 sqlplus / as s ...
- Oracle补习班第一天
My life is a straight line, turning only for you. 我的人生是一条直线,为你转弯
- Oracle补习班第十天
Life without love is like a tree without blossoms or fruit. 缺少爱的生活就像从未开花结果的枯树 RMAN备份工具 crosscheck ba ...
- Oracle课程档案,第八天
存储管理 查询块的大小:show parameter db_block_size database:数据库 tablespace:表空间 datafile:数据文件 segments:段 extent ...
- BOS物流管理系统-第八天
BOS物流管理系统-第八天-权限系统设计-Shiro 回顾: 两大块业务:基础设置模块,业务派单模块. 两天:权限控制. 拦截器大的范围的.纯登录级别(认证级别)大颗粒的权限控制的一种技术. Shir ...
随机推荐
- WPF(WP7、WP8)多个Listbox嵌套时滚动问题的解决
内部的ListBox加属性 ScrollViewer.VerticalScrollBarVisibility="Disabled" 即可 如果不需要滚动,可以考虑嵌套换成 Item ...
- <转>人生与最速曲线
看完你好象发现了什么o(∩_∩)o 来源网络 来自为知笔记(Wiz)
- mysql group by后 拼接某一字段
SQL> select * from tmp10; JS ND JM--------- ----- -------------------------------------------- ...
- 详解 IOS 7.1 程序启动原理
程序都是从Main方法入口的 IOS 也不例外 int main(int argc,char * argv[]) { @autoreleasepool { return UIApplicationMa ...
- a标签不跳转
<a href="javascript://">父级菜单</a> 结果是这种写法在一些浏览器下不能到达预期效果(无跳转),我没有花时间把这种写法在主流浏览器 ...
- MySQL, 创建一个只读用户和一个所有权限用户
安装pasa需要配置mysql.基本知识学习一下 http://www.cnblogs.com/mr-wid/archive/2013/05/09/3068229.html MySQL 为关系型数据库 ...
- Qt4编码
#if QT_VERSION < 0x050000 qDebug() << "qt5以下的版本, 从QTextCodec设置全局字符集"; QTextCodec* ...
- ased
1.document.write(""); 输出语句 2.JS 中的注释为 // 3. 传统的 HTML 文档顺序是 :document->html->(head,bo ...
- CGGeometry类定义几何元素的结构和操作几何元素的函数。
1.数据类型: CGFloat: 浮点值的基本类型CGPoint: 表示一个二维坐标系中的点CGSize: 表示一个矩形的宽度和高度CGRect: 表示一个矩形的位置和大小 typedef float ...
- LeetCode() Largest Number
全排列,超时,知道超时,只是想验证一下. class Solution { public: string largestNumber(vector<int>& nums) { so ...