0

我可以通过

sqlplus / as sysdba

然后我使用启动启动实例,我也可以使用启动 PDB

startup pluggable database pdborcl 

在终端中, echo $ORACLE_SID 获取 ora12cr1

但我无法使用登录

sqlplus  /@ora12cr1 as sysdba

我得到了 ORA-01017:无效的用户名/密码;登录被拒绝。下面是我的 tnsnames.ora:

ORA12CR1=
  (DESCRIPTION=
    (ADDRESS = (PROTOCOL = TCP)(HOST = localhost.localdomain)(PORT = 1521))
    (CONNECT_DATA=
      (SERVER = DEDICATED)
      (SERVICE_NAME = orcl.cn.oracle.com)
    )
  )

PDBORCL =
 (DESCRIPTION =
   (ADDRESS = (PROTOCOL = TCP)(HOST = localhost.localdomain)(PORT = 1521))
     (CONNECT_DATA =
       (SERVICE_NAME = pdborcl.cn.oracle.com)
     )
 )

oracle 12cr1 安装在我的本地机器上。

lsnrctl 状态获取:

LSNRCTL for Linux: Version 12.1.0.1.0 - Production on 11-SEP-2013 23:02:57

Copyright (c) 1991, 2013, Oracle.  All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 12.1.0.1.0 - Production
Start Date                11-SEP-2013 22:40:09
Uptime                    0 days 0 hr. 22 min. 48 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /u01/app/oracle/product/12.1.0/db_1/network/admin/listener.ora
Listener Log File         /u01/app/oracle/diag/tnslsnr/localhost/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=localhost.localdomain)(PORT=1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcps)(HOST=localhost.localdomain)(PORT=5500))(Security=(my_wallet_directory=/u01/app/oracle/admin/orcl/xdb_wallet))(Presentation=HTTP)(Session=RAW))
Services Summary...
Service "orcl.cn.oracle.com" has 1 instance(s).
  Instance "ora12cr1", status READY, has 1 handler(s) for this service...
Service "orclXDB.cn.oracle.com" has 1 instance(s).
  Instance "ora12cr1", status READY, has 1 handler(s) for this service...
Service "pdborcl.cn.oracle.com" has 1 instance(s).
  Instance "ora12cr1", status READY, has 1 handler(s) for this service...
The command completed successfully

SQL> show pdbs

    CON_ID CON_NAME           OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
     3 PDBORCL            READ WRITE NO

alter session set container = pdborcl

也有效。

4

3 回答 3

0

我在用

sqlplus sys@pdborcl as sysdba

并输入密码。

show con_name;

产生价值

CON_NAME
------------------------------
PDBORCL
于 2014-10-11T22:01:31.233 回答
0

尝试

sqlplus /@localhost.localdomain/orcl.cn.oracle.com as sysdba

如果这是您要登录的服务(不确定我是否完全理解您的问题)。

于 2013-09-12T00:38:42.660 回答
0

using/ AS SYSDBA将像以前版本的container database级别 (CDB) 一样工作。但它无法pluggable database通过 sqlplus 连接到没有密码的(PDB)。

实现这一点的最简单方法是使用“/ as SYSDBA”继续连接,但使用ALTER SESSION SET CONTAINER命令在脚本中设置特定容器。

sqlplus / as sysdba <<EOF

ALTER SESSION SET CONTAINER = pdb1;

-- Perform actions as before...
SHOW CON_NAME;

EXIT;
EOF

您还可以参考本文了解更多信息多租户:在 Oracle Database 12c 第 1 版 (12.1) 中针对容器数据库 (CDB) 和可插拔数据库 (PDB) 运行脚本

于 2015-04-30T06:21:25.993 回答