How to import scott to Oracle12C, oracle12cscott

Source: Internet
Author: User

How to import scott to Oracle12C, oracle12cscott

Oracle 12C has made great changes and has integrated SQLDeveloper for your convenience. scott users have been removed and can create and grant permissions if needed. This is a little basic ...... Follow these steps.

Start the process.

1. Start -- run -- cmd

Input: sqlplus/as sysdba connecting to database

2. Create a c # scott user

1 CREATEUSERc # scott IDENTIFIEDBYtiger;

3. Authorize the user

1 GRANTCONNECT, RESOURCE, UNLIMITED TABLESPACETOc # scott CONTAINER = ALL;

4. Set the tablespace used by the user

2 ALTERUSERc # scottDEFAULTTABLESPACE USERS;

ALTERUSERc # scottTEMPORARYTABLESPACETEMP;

5. Log On with c # scott user

1 CONNECTc # scott/tiger

6. delete a data table

4 DROPTABLEemp PURGE;

DROPTABLEdept PURGE;

DROPTABLEbonus PURGE;

DROPTABLEsalgrade PURGE;

7. Create a data table

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. Insert test data -- dept

4 INSERTINTOdeptVALUES (10, 'accounting', 'New YORK ');

INSERTINTOdeptVALUES (20, 'Research ', 'Dallas ');

INSERTINTOdeptVALUES (30, 'sales', 'Chicago ');

INSERTINTOdeptVALUES (40, 'operations', 'boston ');

9. Insert test data -- emp

14 INSERTINTOempVALUES (7369, 'Smith ', 'cler', 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, 'bucke', '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')-, 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'), 0, 30 );

INSERTINTOempVALUES (7876, 'adams', 'cler', 7788, to_date

('23-05-1987 ', 'dd-mm-yyyy')-, NULL, 20 );

INSERTINTOempVALUES (7900, 'James ', 'cler', 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 ', 'cler', 7782, to_date

('23-1-1982 ', 'dd-mm-yyyy'), 1300, NULL, 10 );

10. Insert test data-salgrade

5 INSERTINTOsalgradeVALUES (1,700,120 0 );

INSERTINTOsalgradeVALUES (1400 );

INSERTINTOsalgradeVALUES (2000 );

INSERTINTOsalgradeVALUES (4,2001, 3000 );

INSERTINTOsalgradeVALUES (5, 3001, 9999 );

11. Transaction submission

1 COMMIT;

Related Article

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.