今天做实验为了好识别机器随手用 hostname source 命令更改了linux主机名然后启动数据库报如下错误:
[oracle@source dbs]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.2.0 Production on Sat Aug 24 20:11:43 2013
Copyright (c) 1982, 2010, Oracle. All rights reserved.
Connected to an idle instance.
SQL> startup
ORA-00119: invalid specification for system parameter LOCAL_LISTENER
ORA-00130: invalid listener address '(ADDRESS=(PROTOCOL=TCP)(HOST=source)(PORT=1521))'
看到此错误果断生成pfile文件,准备剔除LOCAL_LISTENER参数,然后启动数据库。待打开pfile文件发现里面根本就没有LOCAL_LISTERER参数的定义。这就奇怪了。
参数文件如下所示:
[oracle@source dbs]$ vi initCRM.ora
CRM.__pga_aggregate_target=503316480
CRM.__db_cache_size=268435456
CRM.__java_pool_size=16777216
CRM.__large_pool_size=16777216
CRM.__oracle_base='/oracle/app'#ORACLE_BASE set from environment
CRM.__pga_aggregate_target=503316480
CRM.__sga_target=754974720
CRM.__shared_io_pool_size=0
CRM.__shared_pool_size=402653184
CRM.__streams_pool_size=33554432
*.audit_file_dest='/oracle/app/admin/CRM/adump'
*.audit_trail='db'
*.compatible='11.2.0.0.0'
*.control_files='/oracle/CRM2/control01.ctl','/oracle/CRM2/control02.ctl'#Restore Controlfile
*.db_block_size=8192
*.db_cache_size=218103808
*.db_domain=''
*.db_name='CRM'
*.diagnostic_dest='/oracle/app'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=CRMXDB)'
*.log_archive_dest_1='LOCATION=/oracle/archive'
*.log_archive_dest_2=''
*.log_archive_format='%t_%s_%r.dbf'
*.memory_target=1258291200
*.open_cursors=300
*.processes=150
*.remote_login_passwordfile='EXCLUSIVE'
*.undo_retention=1200
*.undo_tablespace='UNDOTBS3'
然后不死心又用pfile参数尝试启动一样报错
SQL> startup nomount pfile='/oracle/app/db1/dbs/initCRM.ora';
ORA-00119: invalid specification for system parameter LOCAL_LISTENER
ORA-00130: invalid listener address '(ADDRESS=(PROTOCOL=TCP)(HOST=source)(PORT=1521))'
于是仔细想了想,既然更改了主机名导致这个错误,查看下/etc/hosts/是否有问题,一检查果然发现是hosts文件问题
[oracle@source dbs]$ cat /etc/hosts
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1 oracle localhost.localdomain localhost
::1 localhost6.localdomain6 localhost6
更改后的hosts文件如下:
root@oracle ~]# cat /etc/hosts
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1 source localhost.localdomain localhost
更改后启动数据库正常,如下所示:
[root@oracle ~]# su - oracle
[oracle@source ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.2.0 Production on Sat Aug 24 20:17:45 2013
Copyright (c) 1982, 2010, Oracle. All rights reserved.
Connected to an idle instance.
SQL> startup
ORACLE instance started.
Total System Global Area 1252663296 bytes
Fixed Size 2226072 bytes
Variable Size 973080680 bytes
Database Buffers 268435456 bytes
Redo Buffers 8921088 bytes
Database mounted.
Database opened.