oracle12c how to pass in a Scott user

Source: Internet
Author: User

ORACLE12C How to pass in a Scott user

After installing ORACLE12C, unlike the original, the default is no Scott users, there is no corresponding EMP or other tables, of course, we can create one ourselves.

1. Start ---- run -----cmd

C:\users\administrator>sqlplus sys/940109 as Sysdba

Sql*plus:release 12.1.0.2.0 Production on Saturday 1 month 14:20:54

Copyright (c) 1982, Oracle. All rights reserved.

Connect to :

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 created.

Sql>

3. Authorizing the user

Sql> Grant Connect,resource to C # #scott;

Authorization is successful.

Sql>

4. Set the table space for users

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. sign in with C # #scott users

Sql> Connect C # #scott/tiger;

is 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 inserting test data -----Dept

INSERT into Dept VALUES (' ACCOUNTING ', ' NEW YORK ');

INSERT into Dept VALUES ("DALLAS");

INSERT into Dept VALUES (' SALES ', ' CHICAGO ');

INSERT into Dept VALUES (+, ' OPERATIONS ', ' BOSTON ');

7. Long as data EMP

INSERT into EMP VALUES (7369, ' SMITH ', ' Clerk ', 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 '), 1250,1400,30);

INSERT into EMP VALUES (7698, ' BLAKE ', ' 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 ') -85,3000,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 '), 1500,0,30);

INSERT into EMP VALUES (7876, ' ADAMS ', ' Clerk ', 7788,to_date (' 23-05-1987 ', ' dd-mm-yyyy ') -51,1100,null,20);

INSERT into EMP VALUES (7900, ' JAMES ', ' Clerk ', 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 ', ' Clerk ', 7782,to_date (' 23-1-1982 ', ' dd-mm-yyyy '), 1300,null,10);

8. Insert test data Salgrade

INSERT into Salgrade VALUES (1,700,1200);

INSERT into Salgrade VALUES (2,1201,1400);

INSERT into Salgrade VALUES (3,1401,2000);

INSERT into Salgrade VALUES (4,2001,3000);

INSERT into Salgrade VALUES (5,3001,9999);

9. Submit Things

Commit;

Sql> commit;

Submit complete.

oracle12c how to pass in a Scott user

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.