运行Oracle数据库示例模式脚本时出错

时间:2017-06-28 09:06:31

标签: oracle sqlplus oracle12c tnsnames

(我问过这个问题:SP2-0606: Cannot create SPOOL file,但我仍然坚持。)

我在Windows 10 pro x64上使用Oracle 12c第2版。 Oracle安装在文件夹E:\app\summer\。这是我的tnsnames.ora

# tnsnames.ora Network Configuration File: E:\app\summer\product\12.1.0\dbhome_1\network\admin\tnsnames.ora
# Generated by Oracle configuration tools.

ORACLR_CONNECTION_DATA =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
    )
    (CONNECT_DATA =
      (SID = CLRExtProc)
      (PRESENTATION = RO)
    )
  )

ORCL =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = Desktop42.example.com)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = orcl.example.com)
    )
  )

我签出了Oracle数据库示例模式脚本:

git clone https://github.com/oracle/db-sample-schemas.git
git checkout v12.1.0.2


cd /d E:\github.com\oracle\db-sample-schemas
sqlplus sys/summer as sysdba
@mksample "summer" "summer" "summer" "summer" "summer" "summer" "summer" "summer" users temp "E:\vy\" "localhost:1521/orcl"

错误:

E:\app\summer\product\12.1.0\dbhome_1\demo\schema>cd /d E:\github.com\oracle\db-sample-schemas

E:\github.com\oracle\db-sample-schemas>sqlplus sys/summer as sysdba

SQL*Plus: Release 12.1.0.2.0 Production on Wed Jun 28 15:52:19 2017

Copyright (c) 1982, 2014, Oracle.  All rights reserved.


Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options

SQL> @mksample "summer" "summer" "summer" "summer" "summer" "summer" "summer" "summer" users temp "E:\vy\" "localhost:1521/orcl"

specify 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 ...

A subdirectory or file E:\vy\ already exists.

ERROR:
ORA-12514: TNS:listener does not currently know of service requested in connect
descriptor


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-12514: TNS:listener does not currently know of service requested in connect
descriptor


SP2-0310: unable to open file "__SUB__CWD__/human_resources/hr_main.sql"
ERROR:
ORA-12514: TNS:listener does not currently know of service requested in connect
descriptor


SP2-0310: unable to open file "__SUB__CWD__/order_entry/oe_main.sql"
ERROR:
ORA-12514: TNS:listener does not currently know of service requested in connect
descriptor


SP2-0310: unable to open file "__SUB__CWD__/product_media/pm_main.sql"
ERROR:
ORA-12514: TNS:listener does not currently know of service requested in connect
descriptor


SP2-0310: unable to open file "__SUB__CWD__/info_exchange/ix_main.sql"
ERROR:
ORA-12514: TNS:listener does not currently know of service requested in connect
descriptor


SP2-0310: unable to open file "__SUB__CWD__/sales_history/sh_main.sql"
ERROR:
ORA-12514: TNS:listener does not currently know of service requested in connect
descriptor


SP2-0310: unable to open file "__SUB__CWD__/bus_intelligence/bi_main.sql"
ERROR:
ORA-12514: TNS:listener does not currently know of service requested in connect
descriptor


not spooling currently
SP2-0310: unable to open file "__SUB__CWD__/mkverify.sql"
SQL>

我的问题:

(1)什么是原因以及如何修复错误:ORA-12514: TNS:listener does not currently know of service requested in connect descriptor

(2)本操作系统指南。 https://github.com/oracle/db-sample-schemas#23-change-all-embedded-paths-to-match-your-working-directory 我正在使用Windows操作系统,如何在这种情况下修改不匹配问题?我认为在修改之后,错误SP2-0310: unable to open file "__SUB__CWD__/mkverify.sql"将被删除。

(3)如果您在我的安装(Oracle示例数据库架构)中发现任何其他错误,请告诉我。

1 个答案:

答案 0 :(得分:0)

关于您的第二个问题,我不是oracle方面的专家,但是该脚本似乎无法用当前目录替换__SUB__CWD__。无论如何,我在脚本中找到了一个提到要手动替换的站点,从您的主样本文件夹(对我来说是db-sample-schemas-12.2.0.1)运行以下命令,之后在Linux上对我有用请尝试在Windows上尝试,但您也可以使用notepad ++并在文件中查找功能来进行替换。

perl -p -i.bak -e 's#__SUB__CWD__#'$(pwd)'#g' *.sql */*.sql */*.dat