SP2-0606: Cannot create SPOOL file

孤者浪人 提交于 2019-12-12 04:03:14

问题


I use Oracle 12c R2 on Windows 10 pro x64. I get sample script by

cd E:\github.com\oracle
git clone https://github.com/oracle/db-sample-schemas.git

in 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>

How to fix these error:

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

回答1:


The easy ones first:

ORA-01918: user 'HR' does not exist

The script starts with a precautionary drop user statement. You haven't run the script before so there is no HR user to drop. Hence the message. You can ignore it.

ORA-65096: invalid common user or role name

You have given an invalid password: Enter value for 1: 123456. For whatever reasons Oracle passwords follow similar rules to object names, which means the password must start with a letter - unless it's wrapped in double-quotes.

Now this is a trickier issue:

SP2-0606: Cannot create SPOOL file

So, does directory C:\vy exist? Does your user have write access to it?




回答2:


I had same issue.

You need create HR user before runnig "hr_main.sql". Follow next steps::

SQL> connect sys as sysdba

Enter password:

Connected.

SQL> create user HR identified by oracle;

User created.

SQL> @?/demo/schema/human_resources/hr_main.sql

and next step as in guide: https://docs.oracle.com/database/121/COMSC/installation.htm#COMSC109



来源:https://stackoverflow.com/questions/44793600/sp2-0606-cannot-create-spool-file

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!