SP2-0606:无法创建SPOOL文件

时间:2017-06-28 04:21:12

标签: oracle sqlplus

我在Windows 10 pro x64上使用Oracle 12c R2。我通过

获取示例脚本
cd E:\github.com\oracle
git clone https://github.com/oracle/db-sample-schemas.git
CMD中的

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

SQL*Plus: Release 12.1.0.2.0 Production on Wed Jun 28 11:15:24 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> @hr_main.sql

specify password for HR as parameter 1:
Enter value for 1: 123456

specify default tablespeace for HR as parameter 2:
Enter value for 2: hr_tablespace

specify temporary tablespace for HR as parameter 3:
Enter value for 3: hr_temp_tablespace

specify password for SYS as parameter 4:
Enter value for 4: summer

specify log path as parameter 5:
Enter value for 5: C:\vy\

specify connect string as parameter 6:
Enter value for 6: localhost:1521/orcl

SP2-0606: Cannot create SPOOL file "C:\vy\hr_main.log"
DROP USER hr CASCADE
          *
ERROR at line 1:
ORA-01918: user 'HR' does not exist


CREATE USER hr IDENTIFIED BY 123456
            *
ERROR at line 1:
ORA-65096: invalid common user or role name


ALTER USER hr DEFAULT TABLESPACE hr_tablespace
           *
ERROR at line 1:
ORA-01918: user 'HR' does not exist


ALTER USER hr TEMPORARY TABLESPACE hr_temp_tablespace
           *
ERROR at line 1:
ORA-01918: user 'HR' does not exist


GRANT CREATE SESSION, CREATE VIEW, ALTER SESSION, CREATE SEQUENCE TO hr
                                                                     *
ERROR at line 1:
ORA-01917: user or role 'HR' does not exist


GRANT CREATE SYNONYM, CREATE DATABASE LINK, RESOURCE , UNLIMITED TABLESPACE TO hr
                                                                               *
ERROR at line 1:
ORA-01917: user or role 'HR' does not exist


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


SP2-0640: Not connected
SP2-0640: Not connected
SP2-0310: unable to open file "E:\github.com\oracle\db-sample-schemas\human_resources\human_resources\hr_cre.sql"
SP2-0310: unable to open file "E:\github.com\oracle\db-sample-schemas\human_resources\human_resources\hr_popul.sql"
SP2-0310: unable to open file "E:\github.com\oracle\db-sample-schemas\human_resources\human_resources\\hr_idx.sql"
SP2-0310: unable to open file "E:\github.com\oracle\db-sample-schemas\human_resources\human_resources\\hr_code.sql"
SP2-0310: unable to open file "E:\github.com\oracle\db-sample-schemas\human_resources\human_resources\\hr_comnt.sql"
SP2-0310: unable to open file "E:\github.com\oracle\db-sample-schemas\human_resources\human_resources\\hr_analz.sql"
not spooling currently
SQL>

如何解决这些错误:

SP2-0606: Cannot create SPOOL file
ORA-01918: user 'HR' does not exist
ORA-65096: invalid common user or role name

2 个答案:

答案 0 :(得分:2)

首先是简单的:

  

ORA-01918:用户' HR'不存在

该脚本以预防性drop user语句开头。您之前没有运行该脚本,因此没有HR用户可以删除。因此消息。你可以忽略它。

  

ORA-65096:无效的普通用户或角色名称

您提供的密码无效:Enter value for 1: 123456。无论出于何种原因,Oracle密码遵循与对象名称类似的规则,这意味着密码必须以字母开头 - 除非它用双引号括起来。

现在这是一个棘手的问题:

  

SP2-0606:无法创建SPOOL文件

那么,目录C:\vy是否存在?您的用户是否具有写入权限?

答案 1 :(得分:0)

我有同样的问题。

您需要在runnig" hr_main.sql"之前创建HR用户。请遵循以下步骤::

<强> SQL&GT; connect sys as sysdba

输入密码:

连接。

<强> SQL&GT;创建由oracle识别的用户HR;

用户创建。

<强> SQL&GT; @?/演示/模式/ human_resources / hr_main.sql

以及指南中的下一步: https://docs.oracle.com/database/121/COMSC/installation.htm#COMSC109