程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 數據庫知識 >> Oracle數據庫 >> Oracle教程 >> jdbc-connect-oracle12c-pdb/cdb(jdbc連接oracle12c的pdb和cdb),oracle12ccdbpdb

jdbc-connect-oracle12c-pdb/cdb(jdbc連接oracle12c的pdb和cdb),oracle12ccdbpdb

編輯:Oracle教程

jdbc-connect-oracle12c-pdb/cdb(jdbc連接oracle12c的pdb和cdb),oracle12ccdbpdb


 

1       本文簡介:

通過特意引發問題,聚焦問題,解決問題,並循序漸進

最後總結jdbc連接oracle12c中cdb和pdb的條件.

軟件環境:Redhat7.1+orcacle12c

 

 

2       准備階段:

2.1  listener.ora和tnsnames.ora配置:

 

所有動作前,先貼出listener.ora和tnsnames.ora配置:

2.1.1  listener.ora>>

# listener.ora Network Configuration File: /u01/app/oracle/product/12.1.0/dbhome_1/network/admin/listener.ora
# Generated by Oracle configuration tools.

LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
    )
  )
 

 

 

2.1.2  tnsnames.ora>>

 

# tnsnames.ora Network Configuration File: /u01/app/oracle/product/12.1.0/dbhome_1/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.

PDBORCL =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 127.0.0.1)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SERVICE_NAME = pdborcl)
    )
  )

LISTENER_ORACLE12C =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 127.0.0.1)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SERVICE_NAME = oracle12c)
    )
  )

ORACLE12C =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 127.0.0.1)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SERVICE_NAME = oracle12c)
    )
  )

 

 

 

 

(注意添加PDBORCL)

2.1  用戶創建

2.1.1  用戶創建:

 

SQL> create user scott identified by scott;
create user scott identified by scott
            *
ERROR at line 1:
ORA-65096: invalid common user or role name
 
 
SQL> !oerr ora 65096
65096, 00000, "invalid common user or role name"
// *Cause:  An attempt was made to create a common user or role with a name
//          that wass not valid for common users or roles.  In addition to
//          the usual rules for user and role names, common user and role 
//          names must start with C## or c## and consist only of ASCII 
//          characters.
// *Action: Specify a valid common user or role name.
//
 
SQL> create user c##scott identified by scott;
 
User created.

 

 

 

 

  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved