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 ...
随机推荐
- 判断IP地址的类型
#include <stdio.h> #include <stdlib.h> void main() { ]; int ip_addr; printf("请输入IP地 ...
- thinkphp 介绍
一.ThinkPHP的介绍 MVC M - Model 模型 工作:负责数据的操作 V - View 视图(模板) 工作:负责 ...
- C++模板实例化
深入理解C++中第七章提到模板实例化参数的选择:函数的决议结果只和函数参数有关和返回值无关.记录一下. 测试程序如下: #include <iostream> using namespac ...
- LintCode Minimum Path Sum
Given a m x n grid filled with non-negative numbers, find a path from top left to bottom right which ...
- 转载《SimpleAdapter的参数说明》
SimpleAdapter的参数说明 第一个参数 表示访问整个android应用程序接口,基本上所有的组件都需要 第二个参数表示生成一个Map(String ,Object)列表选项 第三个参数表示界 ...
- 转载《Android-TabHost 选项卡功能用法详解》
一. TabHost介绍 TabHost组件可以在界面中存放多个选项卡, 很多软件都使用了改组件进行设计; 1. TabHost常用组件 TabWidget : 该组件就是TabHost标签页中上部 ...
- 通过js的console优雅的将php调试信息输出
function consoleLog($val){ $debug = debug_backtrace(); unset($debug[0]['args']); echo '<script> ...
- boolalpha的用法和作用
#include <iostream> using namespace std; int main() { bool b=true; cout << "b=" ...
- codeforces 733D
明白了自己这么菜的原因多半是赛后不肯去补那些需要多花点时间思考的题目以及效率不高,但愿现在还不算晚... #include<bits/stdc++.h> #include<iostr ...
- Linear Algebra lecture10 note
Four fundamental subspaces( for matrix A) if A is m by n matrix: Column space C(A) in Rm (列空间在m维实 ...