【问题标题】:Error when run Oracle database sample schema script运行 Oracle 数据库示例模式脚本时出错
【发布时间】:2017-12-01 13:31:35
【问题描述】:

(我问了这个问题: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) 本指南适用于 Linux 操作系统。 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 示例数据库架构),请告诉我。

【问题讨论】:

  • 我假设您在多租户架构中安装了 Oracle?我在某处(我相信在 OTN 上,如果我能找到它,我会发布一个链接)读到 Oracle 没有费心修改脚本来安装示例模式以在该架构中工作。

标签: oracle sqlplus oracle12c tnsnames


【解决方案1】:

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

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2011-01-06
    • 2020-09-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多