Oracle 12c sales_history示例模式安装

时间:2018-09-17 12:42:54

标签: oracle oracle12c

我正在为oracle 12c(12.2)安装示例架构。 hr模式安装正常,但是sales_order和其他模式失败。 该故障仅在可插拔数据库中发生,尤其是在

specify connect string as parameter 8:
Enter value for 8: sys/password@techfuturepdb as sysdba*

在运行示例架构脚本之前

SQL> show pdbs 
    CON_ID CON_NAME           OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
     3 TECHFUTUREPDB          READ WRITE NO

什么是连接字符串?它期望什么价值?我的tnsnames.ora文件在下面

-安装示例架构sales_history

SQL> @?/demo/schema/sales_history/sh_main.sql

specify password for SH as parameter 1:
Enter value for 1: password
specify default tablespace for SH as parameter 2:
Enter value for 2: users
specify temporary tablespace for SH as parameter 3:
Enter value for 3: temp
specify password for SYS as parameter 4:
Enter value for 4: password
specify directory path for the data files as parameter 5:
Enter value for 5: /u01/app/oracle/product/12.2/db_1/demo/schema/sales_history
writeable directory path for the log files as parameter 6:
Enter value for 6: /u01/app/oracle/product/12.2/db_1/demo/schema/log
specify version as parameter 7:
Enter value for 7: v3
specify connect string as parameter 8:
Enter value for 8: sys/password@techfuturepdb as sysdba    
Session altered.

DROP USER sh CASCADE
         *
ERROR at line 1:

ORA-01918: user 'SH' does not exist

old   1: CREATE USER sh IDENTIFIED BY &pass
new   1: CREATE USER sh IDENTIFIED BY password
User created.

old   1: ALTER USER sh DEFAULT TABLESPACE &tbs
new   1: ALTER USER sh DEFAULT TABLESPACE users
old   2:  QUOTA UNLIMITED ON &tbs
new   2:  QUOTA UNLIMITED ON users

User altered.

old   1: ALTER USER sh TEMPORARY TABLESPACE &ttbs
new   1: ALTER USER sh TEMPORARY TABLESPACE temp
User altered.

Grant succeeded.
Grant succeeded.
Grant succeeded.
Grant succeeded.
Grant succeeded.
Grant succeeded.
Grant succeeded.
Grant succeeded.
Grant succeeded.
Grant succeeded.
Grant succeeded.
Grant succeeded.
Grant succeeded.

ERROR:

ORA-12154: TNS:could not resolve the connect identifier specified

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-12154: TNS:could not resolve the connect identifier specified
SP2-0640: Not connected
SP2-0640: Not connected
SP2-0310: unable to open file "__SUB__CWD__/sales_history/csh_v3.sql"
SP2-0310: unable to open file "__SUB__CWD__/sales_history/lsh_v3.sql"
SP2-0310: unable to open file "__SUB__CWD__/sales_history/psh_v3.sql"

SQL> 

这是我的tnsnames.ora文件

# tnsnames.ora Network Configuration File: /u01/app/oracle/product/12.2/db_1/network/admin/tnsnames.ora

# Generated by Oracle configuration tools.

TECHFUTURE =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = cisnet-10.elom.tg)(PORT = 1522))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = techfuture.elom.tg)
    )
  )

LISTENER_TECHFUTURE =
  (ADDRESS = (PROTOCOL = TCP)(HOST = cisnet-10.elom.tg)(PORT = 1522))

TECHFUTUREPDB =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = cisnet-10.elom.tg)(PORT = 1522))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = TECHFUTUREPDB)
    )
  )

1 个答案:

答案 0 :(得分:0)

根据第2.3节GitHub distribution中的README文件:

  

验证数据库的连接字符串。为了说明   的目的,数据库pdb的值是:

connect_string: localhost:1521/pdb
     

connect_string可能也是有效的tnsnames.ora条目。

所以您只需要给它一个TNS别名:

specify connect string as parameter 8:
Enter value for 8: techfuturepdb

,或者如果您更喜欢EasyConnect等效项:

specify connect string as parameter 8:
Enter value for 8: cisnet-10.elom.tg:1522/techfuturepdb