Oracle provides the scott user's re-creation script, and the 11G uses the script to create scott. The simple operation is as follows:
SQL> select * from dba_users where username = 'Scott '; ------ SCOTT has been manually deleted.
No rows selected
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.3.0-64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
@ Pekdc1-vcm-03: [/usr/app/oracle/110203/v04/rdbms/admin]
$ Cd $ ORACLE_HOME/rdbms/admin ------ script location
@ Pekdc1-vcm-03: [/usr/app/oracle/110203/v04/rdbms/admin]
$ Ls-lxr utlsampl. SQL
-Rw-r -- 1 oracle oinstall 3.6 K May 28 2013 utlsampl. SQL
@ Pekdc1-vcm-03: [/usr/app/oracle/110203/v04/rdbms/admin]
$ Sqlplus/as sysdba
SQL * Plus: Release 11.2.0.3.0 Production on Mon Mar 24 10:15:29 2014
Copyright (c) 1982,201 1, Oracle. All rights reserved.
Connected:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0-64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> @ utlsampl. SQL ------ run the script. After the script is completed, sqlplus is automatically exited.
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.3.0-64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
@ Pekdc1-vcm-03: [/usr/app/oracle/110203/v04/rdbms/admin]
$ Sqlplus scott/tiger
SQL * Plus: Release 11.2.0.3.0 Production on Mon Mar 24 10:15:47 2014
Copyright (c) 1982,201 1, Oracle. All rights reserved.
Connected:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0-64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> show user
USER is "SCOTT"
SQL> select table_name from user_tables;
TABLE_NAME
------------------------------
DEPT
EMP
BONUS
SALGRADE
SQL> select * from emp;
EMPNO ENAME JOB MGR HIREDATE SAL COMM
--------------------------------------------------------------------
DEPTNO
----------
7369 smith clerk 7902 17-DEC-80 800
20
7499 allen salesman 7698 20-FEB-81 1600 300
30
7521 ward salesman 7698 22-FEB-81 1250 500
30
EMPNO ENAME JOB MGR HIREDATE SAL COMM
--------------------------------------------------------------------
DEPTNO
----------
7566 jones manager 7839 02-APR-81 2975
20
7654 martin salesman 7698 28-SEP-81 1250 1400
30
7698 blake manager 7839 01-MAY-81 2850
30
EMPNO ENAME JOB MGR HIREDATE SAL COMM
--------------------------------------------------------------------
DEPTNO
----------
7782 clark manager 7839 09-JUN-81 2450
10
7788 scott analyst 7566 19-APR-87 3000
20
7839 king president 17-NOV-81 5000
10
EMPNO ENAME JOB MGR HIREDATE SAL COMM
--------------------------------------------------------------------
DEPTNO
----------
7844 turner salesman 7698 08-SEP-81 1500 0
30
7876 adams clerk 7788 23-MAY-87 1100
20
7900 james clerk 7698 03-DEC-81 950
30
EMPNO ENAME JOB MGR HIREDATE SAL COMM
--------------------------------------------------------------------
DEPTNO
----------
7902 ford analyst 7566 03-DEC-81 3000
20
7934 miller clerk 7782 23-JAN-82 1300
10
14 rows selected.
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.3.0-64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
@ Pekdc1-vcm-03: [/usr/app/oracle/110203/v04/rdbms/admin]
$ More utlsampl. SQL ------ script content
Rem Copyright (c) 1990,200 6, Oracle. All rights reserved.
Rem NAME
Rem utlsampl. SQL
Rem FUNCTION
Rem NOTES
Rem MODIFIED
Rem lburgess 04/02/06-lowercase passwords
Rem menash 02/21/01-remove unnecessary users for security reasons
Rem gwood 03/23/99-make all dates Y2K compliant
Rem jbellemo 02/27/97-dont connect as system
Rem akolk 08/06/96-bug 368261: Adding date formats
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 CILS so language independent
Rem
Rem
Rem $ Header: utlsampl. SQL 02-apr-2006.21: 13: 01 lburgess Exp $ 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
Drop user scott cascade;
Drop user adams cascade;
Drop user jones cascade;
Drop user clark cascade;
Drop user blake cascade;
Grant connect, RESOURCE, unlimited tablespace to scott identified by tiger;
Drop public synonym parts;
Connect scott/tiger
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 );
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 ');
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 ('13-JUL-87', 'dd-mm-rr ')-, 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 ('13-JUL-87 ', 'dd-mm-rr')-, 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 );
CREATE TABLE BONUS
(
ENAME VARCHAR2 (10 ),
JOB VARCHAR2 (9 ),
Sal number,
COMM NUMBER
);
CREATE TABLE SALGRADE
(Grade number,
Losal number,
Hisal number );
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 );
COMMIT;
EXIT
@ Pekdc1-vcm-03: [/usr/app/oracle/110203/v04/rdbms/admin]