Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

10g/11g creates a scott sample user

2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

Script to create a scott user in oracle 10g:

Create script, $ORACLE_HOME/sqlplus/demo/demobld.sql

Delete script, $ORACLE_HOME/sqlplus/demo/demodrop.sql

Execute after creation

Alter table emp add constraint emp_pk primary key (empno);-add a primary key to the empno column in the emp table

Alter table dept add constraintdept_pk primary key (deptno);-add a primary key to the deptno column in the dept table

Alter table emp add constraint emp_fk_dept foreign key (deptno) references dept;-Associate the deptno column in the dept table in the emp table

Alter table emp add constraint emp_fk_emp foreign key (mgr) references emp;-Associate the mgr column in the emp table in the emp table

The script to create the scott user in oracle 11g:

Create script: $ORACLE_HOME/rdbms/admin/utlsampl.sql

Delete user statement: drop user scott

Example:

[oracle@enmoedu1 admin] $pwd

/ u01/app/oracle/product/11.2.0/dbhome_1/rdbms/admin

SQL > @ utlsampl

Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.3.0-Production

With the Partitioning, OLAP, Data Mining and Real Application Testing options

[oracle@enmoedu1 admin] $

Connected to:

Oracle Database 11g Enterprise Edition Release 11.2.0.3.0-Production

With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL > conn scott/tiger

Connected.

Delete scott user

SQL > conn / as sysdba

Connected.

SQL > drop user scott cascade

User dropped.

If you do not have a script, you can also manually create sample tables to other users

SQL > create user only identified by oracle

User created.

SQL > grant connect,resource to only

Grant succeeded.

Execute the following statement

DROP USER SCOTT CASCADE

DROP USER ADAMS CASCADE

DROP USER JONES CASCADE

DROP USER CLARK CASCADE

DROP USER BLAKE CASCADE

DROP PUBLIC SYNONYM PARTS

CONNECT only/oracle # the user created by the sample table

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 dint 2)

COMM NUMBER (7 dint 2)

DEPTNO NUMBER (2) CONSTRAINT FK_DEPTNO REFERENCES DEPT)

INSERT INTO DEPT VALUES

(10 recordings of ACCOUNTINGINGY new YORK')

INSERT INTO DEPT VALUES (20 people who are responsible for reparations and dalas)

INSERT INTO DEPT VALUES

(30 minutes, saleses, records, and CHICAGO')

INSERT INTO DEPT VALUES

(40 minutes of operation and presentation of books)

INSERT INTO EMP VALUES

(7369 pensionary SMITHMIZOMYYYYYY) ('17-12-1980memoodlyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy

INSERT INTO EMP VALUES

(7499) (7499) (7499) (7499)

INSERT INTO EMP VALUES

(7521 Japanese WARDLESMANTHER 7698 memoir tokendate ('22-2-1981) ('22-2-1981))

INSERT INTO EMP VALUES

(756 MANAGERMANAGERMANAGERTHERMANAGERMANAGERMANAGERMANAGERMANAGERMANAGERMANAGERMANAGERMANAGERMANAGERMANAGERMANAGERMANAGERMANAGERMANAGERMANAGERMANAGERMANAGERMANAGERMANAGERMANAGERMANAGERMANAGERTHY, 756 ('2-4-1981)

INSERT INTO EMP VALUES

(7654 MARTINGRIMMYYYYY) 7654 MARTINGRIMMMYYYYY) ('28-9-1981)

INSERT INTO EMP VALUES

(7698) (7698) (7698) (7839) ('1-5-1981)) ('1-5-1981) ('1-5-1981); ('2850)

INSERT INTO EMP VALUES

(7782 MANAGERMANAGERMANAGERMANAGERMANAGERMANAGERMANAGERMANAGERMANAGERMANAGERMANAGERMANAGERMANAGERMANAGERMANAGERMANAGERMANAGERMANAGERMANAGERMANAGERMANAGERMANAGERMANAGERMANAGERMANAGERTH, 7782 ('9-6-1981), ('9-6-1981)

INSERT INTO EMP VALUES

(7788) (7788). (7788)

INSERT INTO EMP VALUES

(7839 KINGLINGHANGYYYYYYYY) ('17-11-1981)

INSERT INTO EMP VALUES

(784) 784, "turnera", "Salesmans,"7698", "768," ('8-9-1981), "

INSERT INTO EMP VALUES

(7876 dd-mm-rr')-51, 1100, null, 20)

INSERT INTO EMP VALUES

(7900JAMESZHANGJAMESMYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY)

INSERT INTO EMP VALUES

(7902 FORDIMULYYY) 766 FORDIZHERMYYYYYYY ('3-12-1981)

INSERT INTO EMP VALUES

(7934 MILLERMYYYYY) 7782 MILLERMYYYY ('23-1-1982)), 1300 NULLPerry 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 (1pm 700,1200)

INSERT INTO SALGRADE VALUES (2Jing 120151400)

INSERT INTO SALGRADE VALUES (3meme 1401jue 2000)

INSERT INTO SALGRADE VALUES (4Jing 2001 03000)

INSERT INTO SALGRADE VALUES (5pm 30019999)

COMMIT

Source "9i/10g programming Art"

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report