listener.ora和tnsnames.ora的配置

服务器上包含多个库时,listener.ora和tnsnames.ora的配置

1.配置内容:

1).
listener.ora  
SID_LIST_LISTENER =  
     (SID_LIST =     
        (SID_DESC =        
            (SID_NAME = PLSExtProc)        
            (ORACLE_HOME = D:\oracle\product\10.1.0\Db_1)       
            (PROGRAM = extproc)     
        )      
        (SID_DESC =        
            (SID_NAME = orcl)        
            (ORACLE_HOME = D:\oracle\product\10.1.0\Db_1)       
            (global_dbname = orcl)     
        )     
        (SID_DESC =        
            (SID_NAME = PRACTICE)        
            (ORACLE_HOME = D:\oracle\product\10.1.0\Db_1)       
            (global_dbname = PRACTICE)     
        )      
        (SID_DESC =        
            (SID_NAME = RCAT)        
            (ORACLE_HOME = D:\oracle\product\10.1.0\Db_1)       
            (global_dbname = RCAT)     
        )   
    )   

LISTENER =

(DESCRIPTION_LIST =     
    (DESCRIPTION =       
        (ADDRESS_LIST =          
            (ADDRESS = 
                (PROTOCOL = TCP)
                (HOST = doone.pan)
                (PORT = 1521)
            )       
        )     
    )   
)    

2).tnsnames.ora

orcl =
(DESCRIPTION =

(ADDRESS = 
    (PROTOCOL = TCP)
    (HOST = doone)
    (PORT = 1521)
)     
(CONNECT_DATA =        
    (SERVER = DEDICATED)       
    (SERVICE_NAME = orcl)      
)   

)

rcat =
(DESCRIPTION =

(ADDRESS = 
    (PROTOCOL = TCP)
    (HOST = doone)
    (PORT = 1521)
)     
(CONNECT_DATA =        
    (SERVER = DEDICATED)       
    (SERVICE_NAME = rcat)     
)   

)

PRACTICE =
(DESCRIPTION =

(ADDRESS = 
    (PROTOCOL = TCP)
    (HOST = doone)
    (PORT = 1521)
)     
(CONNECT_DATA =        
    (SERVER = DEDICATED)        
    (SERVICE_NAME = PRACTICE)     
)   

)

EXTPROC_CONNECTION_DATA =
(DESCRIPTION =

(ADDRESS_LIST =        
    (ADDRESS = 
        (PROTOCOL = IPC)
        (KEY = EXTPROC)
    )     
)      
(CONNECT_DATA =       
    (SID = PLSExtProc)        
    (PRESENTATION = RO)     
)   

)
2.说明

1).连接时可以用conn user/pwd@orcl,conn user/pwd@ract,conn user/pwd@practice 
2).多库时,不配置上面两文件,可能出现的问题.  
    a.conn user/pwd 如果直接用这样连接,默认连到最后建的那库上   
    b.ORA-01041: internal error. hostdef extension doesn't exist.     
    出现这原因,一般是tns没配置对应库说明. 导致库关闭后,重启出现问题   
    c.ORA-12170: TNS:Connect timeout occurred     出现这错误,一般是listener.ora没配置对应库说明   
    d.ORA-12514: TNS:listener does not currently know of service requested in connect descriptor     
    出现这错误,一般是listener.ora没配置对应库说明

你可能感兴趣的:(listener.ora和tnsnames.ora的配置)