First a quick overview from orafaq.com:
"EZCONNECT is Oracle's easy connect naming method. EZCONNECT eliminates the need for service name lookups in tnsnames.ora files when connecting to an Oracle database across a TCP/IP network."
http://www.orafaq.com/wiki/EZCONNECT
and the syntax is of the form
CONNECT username/password@[//]host[:port][/service_name]
First here are the service names:
[oracle@ora12c66 ~]$ lsnrctl status
LSNRCTL for Linux: Version 12.1.0.1.0 - Production on 12-MAR-2015 21:09:11
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 12-MAR-2015 12:38:48
Uptime 0 days 8 hr. 30 min. 23 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/product/12.1.0/db_1/network/admin/listener.ora
Listener Log File /u01/diag/tnslsnr/ora12c66/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=ora12c66)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcps)(HOST=ora12c66)(PORT=5500))(Security=(my_wallet_directory=/u01/admin/cdborcl/xdb_wallet))(Presentation=HTTP)(Session=RAW))
Services Summary...
Service "cdborcl" has 1 instance(s).
Instance "cdborcl", status READY, has 1 handler(s) for this service...
Service "cdborclXDB" has 1 instance(s).
Instance "cdborcl", status READY, has 1 handler(s) for this service...
Service "pdb1" has 1 instance(s).
Instance "cdborcl", status READY, has 1 handler(s) for this service...
The command completed successfully
Next I need to open my PDB (after an OS reboot, to reduce the VirtualMachine memory from 4G to 2G, it seems only to be in MOUNTED mode):
SQL> conn system/qwe123@ora12c66/cdborcl
Connected.
SQL> SELECT name, open_mode FROM v$pdbs;
NAME OPEN_MODE
------------------------------ ----------
PDB$SEED READ ONLY
PDB1 MOUNTED
SQL> ALTER PLUGGABLE DATABASE PDB1 OPEN;
ALTER PLUGGABLE DATABASE PDB1 OPEN
*
ERROR at line 1:
ORA-01031: insufficient privileges
SQL> conn / as sysdba
Connected.
SQL> ALTER PLUGGABLE DATABASE PDB1 OPEN;
Pluggable database altered.
SQL> SELECT name, open_mode FROM v$pdbs;
NAME OPEN_MODE
------------------------------ ----------
PDB$SEED READ ONLY
PDB1 READ WRITE
Now this up I can switch to the PDB (which has Oracle's sample schema installed)
SQL> conn system/qwe123@ora12c66/pdb1
Connected.
SQL> select username from dba_users where username in ('HR','OE','SH','IX','PM','BI','SCOTT');
USERNAME
--------------------------------------------------------------------------------
PM
HR
OE
BI
SH
IX
SCOTT
7 rows selected.
and back to the CDB (which doesn't have Oracle's sample schema installed).
SQL> conn system/qwe123@ora12c66/cdborcl
Connected.
SQL> select username from dba_users where username in ('HR','OE','SH','IX','PM','BI','SCOTT');
no rows selected
a small diversion before I move onto PDB cloning :)
No comments:
Post a Comment