Oracle12C导入scott用户的操作讲解
oracle 12c 做了很大的改变,集成了sqldeveloper,可以方便大家的使用,scott用户已经被移除了,需要的话可以自己创建,并授予权限。这个稍微有点基础的话都是很简单的……按着步骤来就可以
开始介绍下过程。
1.开始——运行——cmd
输入:sqlplus/ as sysdba连接到
2.创建#scott用户
1createuserc##scott identifiedbytiger ;
3.为用户授权
1grantconnect,resource,unlimited tablespacetoc##scott container=all;
4.设置用户使用的表空间
2alteruserc##scottdefaulttablespace users;
alteruserc##scotttemporarytablespacetemp;
5.使用c##scott用户登录
1connectc##scott/tiger
6.删除数据表
4droptableemp purge ;
droptabledept purge ;
droptablebonus purge ;
droptablesalgrade purge ;
7.创建数据表
createtabledept (
deptno number(2)constraintpk_deptprimarykey,
dname varchar2(14) ,
loc varchar2(13) ) ;
createtableemp (
empno number(4)constraintpk_empprimarykey,
ename varchar2(10),
job varchar2(9),
mgr number(4),
hiredatedate,
sal number(7,2),
comm number(7,2),
deptno number(2)constraintfk_deptnoreferencesdept );
createtablebonus (
ename varchar2(10) ,
job varchar2(9) ,
sal number,
comm number ) ;
createtablesalgrade (
grade number,
losal number,
hisal number );
8.插入测试数据——dept
4insertintodeptvalues(10,'accounting','new york');
insertintodeptvalues(20,'research','dallas');
insertintodeptvalues(30,'sales','chicago');
insertintodeptvalues(40,'operations','boston');
9.插入测试数据——emp
14insertintoempvalues(7369,'smith','clerk',7902,to_date
('17-12-1980','dd-mm-yyyy'),800,null,20);
insertintoempvalues(7499,'allen','salesman',7698,to_date
('20-2-1981','dd-mm-yyyy'),1600,300,30);
insertintoempvalues(7521,'ward','salesman',7698,to_date
('22-2-1981','dd-mm-yyyy'),1250,500,30);
insertintoempvalues(7566,'jones','manager',7839,to_date
('2-4-1981','dd-mm-yyyy'),2975,null,20);
insertintoempvalues(7654,'martin','salesman',7698,to_date
('28-9-1981','dd-mm-yyyy'),1250,1400,30);
insertintoempvalues(7698,'blake','manager',7839,to_date
('1-5-1981','dd-mm-yyyy'),2850,null,30);
insertintoempvalues(7782,'clark','manager',7839,to_date
('9-6-1981','dd-mm-yyyy'),2450,null,10);
insertintoempvalues(7788,'scott','analyst',7566,to_date
('19-04-1987','dd-mm-yyyy')-85,3000,null,20);
insertintoempvalues(7839,'king','president',null,to_date
('17-11-1981','dd-mm-yyyy'),5000,null,10);
insertintoempvalues(7844,'turner','salesman',7698,to_date
('8-9-1981','dd-mm-yyyy'),1500,0,30);
insertintoempvalues(7876,'adams','clerk',7788,to_date
('23-05-1987','dd-mm-yyyy')-51,1100,null,20);
insertintoempvalues(7900,'james','clerk',7698,to_date
('3-12-1981','dd-mm-yyyy'),950,null,30);
insertintoempvalues(7902,'ford','analyst',7566,to_date
('3-12-1981','dd-mm-yyyy'),3000,null,20);
insertintoempvalues(7934,'miller','clerk',7782,to_date
('23-1-1982','dd-mm-yyyy'),1300,null,10);
10.插入测试数据——salgrade
5insertintosalgradevalues(1,700,1200);
insertintosalgradevalues(2,1201,1400);
insertintosalgradevalues(3,1401,2000);
insertintosalgradevalues(4,2001,3000);
insertintosalgradevalues(5,3001,9999);
11.事务提交
1commit;