ORACLE12C的CDB/PDB配置tnsnames.ora
SYS@orcl19c>show parameter name
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
cdb_cluster_name string
cell_offloadgroup_name string
db_file_name_convert string
db_name string orcl19c
db_unique_name string orcl19c
global_names boolean FALSE
instance_name string orcl19c
lock_name_space string
log_file_name_convert string
pdb_file_name_convert string
processor_group_name string
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
service_names string orcl19c
SYS@orcl19c>show parameter domain
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
db_domain string
SQL> show pdbs
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 PORCL READ WRITE NO
SQL>
tnsnames.ora:
##CDB
ORCL19C =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = rhel75)(PORT = 1526))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl19c)
)
)
##PDB
PORCL =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = rhel75)(PORT = 1526))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = PORCL)
)
)
----PDB:SERVICE_NAME处填pdb的name(select name from v$pdbs;或show pdbs);
关于SERVICE_NAME
:
The SERVICE_NAME
parameter that you use in the tnsnames.ora
file is singular, because you can specify only one service name. There is also the SERVICE_NAMES
parameter in the database initialization file. The SERVICE_NAMES
parameter defaults the global database name, a name comprising the DB_NAME
and DB_DOMAIN
parameters in the initialization parameter file.
---SERVICE_NAME
默认是全局数据库名(由DB_NAME和DB_DOMAIN组合成的名字)