我可以通过
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
也有效。