No Scott users ' solutions in Oracle database under Linux operating system

Source: Internet
Author: User

① log in to the database with the ' sys ' user, enter select * from dba_users; see if there are any Scott users, as shown in:

650) this.width=650; "src=" Https://s2.51cto.com/wyfs02/M01/9D/5E/wKioL1l-8maBmLr0AABqgUF9CR8135.png "title=" Qq20170731170210.png "alt=" Wkiol1l-8mabmlr0aabqguf9cr8135.png "/> As shown, the Scott user does not exist.


② because the operating system is Linux, log in to the Linux interface with Xshell, switch to the Oracle user, as shown, find the following directory to see if there are scott.sql files:

/home/oracle/product/ora11g/rdbms/admin-- The path depends on your actual path

If present, log in to the database with the SYS user and execute the following statement:

650) this.width=650; "src=" Https://s4.51cto.com/wyfs02/M02/9D/5E/wKiom1l-8-ShzwHNAAAKG1_C5E0060.png "title=" 11. PNG "alt=" Wkiom1l-8-shzwhnaaakg1_c5e0060.png "/>

If it does not exist, create the Scott.sql file under/home/oracle/product/ora11g/rdbms/admin and save the following code:


Rem Copyright (c) 1990 by Oracle Corporation

Rem NAME

REM Utlsampl. Sql

Rem FUNCTION

Rem NOTES

Rem MODIFIED

Rem Gdudey 06/28/95-modified for desktop seed database

Rem Glumpkin 10/21/92-renamed from Sqlbld. Sql

Rem Blinden 07/27/92-added Primary and foreign keys to EMP and DEPT

Rem Rlim 04/29/91-change Char to VARCHAR2

Rem mmoore 04/08/91-use Unlimited tablespace priv

Rem Pritto 04/04/91-change sysdate to 13-jul-87

Rem mendels 12/07/90-bug 30123;add to_date calls so language Independent

Rem

Rem

REM $Header: Utlsampl.sql 7020100.1 94/09/23 22:14:24 CLI generic<base> $ sqlbld.sql

Rem

SET Termout OFF

SET ECHO OFF

REM Congdon invoked in RDBMS at build time. 29-dec-1988

REM 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/tiger

DROP TABLE DEPT;

CREATE TABLE DEPT

(DEPTNO number (2) CONSTRAINT pk_dept PRIMARY KEY,

Dname VARCHAR2 (14),

LOC VARCHAR2 (13));

DROP TABLE EMP;

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);

INSERT into DEPT VALUES

(Ten, ' ACCOUNTING ', ' NEW YORK ');

INSERT into DEPT VALUES ("DALLAS");

INSERT into DEPT VALUES

(+, ' SALES ', ' CHICAGO ');

INSERT into DEPT VALUES

(+, ' OPERATIONS ', ' BOSTON ');

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 (' 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,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 (' 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);

DROP TABLE BONUS;

CREATE TABLE BONUS

(

Ename VARCHAR2 (10),

JOB VARCHAR2 (9),

SAL number,

COMM number

) ;

DROP 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 into Salgrade VALUES (4,2001,3000);

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

COMMIT;

SET Termout on

SET ECHO on


And then do it again:

650) this.width=650; "src=" Https://s5.51cto.com/wyfs02/M00/9D/5E/wKiom1l-9GCxvoIXAAAKG1_C5E0154.png "title=" 11. PNG "alt=" Wkiom1l-9gcxvoixaaakg1_c5e0154.png "/>.

To this, Scott added successfully.


If you need to modify the Scott user password, execute the following statement:

Alter user Scott identified by 123456;


What do you think? Isn't it simple?

This article is from the "Brother Hong It World" blog, so be sure to keep this source http://zhengkangkang.blog.51cto.com/12015643/1952419

No Scott users ' solutions in Oracle database under Linux operating system

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.