How does Oracle12c import scott users and oracle12c import scott
How does Oracle12c input scott users?
After installing oracle12c, unlike the original one, there is no scott user by default, and there is no corresponding emp or other tables. Of course, we can create one by ourselves.
1. Start ---- run ----- cmd
C: \ Users \ Administrator> sqlplus sys/940109 as sysdba
SQL * Plus: Release 12.1.0.2.0 Production on Saturday January 10 14:20:54 2015
Copyright (c) 1982,201 4, Oracle. All rights reserved.
Connect:
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0-64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing opt
Ions
SQL>
2. Create a c # scott user
SQL> create user c # scott identified by tiger;
The user has been created.
SQL>
3. Authorize the user
SQL> grant connect, resource to c # scott;
Authorization successful.
SQL>
4. Set the user's tablespace
SQL> alter user c # scott default tablespace users;
The user has changed.
SQL> alter user c # scott temporary tablespace temp
The user has changed.
5. Log On with c # scott user
SQL> connect c # scott/tiger;
Connected.
SQL>
6. Create Table Data
Create table dept (
Deptno NUMBER (2) CONSTRAINT PK_DEPT primary key,
Dname VARCHAR2 (14 ),
Loc VARCHAR2 (13 ));
Create table emp (
Empno NUMBER (4) CONSTRAINT PK_EMP primary key,
Ename VARCHAR2 (10 ),
Job VARCHAR2 (9 ),
Mgr NUMBER (4 ),
Hiredate DATE,
Sal NUMBER (7,2 ),
Comm NUMBER (7, 2 ),
Deptno NUMBER (2) CONSTRAINT FK_DEPTNO references dept );
Create table bonus (x
EnamE VARCHAR2 (10 ),
Job VARCHAR2 (9 ),
Sal NUMBER,
Comm NUMBER );
Create table salgrade (
Grade NUMBER,
Losal NUMBER,
Hisal NUMBER );
7. Insert test data ----- dept
Insert into dept VALUES (10, 'accounting', 'New YORK ');
Insert into dept VALUES (20, 'Research ', 'Dallas ');
Insert into dept VALUES (30, 'sales', 'Chicago ');
Insert into dept VALUES (40, 'operations', 'boston ');
7. emp
Insert into emp VALUES (7369, 'Smith ', 'cler', 7902, to_date ('17-12-1980', 'dd-mm-yyyy'), 800, NULL, 20 );
Insert into emp VALUES (7499, 'allen ', 'salesman', 7698, to_date ('20-2-1981', 'dd-mm-yyyy '), 1600,300, 30 );
Insert into emp VALUES (7521, 'ward ', 'salesman', 7698, to_date ('22-2-1981', 'dd-mm-yyyy '), 1250,500, 30 );
Insert into emp VALUES (7566, 'Jones ', 'manager', 7839, to_date ('2-4-1981', 'dd-mm-yyyy '), 2975, NULL, 20 );
Insert into emp VALUES (7654, 'martin ', 'salesman', 7698, to_date ('28-9-1981', 'dd-mm-yyyy'), 30 );
Insert into emp VALUES (7698, 'bucke', 'manager', 7839, to_date ('1-5-1981 ', 'dd-mm-yyyy'), 2850, NULL, 30 );
Insert into emp VALUES (7782, 'clark', 'manager', 7839, to_date ('9-6-1981 ', 'dd-mm-yyyy'), 2450, NULL, 10 );
Insert into emp VALUES (7788, 'Scott ', 'analyst', 7566, to_date ('19-04-1987', 'dd-mm-yyyy')-, NULL, 20 );
Insert into emp VALUES (7839, 'King', 'President ', NULL, to_date ('17-11-1981', 'dd-mm-yyyy'), 5000, NULL, 10 );
Insert into emp VALUES (7844, 'turner ', 'salesman', 7698, to_date ('8-9-1981', 'dd-mm-yyyy'), 0, 30 );
Insert into emp VALUES (7876, 'adams', 'cler', 7788, to_date ('23-05-1987 ', 'dd-mm-yyyy')-, NULL, 20 );
Insert into emp VALUES (7900, 'James ', 'cler', 7698, to_date ('3-12-1981', 'dd-mm-yyyy'), 950, NULL, 30 );
Insert into emp VALUES (7902, 'Ford ', 'analyst', 7566, to_date ('3-12-1981', 'dd-mm-yyyy '), 3000, NULL, 20 );
Insert into emp VALUES (7934, 'miller ', 'cler', 7782, to_date ('23-1-1982', 'dd-mm-yyyy '), 1300, NULL, 10 );
8. Insert test data salgrade
Insert into salgrade VALUES (1,700,120 0 );
Insert into salgrade VALUES (1400 );
Insert into salgrade VALUES (2000 );
Insert into salgrade VALUES (4,2001, 3000 );
Insert into salgrade VALUES (5, 3001, 9999 );
9. Submit things
Commit;
SQL> commit;
Submitted.