有很多人在克隆带有ORACLE数据库的LINUX主机后,发现克隆的数据库不正常,不能连接到数据库上,其实在克隆了数据库后要修改以下几个地方。
1、/etc/hosts 一般来说,克隆了新主机后,都要修改新机器的hostname,所以首先要修改/etc/hosts文件。
2、修改listener.ora 和 tnsnames.ora文件
Listener.ora
==========
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC))
)
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = old_name)(PORT = 1521))
)
)
)
(SID_DESC =
(GLOBAL_DBNAME = name.oracle.com)
(ORACLE_HOME = /app/oracle/product)
(SID_NAME = test)
)
)
tnsnames.ora
==========
TEST =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = new_name)(PORT = 1521))
)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = name.oracle.com)
)
)
3、有些时候数据库不能动态注册,DBA偶尔会修改数据库的local_listener参数,所以也要注意这个参数是否被修改。
SQL> show parameter local_listener NAME TYPE VALUE ------------------------------------ ----------- ------------------------------ local_listener string (ADDRESS=(PROTOCOL=TCP)(HOST= 192.168.114.103)(PORT=1521)) SQL>
4、如果配置了 DB Control ,还要修改它的配置,这里不做展开,具体请参考MOS 文章:How To Drop, Create And Recreate Database Control (dbconsole) Web Site in Releases 10g and 11g (Doc ID 278100.1)