一、下载测试数据压缩包
https://github.com/oracle/db-sample-schemas/archive/v19.2.zip
二、解压压缩包
unzip db-sample-schemas-19.2.zip
三、修改脚本
官方压缩包中路径和我们的有可能不一样,替换成我们的当前路径
[root@T1 u01]# cd db-sample-schemas-19.2/
[root@T1 db-sample-schemas-19.2]# perl -p -i.bak -e ‘s#__SUB__CWD__#‘$(pwd)‘#g‘ *.sql */*.sql */*.dat
四、执行脚本
建议按照如下指令执行mksample.sql,避免一次次交互输入,因为这种方式下,有些用户取的账号出错,导致不能登录,另外,connect_string参数是PDB,例如localhost:1521/pdb,但可以是tnsnames.ora中的有效项
SQL> @mksample <SYSTEM_password> <SYS_password> <HR_password> <OE_password> <PM_password> <IX_password> <SH_password> <BI_password> EXAMPLE TEMP $ORACLE_HOME/demo/schema/log/(忽略为当前路径) localhost:1521/pdb
填入相应的参数后
SQL> @mksample oracle oracle hr oe pm ix sh bi users temp /u01/app/oracle/diag/rdbms/t1/T1/log/sample_log PDB
五、确认测试数据
SQL> select table_name from dba_tables where owner=‘SH‘; TABLE_NAME ------------------------------ SALES_TRANSACTIONS_EXT TIMES PRODUCTS CHANNELS PROMOTIONS CUSTOMERS COUNTRIES SUPPLEMENTARY_DEMOGRAPHICS DR$SUP_TEXT_IDX$I DR$SUP_TEXT_IDX$K DR$SUP_TEXT_IDX$U CAL_MONTH_SALES_MV FWEEK_PSCAT_SALES_MV SALES COSTS DR$SUP_TEXT_IDX$N 16 rows selected.