一、HR用户的添加
1、查看$ORACLE_HOME/demo/schema/human_resources目录下是否有以下几个SQL执行文件:
hr_analz.sql
hr_code.sql
hr_comnt.sql
hr_cre.sql
hr_dn_c.sql
hr_dn_d.sql
hr_drop.sql
hr_idx.sql
hr_main.sql
hr_popul.sql
-
[oracle@TaylonMeng ~]$ cd /oracle/product/11.2.0/demo/schema/human_resources
-
[oracle@TaylonMeng human_resources]$ ls
-
hr_code.sql
我发现只有一个hr_code.sql文件,然后在网上下载了human_resources,将解压文件放在/oracle/product/11.2.0/demo/schema/human_resources下。
2、执行主脚本文件hr_main.sql,该脚本会调用其他脚本。
-
[oracle@TaylonMeng ~]$ sqlplus / as sysdba
-
-
SQL*Plus: Release 11.2.0.4.0 Production on Sat Apr 2 20:38:56 2016
-
-
Copyright (c) 1982, 2013, Oracle. All rights reserved.
-
-
-
Connected to:
-
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
-
With the Partitioning, OLAP, Data Mining and Real Application Testing options
-
-
SQL> @/oracle/product/11.2.0/demo/schema/human_resources/hr_main.sql
-
-
specify password for HR as parameter 1:
-
Enter value for 1: hr
-
-
specify default tablespeace for HR as parameter 2:
-
Enter value for 2: users
-
-
specify temporary tablespace for HR as parameter 3:
-
Enter value for 3: temp
-
-
specify password for SYS as parameter 4:
-
Enter value for 4: password
-
-
specify log path as parameter 5:
-
Enter value for 5: /oralog/hr/
3、检查安装情况
-
SQL> conn / as sysdba
-
Connected.
-
SQL> select username from dba_users;
USERNAME
------------------------------
SYS
SYSTEM
SCOTT
HR
OUTLN
APPQOSSYS
DBSNMP
WMSYS
DIP
ORACLE_OCM
10 rows selected.
SQL> conn hr/hr
Connected.
SQL> select table_name from user_tables;
TABLE_NAME
------------------------------
COUNTRIES
JOB_HISTORY
EMPLOYEES
JOBS
DEPARTMENTS
LOCATIONS
REGIONS
7 rows selected.
-
-
SQL> select EMPLOYEE_ID,HIRE_DATE,SALARY from EMPLOYEES where EMPLOYEE_ID='124';
EMPLOYEE_ID HIRE_DATE SALARY
----------- ------------------ ----------
124 16-NOV-99 5800
1 row selected.
二、SCOTT用户的添加
执行SQL文件存放路径:$ORACLE_HOME/rdbms/admin/utlsampl.sql
执行时需要使用system账户。
-
[oracle@TaylonMeng admin]$ cd $ORACLE_HOME/rdbms/admin
-
[oracle@TaylonMeng admin]$ ls utlsampl.sql
-
utlsampl.sql
-
[oracle@TaylonMeng admin]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Sat Apr 2 22:13:24 2016
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> conn system/*****
Connected.
SQL> @$ORACLE_HOME/rdbms/admin/utlsampl.sql
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
[oracle@TaylonMeng admin]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Sat Apr 2 22:14:19 2016
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> select username from dba_users;
USERNAME
------------------------------
SYS
SYSTEM
SCOTT
HR
OUTLN
APPQOSSYS
DBSNMP
WMSYS
DIP
ORACLE_OCM
10 rows selected.
SQL> conn SCOTT/tiger
Connected.
SQL> select table_name from user_tables;
TABLE_NAME
------------------------------
SALGRADE
BONUS
EMP
DEPT
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/30776559/viewspace-2074356/
,如需转载,请注明出处,否则将追究法律责任。