tns-12560: tns: 協定擴充卡錯誤 /var/tmp/.oracle
網絡架構

1.為了使伺服器接收用戶端上傳連接配接請求,需要有一個程序在伺服器端監聽用戶端傳入的請求,這個程序就是在伺服器端啟動的監聽程式,
監聽程式程序負責檢測傳入的請求并将其傳送到相應的目的地,若要啟動監聽程式程序通常必須在伺服器端配置一個配置檔案:listener.ora
2.為了使用戶端連接配接到指定的資料庫伺服器,需要在用戶端配置服務名,服務名配置中描述伺服器的位址、資料庫執行個體等資訊,服務名是目标位址的别名,
為了簡化服務名的使用oracle允許我們将服務名解析為連接配接字元串,服務名的配置儲存在tnsnames.ora檔案中,該配置檔案包含網絡上的服務名稱和位址,
客戶機和分發伺服器均使用該檔案來确定目标伺服器,在tnsnames.ora檔案中服務名直接映射到連接配接描述符然後通過下列方法之一對其進行解析将
– 主機命名使用 sqlnet.ora 檔案和本機命名服務
– 本地命名使用 tnsnames.ora 檔案
– oracle names 使用 sqlnet.ora 檔案和 oracle names server
3.在解析服務名後即向監聽程式發送請求,監聽程式接收會話請求後決定将該請求定向到什麼位置
4.監聽程式衍生新的程序或将該連接配接重定向到現有的程序以處理與 oracle資料庫的通信
5.該程序的位址傳遞到用戶端程序在會話持續時間内用戶端與伺服器端程序直接通信無須監聽程式介入
網絡配置檔案(listener.ora,tnsnames.ora,sqlnet.ora)的預設位置是 $oracle_home/network/admin
網絡基本配置
伺服器端一定要配置監聽程式
用戶端要配置服務命名
1.配置網絡:
伺服器端:需要配置監聽程式
ip : 192.168.1.5
sid: orcl
ssh 192.168.1.5 -x
netmgr
配置成功後重新啟動監聽程式:
lsnrctl stop
lsnrctl start
用戶端:需要配置服務命名
ip : 192.168.1.254
su - oracle
配置成功後在用戶端連接配接伺服器測試:
conn scott/oracle@5
預衍生服務程序
listener.ora
---------------------------------------------------------------
sid_list_listener =
(sid_list =
(sid_desc =
(sid_name = plsextproc)
(oracle_home = e:\oracle\product\10.2.0\db_1)
(program = extproc)
)
(global_dbname = orcl)
(sid_name = orcl)
(prespawn_max = 10)
(prespawn_list =
(prespawn_desc =
(protocol = tcp)
(pool_size = 10) --預衍生服務程序的初始數量
(timeout = 1)
listener =
(description_list =
(description =
(address = (protocol = ipc)(key = extproc1))
(address = (protocol = tcp)(host = 136.0.10.2)(port = 1521))
lsnrctl> services
正在連接配接到 (description=(address=(protocol=ipc)(key=extproc1)))
服務摘要..
服務 "plsextproc" 包含 1 個例程。
例程 "plsextproc", 狀态 unknown, 包含此服務的 1 個處理程式...
處理程式:
"dedicated" 已建立:0 已被拒絕:0
local server
服務 "orcl" 包含 2 個例程。
例程 "orcl", 狀态 unknown, 包含此服務的 11 個處理程式... 監聽中配置的靜态注冊,無法獲得執行個體狀态!
"prespawn" 已建立:0 已被拒絕:0 目前: 0 最大: 0 狀态: ready
例程 "orcl", 狀态 ready, 包含此服務的 1 個處理程式...
"dedicated" 已建立:0 已拒絕:0 狀态:ready
服務 "orclxdb" 包含 1 個例程。
"d000" 已建立:0 已被拒絕:0 目前: 0 最大: 1002 狀态: ready
dispatcher <machine: alvin, pid: 3652>
(address=(protocol=tcp)(host=alvin)(port=1158))
服務 "orcl_xpt" 包含 1 個例程。
指令執行成功
限制ip通路
限制ip通路:$oracle_home/network/admin/sqlnet.ora
tcp.validnode_checking=yes
tcp.invited_nodes=(ip1,ip2......) 被邀請ip
tcp.excluded_nodes=(ip1,ip2......) 被限制ip
重新啟動監聽器設定才生效
@ > conn scott/tiger@orcl
error:
ora-12537: tns: 連接配接關閉
限制會話空閑時間
限制會話空閑時間:sqlnet.ora
alter system set resource_limit=true;
create profile p1 limit idle_time 1;
alter user scott profile p1;
sqlnet.expire_time=10
共享伺服器
dispatchers 和shared_servers ,shared_server_sessions
alter system set dispatchers='(address=(protocol=tcp)(host=192.168.0.250)(dispatchers=2)(sessions=2))';
select username,server from v$session where username is not null;
select count(*) from v$shared_server;
select count(*) from v$dispatcher;
select * from v$circuit;
alter system set dispatchers='(address=(protocol=tcp)(host=10.1.1.95)(dispatchers=2)(sessions=2))';
資料庫連結
資料庫連結:
sql> conn / as sysdba
connected.
sql> grant create database link to scott;
grant create synonym to scott;
conn scott/tiger
建立資料庫連結:
create database link remote_5_scott
connect to scott identified by oracle --靜态資料庫連結,戶名密碼在連結中被定義
using '5';
create database link remote_5
using '5'; --動态資料庫連結,使用本地戶名密碼到遠端做安全稽核
select * from emp@remote_5_scott;
create synonym emp for emp@remote_5_scott;
select * from emp;
練習
自己作為伺服器,配置網絡使其他節點可以通過網絡通路你的資料庫!
自己作為用戶端連接配接其他節點的資料庫!