本文有两个目的:
1.数据库里面只安装HR用户, 19C也提供安装脚本;
2.一键安装HR、OE、SH等所有其他的用户,19C不在提供安装脚本,需要从GITHUB上下载,我已经下载完了,可以直接从本文下载或者从附上的连接直接下载,备注:下载的ZIP包 包含了所有相关联的脚本:
前言:
select tablespace_name from dba_temp_files;
select TABLESPACE_NAME,ROUND(SUM(BYTES/1024/1024),2)
CUR_M,ROUND(SUM(MAXBYTES/1024/1024),2) MAX_M from dba_data_files
where autoextensible=‘YES’ GROUP BY TABLESPACE_NAME ORDER BY 2
以SYSDBA登录.
sqlplus connect sys as sysdba
Enter password: password
SQL> @?/demo/schema/human_resources/hr_main.sql
-输入 HR的密码
specify password for HR as parameter 1:
Enter value for 1:
Enter value for 2:
Enter temp as the temporary tablespace for HR
Enter value for 3:
Enter your SYS password
specify password for SYS as parameter 4:
Enter value for 4:
specify log path as parameter 5:
Enter value for 5:
SQL> SELECT table_name FROM user_tables;
下载链接:https://github.com/oracle/db-sample-schemas/releases/tag/v19c
unzip db-sample-schemas-19c.zip
查看文件:
total 96K
drwxr-xr-x 2 oracle oinstall 230 Apr 6 2018 shipping
drwxr-xr-x 2 oracle oinstall 4.0K Apr 6 2018 sales_history
-rw-r–r-- 1 oracle oinstall 5.2K Apr 6 2018 README.txt
-rw-r–r-- 1 oracle oinstall 4.9K Apr 6 2018 README.md
drwxr-xr-x 2 oracle oinstall 4.0K Apr 6 2018 product_media
drwxr-xr-x 3 oracle oinstall 4.0K Apr 6 2018 order_entry
-rw-r–r-- 1 oracle oinstall 6.0K Apr 6 2018 mkverify.sql
-rw-r–r-- 1 oracle oinstall 6.5K Apr 6 2018 mkunplug.sql
-rw-r–r-- 1 oracle oinstall 7.0K Apr 6 2018 mksample.sql
-rw-r–r-- 1 oracle oinstall 28K Apr 6 2018 mkplug.sql
-rw-r–r-- 1 oracle oinstall 2.7K Apr 6 2018 mk_dir.sql
-rw-r–r-- 1 oracle oinstall 1.1K Apr 6 2018 LICENSE.md
drwxr-xr-x 2 oracle oinstall 79 Apr 6 2018 info_exchange
drwxr-xr-x 2 oracle oinstall 197 Apr 6 2018 human_resources
-rw-r–r-- 1 oracle oinstall 3.6K Apr 6 2018 drop_sch.sql
-rw-r–r-- 1 oracle oinstall 117 Apr 6 2018 CONTRIBUTING.md
drwxr-xr-x 2 oracle oinstall 85 Apr 6 2018 bus_intelligence
@?/demo/schema/mksample systempw syspw hrpw oepw pmpw ixpw shpw bipw
users temp /u01/dump/log dbtest19c输出示例:
SQL*Plus: Release 19.0.0.0.0 - Production on Tue Nov 5 18:00:38 2019
Version 19.3.0.0.0Copyright © 1982, 2019, Oracle. All rights reserved.
Connected to: Oracle Database 19c Enterprise Edition Release
19.0.0.0.0 - Production Version 19.3.0.0.0SYS@hd11g>@?/demo/schema/mksample systempw syspw hrpw oepw pmpw ixpw
shpw bipw users temp /u01/dump/log dbtest19cspecify password for SYSTEM as parameter 1:
specify password for SYS as parameter 2:
specify password for HR as parameter 3:
specify password for OE as parameter 4:
specify password for PM as parameter 5:
specify password for IX as parameter 6:
specify password for SH as parameter 7:
specify password for BI as parameter 8:
specify default tablespace as parameter 9:
specify temporary tablespace as parameter 10:
specify log file directory (including trailing delimiter) as parameter
11:specify connect string as parameter 12:
Sample Schemas are being created …
ERROR: ORA-01017: invalid username/password; logon denied
Warning: You are no longer connected to ORACLE. SP2-0640: Not
connected SP2-0640: Not connected SP2-0640: Not connected SP2-0640:
Not connected SP2-0640: Not connected SP2-0640: Not connected ERROR:
ORA-01017: invalid username/password; logon deniedSP2-0310: unable to open file
“SUB__CWD/human_resources/hr_main.sql” ERROR: ORA-01017: invalid
username/password; logon deniedSP2-0310: unable to open file “SUB__CWD/order_entry/oe_main.sql”
ERROR: ORA-01017: invalid username/password; logon deniedSP2-0310: unable to open file “SUB__CWD/product_media/pm_main.sql”
ERROR: ORA-01017: invalid username/password; logon deniedSP2-0310: unable to open file “SUB__CWD/info_exchange/ix_main.sql”
ERROR: ORA-01017: invalid username/password; logon deniedSP2-0310: unable to open file “SUB__CWD/sales_history/sh_main.sql”
ERROR: ORA-01017: invalid username/password; logon deniedSP2-0310: unable to open file
“SUB__CWD/bus_intelligence/bi_main.sql” ERROR: ORA-01017: invalid
username/password; logon deniednot spooling currently SP2-0310: unable to open file
“SUB__CWD/mkverify.sql” @>
SELECT OWNER,OBJECT_TYPE, COUNT(1) FROM DBA_OBJECTS where owner in (‘HR’,‘OE’,‘SH’,‘IX’,‘BI’,‘PM’,‘SCOTT’) GROUP BY OWNER,OBJECT_TYPE
ORDER BY 1;
示例输出:
HR INDEX 19
HR PROCEDURE 2
HR SEQUENCE 3
HR TABLE 7
HR TRIGGER 2
HR VIEW 1
SCOTT INDEX 2
SCOTT TABLE 4
SH TABLE 2
参考连接:
https://docs.oracle.com/en/database/oracle/oracle-database/19/comsc/installing-sample-schemas.html#GUID-1E645D09-F91F-4BA6-A286-57C5EC66321D