业务方需要新建一个pdb,要求与原pdb通过不同监听端口连接增加一层安全保护,记录一下操作方法:

 

1. 新建pdb及用户(略)

 

2. 配置listener.ora

监听文件内容如下

SID_LIST_LISTENER =
  (SID_LIST =
    (SID_DESC =
      (GLOBAL_DBNAME = pdb_a)
      (ORACLE_HOME = /path/cdbname)
      (SID_NAME = cdbname)
    )
    (SID_DESC =
      (GLOBAL_DBNAME = pdb_a)
      (SID_NAME = cdbname)
    )
  )

LISTENER =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = ip)(PORT = 1521))
  )

SID_LIST_newpdb =
  (SID_LIST =
    (SID_DESC =
      (GLOBAL_DBNAME = newpdb)
      (SID_NAME = cdbname)
    )
  )

newpdb =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = ip)(PORT = 1525))
  )

 

3. 启动新监听

lsnrctl start newpdb
lsnrctl status newpdb

#输出类似
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=ip)(PORT=1525)))
Services Summary...
Service "newpdb" has 1 instance(s).
  Instance "cdbname", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully

 

4. 配置tnsnames.ora

newpdb =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = ip)(PORT = 1525))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = newpdb)
    )
  )

 

5. 测试连接

sqlplus system@newpdb
#能连上即可