Workarounds for Scott users that do not exist in Oracle database

Source: Internet
Author: User
Tags sqlplus

Original link Address

Scott users are a very important experiment in our process of learning Oracle, and when we build a database, the Scott user does not appear by default if we choose a custom mode, but we can make this user appear by using a few simple commands. The following are the workarounds (Windows-based):

     1. Start-run--cmd        input: Sqlplus/as sysdba connect to Database        sql>conn Scott/tiger If Scott does not exist, it will report a ORA-01017 error and will disconnect the connection        2. We re-connect        sql>conn sys/password as SYSDBA with SYS user          then after we follow the Oracle catalog F:\oracle\product\10.2.0\db_1\RDBMS\ Admin (Take my directory for example) find this file of Scott.sql         run Sql>@f:\oracle\product\10.2.0\ db_1\rdbms\admin\scott.sql        so Scott users are added, the default password is tiger        sql>conn Scott/tiger Connection Successful        sql>show User;        user is "SCOTT"      3. If you want to modify Scott's default password, you can execute the following command (log in with the SYS permission: Sqlplus/as sysdba)         change Scott's login password      &nbsP; sql> alter user Scott identified by GG; you can get      4 by logging in Scott/gg. If the Scott.sql file does not exist, we can build one manually.         Create a new text document copy the following to the file, and then save it as Scott.sql, put it in the folder in 2, and then follow the steps in 2 rem Copyright (c) 1990 by Oracle Corporationrem Namerem    utlsampl. Sqlrem  functionrem  notesrem  modifiedrem gdudey   06/28/95- Modified for desktop seed D Atabaserem Glumpkin   10/21/92- renamed from Sqlbld. Sqlrem Blinden   07/27/92- added Primary and foreign keys to EMP and Deptrem Rlim   04/29/91-      change Char to Varchar2rem mmoore   04/08/91-      Use unlimited tablespace privrem pritto   04/04/91-     change SYSDATE to 13- Jul-87rem   mendels 12/07/90-bug 30123;add to_date calls so language Independentremremrem $Header: utlsampl.sq L 7020100.1 94/09/23 22:14:24 CLI generic<base> $ sqlbld.sqlremset termout OFFSET ECHO off rem Congdon    invoked in RDBMS a T build time. 29-dec-1988rem OATES:     created:16-feb-83 grant connect,resource,unlimited TABLESPACE to SCOTT identified by TIGER; ALTER USER SCOTT DEFAULT tablespace USERS; ALTER USER SCOTT temporary tablespace TEMP; CONNECT Scott/tigerdrop TABLE DEPT; CREATE TABLE dept        (DEPTNO number (2) CONSTRAINT pk_dept PRIMARY key,dname VARCHAR2 (+), LOC VARCHAR2 ();D rop TABLE EMP; CREATE TABLE emp        (EMPNO number (4) CONSTRAINT pk_emp PRIMARY key,ename VARCHAR2 (Ten), JOB VARCHAR2 (9), MGR number (4), HireDate date,sal number (7,2), COMM number (7,2), DEPTNO number (2) CONSTRAINT Fk_deptno REFERENCES DEPT); insert into DEPT values (' ACCOUNTING ', ' NEW YORK '), insert into DEPT values ( DALLAS ') insert into DEPT values ("SALES", ' CHICAGO '), insert into DEPT values ("Operati"ONS ', ' BOSTON '); INSERT into EMP VALUES (7369, ' SMITH ', ' Clerk ', 7902,to_date (' 17-12-1980 ', ' dd-mm-yyyy '), 800,null,20); Nsert 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 (' 13-jul-87 ')- 85,3000,null,20); INSERT into EMP VALUES (7839, ' KING ', ' president ', null,to_date (' 17-11-1981 ', ' dd-mm-yyyy '), 5000,null INSERT INTO EMP VALUES (7844, ' TURNER ', ' salesman ', 7698,to_date (' 8-9-1981 ', ' dd-mm-yyyy '), 1500,0,30);To EMP values (7876, ' ADAMS ', ' Clerk ', 7788,to_date (' 13-jul-87 ') -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);D rop TABLE BONUS; CREATE table BONUS (ename VARCHAR2 (Ten), JOB VARCHAR2 (9)  ,sal number,comm number);D ROP table Salgrade; CREATE TABLE salgrade       (GRADE number,losal number,hisal number); INSERT into Salgrade values (1,700,1200), insert into Salgrade values (2,1201,1400), insert into Salgrade values (3,1401,2000), insert I NTO Salgrade values (4,2001,3000); INSERT into salgrade values (5,3001,9999); Commit; set termout ONSET ECHO on

Workarounds for Scott users in the Oracle database do not exist

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.