第一章 数据库的启动与关闭
启动、访问(网络)、关闭
6、mount 相同db_name的数据库 (db_unique_name 不一致) 12
2、 oracle automatic diagnostic repository新特性 15
3、oracle fault diagnosability infrastructure 16
1.2.2 服务器端的监听器文件listener.ora配置 17
如下为Startup nomount状态alert日志的截取: pid为数据库内部的标识符编号,OS id操作系统进程编号
Starting ORACLE instance (normal)
LICENSE_MAX_SESSION = 0
LICENSE_SESSIONS_WARNING = 0
Initial number of CPU is 1
CELL communication is configured to use 0 interface(s):
CELL IP affinity details:
NUMA status: non-NUMA system
cellaffinity.ora status: N/A
CELL communication will use 1 IP group(s):
Grp 0:
Picked latch-free SCN scheme 3
Using LOG_ARCHIVE_DEST_1 parameter default value as USE_DB_RECOVERY_FILE_DEST
Autotune of undo retention is turned on.
IMODE=BR
ILAT =27
LICENSE_MAX_USERS = 0
SYS auditing is disabled
Starting up:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options.
ORACLE_HOME = /u01/app/oracle/product/11.2.0/db_1
System name: Linux
Node name: oracle1
Release: 2.6.32-220.el6.x86_64
Version: #1 SMP Wed Nov 9 08:03:13 EST 2011
Machine: x86_64
VM name: VMWare Version: 6
Using parameter settings in server-side spfile /u01/app/oracle/product/11.2.0/db_1/dbs/spfileoracle.ora
System parameters with non-default values:
processes = 150
memory_target = 796M
control_files = "/u01/data/oracle/control01.ctl"
control_files = "/u01/app/oracle/fast_recovery_area/oracle/control02.ctl"
db_block_size = 8192
compatible = "11.2.0.4.0"
db_recovery_file_dest = "/u01/app/oracle/fast_recovery_area"
db_recovery_file_dest_size= 4977M
undo_tablespace = "UNDOTBS1"
remote_login_passwordfile= "EXCLUSIVE"
db_domain = ""
dispatchers = "(PROTOCOL=TCP) (SERVICE=oracleXDB)"
audit_file_dest = "/u01/app/oracle/admin/oracle/adump"
audit_trail = "DB"
db_name = "oracle"
open_cursors = 300
diagnostic_dest = "/u01/app/oracle"
Fri Feb 03 17:00:44 2017
PMON started with pid=2, OS id=10068
Fri Feb 03 17:00:44 2017
PSP0 started with pid=3, OS id=10070
Fri Feb 03 17:00:45 2017
VKTM started with pid=4, OS id=10072 at elevated priority
VKTM running at (1)millisec precision with DBRM quantum (100)ms
Fri Feb 03 17:00:45 2017
GEN0 started with pid=5, OS id=10076
Fri Feb 03 17:00:45 2017
DIAG started with pid=6, OS id=10078
Fri Feb 03 17:00:45 2017
DBRM started with pid=7, OS id=10080
Fri Feb 03 17:00:45 2017
DIA0 started with pid=8, OS id=10082
Fri Feb 03 17:00:45 2017
MMAN started with pid=9, OS id=10084
Fri Feb 03 17:00:45 2017
DBW0 started with pid=10, OS id=10086
Fri Feb 03 17:00:45 2017
LGWR started with pid=11, OS id=10088
Fri Feb 03 17:00:45 2017
CKPT started with pid=12, OS id=10090
Fri Feb 03 17:00:45 2017
SMON started with pid=13, OS id=10092
Fri Feb 03 17:00:45 2017
RECO started with pid=14, OS id=10094
Fri Feb 03 17:00:45 2017
MMON started with pid=15, OS id=10096
starting up 1 dispatcher(s) for network address '(ADDRESS=(PARTIAL=YES)(PROTOCOL=TCP))'...
Fri Feb 03 17:00:45 2017
MMNL started with pid=16, OS id=10098
starting up 1 shared server(s) ...
ORACLE_BASE from environment = /u01/app/oracle
Pid=1的进程是一个pseudo进程,该进程被认为是初始化数据库的进程。spid列代表的就是操作系统上的进程号,若在操作系统上发现某个进程表现异常(如占用很高的CPU资源),则可以通过操作系统上的pid与v$process视图上的spid关联,就可以找到这给OS上的进程在数据库内部的化身,从而进一步的跟踪诊断。 Latchwait
SQL> select addr,pid,spid,username,program from v$process;
ADDR PID SPID USERNAME PROGRAM
-------------------- ---------- ----- -------- -----------------------------------
00000000910A57B0 1 PSEUDO
00000000910A6868 2 10068 oracle oracle@oracle1 (PMON)
00000000910A7920 3 10070 oracle oracle@oracle1 (PSP0)
00000000910A89D8 4 10072 oracle oracle@oracle1 (VKTM)
00000000910A9A90 5 10076 oracle oracle@oracle1 (GEN0)
00000000910AAB48 6 10078 oracle oracle@oracle1 (DIAG)
00000000910ABC00 7 10080 oracle oracle@oracle1 (DBRM)
00000000910ACCB8 8 10082 oracle oracle@oracle1 (DIA0)
00000000910ADD70 9 10084 oracle oracle@oracle1 (MMAN)
00000000910AEE28 10 10086 oracle oracle@oracle1 (DBW0)
00000000910AFEE0 11 10088 oracle oracle@oracle1 (LGWR)
00000000910B0F98 12 10090 oracle oracle@oracle1 (CKPT)
00000000910B2050 13 10092 oracle oracle@oracle1 (SMON)
00000000910B3108 14 10094 oracle oracle@oracle1 (RECO)
00000000910B41C0 15 10096 oracle oracle@oracle1 (MMON)
00000000910B5278 16 10098 oracle oracle@oracle1 (MMNL)
00000000910B6330 17 10100 oracle oracle@oracle1 (D000)
00000000910B73E8 18 10102 oracle oracle@oracle1 (S000)
00000000910B84A0 19 10322 oracle oracle@oracle1 (TNS V1-V3)
(1)查看参数文件的位置
Show parameter spfile
(2)参数文件查找顺序
?/dbs/spfile.ora
“?”代表ORACLE_HOME,@代表数据库的sid
只需有db_name参数即可
[oracle@oracle1 ~]$ export ORACLE_SID=fuliling
[oracle@oracle1 ~]$ sqlplus / as sysdba
SQL> startup nomount;
ORA-01078: failure in processing system parameters
LRM-00109:
Could not open parameter file '/u01/app/oracle/product/11.2.0/db_1/dbs/initfuliling.ora'
SQL> !echo "db_name=fuliling" > /u01/app/oracle/product/11.2.0/db_1/dbs/initfuliling.ora
SQL> startup nomount;
ORACLE instance started.
Total System Global Area 217157632 bytes
Fixed Size 2251816 bytes
Variable Size 159384536 bytes
Database Buffers 50331648 bytes
Redo Buffers 5189632 bytes
Oracle system identifier
Oracle_sid以环境变量的形式出现,当oracle实例启动时,在操作系统上fork的进程就依据oracle_sid来创建。
Oracle实例(instance)由一块共享内存区域(SGA)和一组后台进程共同组成,后台进程是数据库和系统进行交互的通道,进程的名称通过ORACLE_SID决定。
实例启动所需参数文件的名称由ORACLE_SID来决定。
在同一个$ORACLE_HOME下(同一版本),通过参数文件,oracle可据oracle_sid将实例区分开来,在不同的SORACLE_HOME下(不同版本),即使在同一台主机上,oracle也能够创建相同的ORACLE_SID实例。
(1)标识数据库实例的名称,缺省为oracle_sid。
(2)Instance_name向监听器注册(动态注册)
Service "testfu" has 1 instance(s).
Instance "testfu", status READY, has 1 handler(s) for this service...
The command completed successfully
(3)v$instance视图和数据库实例的生命周期相关,用于显示当前实例的状态。(启动时间,运行主机等)
Db_name定义实例即将挂接的数据库名称,关系到具体的物理文件。(必须是一个不超过8个字符的文本串,在数据库创建过程中,db_name被记录在数据文件,日志文件和控制文件中。若数据库实例启动过程中参数文件中的db_name和控制文件中的数据库名称不一致,则数据库不能启动。)
缺省情况下instance_name和db_name可以设置相同(rac环境下,由于多实例对应一个数据库,故instance_name和db_name不同)
下图定义数据库名称(db_name)和影响instance_name的sid.
一个实例可以mount并打开任何数据库,但是同一时间一个实例只能打开一个数据库。
一个数据库可以被一个或多个实例所mount并打开(只有在ors/rac环境下,一个数据库可以被多个实例打开)
Eg 1: 一个数据库被多个实例加载,在非并行模式(ops/rac)下,一个数据库只能被一个实例加载。
已有实例(instance_name为oracle) 加载数据库(db_name为oracle),现在新增实例testfu,使其加载oracle.
[oracle@oracle1 dbs]$ cp spfileoracle.ora spfiletestfu.ora
[oracle@oracle1 dbs]$ export ORACLE_SID=testfu
SQL> startup nomount;
ORACLE instance started.
Total System Global Area 830930944 bytes
Fixed Size 2257800 bytes
Variable Size 536874104 bytes
Database Buffers 289406976 bytes
Redo Buffers 2392064 bytes
SQL> alter database mount;
alter database mount
*
ERROR at line 1:
ORA-01102: cannot mount database in EXCLUSIVE mode
报错为ORA-01102: cannot mount database in EXCLUSIVE mode
[oracle@oracle1 dbs]$ ps -ef | grep dbw
oracle 3285 1 0 11:04 ? 00:00:00 ora_dbw0_test
oracle 8217 8137 0 14:49 pts/10 00:00:00 grep dbw0_oracle
[oracle@oracle1 dbs]$
关闭oracle这个数据库实例,则可以打开testfu数据库实例
[oracle@oracle1 dbs]$ export ORACLE_SID=oracle
SQL> shutdown immediate;
[oracle@oracle1 dbs]$ export ORACLE_SID=testfu
SQL>startup;
Eg 2: 参数文件中db_name和控制文件中db_name不一致的报错。
控制文件中db_name为oracle,修改inittestfu.ora中db_name并以pfile启动数据库。
SQL > create pfile from spfile;
[oracle@oracle1 dbs]$ grep name inittestfu.ora
#*.db_name='oracle'
*.db_name='testfu'
[oracle@oracle1 dbs]$
SQL> startup pfile='/u01/app/oracle/product/11.2.0/db_1/dbs/inittestfu.ora' nomount;
ORACLE instance started.
Total System Global Area 830930944 bytes
Fixed Size 2257800 bytes
Variable Size 536874104 bytes
Database Buffers 289406976 bytes
Redo Buffers 2392064 bytes
SQL> alter database mount;
alter database mount
*
ERROR at line 1:
ORA-01103: database name 'ORACLE' in control file is not 'TESTFU'
SQL>
允许在不存在参数文件的情况下启动实例,数据库的db_name会被缺省的命名未DUMMY.
适用于某些恢复的过程。
[oracle@oracle1 ~]$export ORACLE_SID=test
[oracle@oracle1 ~]$ rman target /
Recovery Manager: Release 11.2.0.4.0 - Production on Fri Feb 3 18:17:14 2017
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
connected to target database (not started)
RMAN> startup nomount;
startup failed: ORA-01078: failure in processing system parameters
LRM-00109:
could not open parameter file '/u01/app/oracle/product/11.2.0/db_1/dbs/inittest.ora'
starting Oracle instance without parameter file for retrieval of spfile
Oracle instance started
Total System Global Area 1068937216 bytes
Fixed Size 2260088 bytes
Variable Size 281019272 bytes
Database Buffers 780140544 bytes
Redo Buffers 5517312 bytes
[oracle@oracle1 ~]$ sqlplus / as sysdba
SQL> show parameter db_name;
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
db_name string DUMMY
SQL>
SQL> startup nomount;
SQL> select * from v$controlfile;
no rows selected
SQL> show parameter control_files;
NAME TYPE VALUE
------------------------------------ ---------------------- ------------------------------
control_files string /u01/data/oracle/control01.ctl
, /u01/app/oracle/fast_recover
y_area/oracle/control02.ctl
案例:
控制文件丢失的报错
SQL> alter database mount;
alter database mount
*
ERROR at line 1:
ORA-00205: error in identifying control file, check alert log for more info
SQL>
日志报错:
[oracle@oracle1 trace]$ tail -f alert_oracle.log
Fri Feb 03 18:35:19 2017
alter database mount
ORA-00210: cannot open the specified control file
ORA-00202: control file: '/u01/app/oracle/fast_recovery_area/oracle/control02.ctl'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
解决方法:
若只损失其中1个或2个,可以复制完好的控制文件,更改为相应名称,就可以启动数据库;若丢失了所有的控制文件,则需要恢复或重建控制文件来打开数据库。
Mount状态后,后台进程可以根据控制文件中记录的数据文件信息来验证数据文件是否存在,若不存在则可以在动态视图中显示。 (error为file not found)
SQL> select * from v$recover_file;
FILE# ONLINE ONLINE_STATUS ERROR CHANGE# TIME
---------- -------------- -------------- ----------------------------------------------------------------- ---------- -------------------
4 ONLINE ONLINE FILE NOT FOUND 0
$ORACLE_HOME/dbs/orapworacle
口令文件中存放sysdba/sysoper身份用户的用户名及口令。若不存在该文件,则和口令文件相关的部分功能无法使用。例如尝试远程通过sysdba身份登录,sysdba的授权等都会受到限制。orapwd可以创建密码文件
Eg: 密码文件丢失的情况
SQL> connect sys/foxconn88@test as sysdba
ERROR:
ORA-01017: invalid username/password; logon denied
SQL> exit
SQL> grant sysdba to test;
grant sysdba to test
*
ERROR at line 1:
ORA-01994: GRANT failed: password file missing or disabled
数据库里具有sysdba/sysoper权限的用户可以通过v$pwfile_users视图查询
SQL> desc v$pwfile_users;
Name Null? Type
----------------------------------------- -------- ----------------------------
USERNAME VARCHAR2(30)
SYSDBA VARCHAR2(5)
SYSOPER VARCHAR2(5)
SYSASM VARCHAR2(5)
SQL> select username,sysdba from v$pwfile_users where sysdba='TRUE';
USERNAME SYSDBA
------------------------------------------------------------ ----------
SYS TRUE
SQL>
位于$ORACLE_HOME/dbs目录下,lk指lock,该文件在数据库启动时自动创建,用于操作系统对数据库的锁定。数据库启动时获得锁定,数据库关闭时释放。若系统异常,数据库已关闭,但锁定未释放,或后台进程未正常停止等原因,会导致下次数据库无法启动。可以重启服务器或手工释放共享内存等方法来解除锁定。
6、mount 相同db_name的数据库 (db_unique_name 不一致)
Standby
同一个主机上可以启动相同db_name的数据库(类似standby,只要保证db_unique_name唯一即可)
第一步: 首先获得原数据库的控制文件创建脚本(alter database backup controlfile to trace)
SQL> alter database backup controlfile to trace;
Database altered.
SQL> select value from v$diag_info where name='Default Trace File';
VALUE
--------------------------------------------------------------------------------
/u01/app/oracle/diag/rdbms/oracle/oracle/trace/oracle_ora_11197.trc
Vi /u01/app/oracle/diag/rdbms/oracle/oracle/trace/oracle_ora_11197.trc
第二步: 关闭原数据库
SQL> shutdown immediate;
第三步: 复制目标数据库(cp -R oracle test )
第四步:为新建实例创建口令及参数文件
[oracle@oracle1 data]$ cd $ORACLE_HOME/dbs
[oracle@oracle1 dbs]$ orapwd file=orapwtest
[oracle@oracle1 dbs]$ cp spfileoracle.ora spfiletest.ora)
第五步:目标数据库启动到nomount状态,更改目标数据库的参数(control_files, db_unique_name)并重启,执行创建控制文件的脚本,,recover,再打开即可。
[oracle@oracle1 dbs]$ export ORACLE_SID=test
SQL> startup nomount;
SQL> alter system set control_files='/u01/data/test/control01.ctl' scope=spfile;
SQL> alter system set db_unique_name=test scope=spfile;
SQL> shutdown immediate;
SQL> startup nomount;
SQL> CREATE CONTROLFILE REUSE DATABASE "ORACLE" NORESETLOGS ARCHIVELOG
MAXLOGFILES 16
MAXLOGMEMBERS 3
MAXDATAFILES 100
MAXINSTANCES 8
MAXLOGHISTORY 292
LOGFILE
GROUP 1 '/u01/data/test/redo01.log' SIZE 50M BLOCKSIZE 512,
GROUP 2 '/u01/data/test/redo02.log' SIZE 50M BLOCKSIZE 512,
GROUP 3 '/u01/data/test/redo03.log' SIZE 50M BLOCKSIZE 512
-- STANDBY LOGFILE
DATAFILE
'/u01/data/test/system01.dbf',
'/u01/data/test/sysaux01.dbf',
'/u01/data/test/undotbs01.dbf',
'/u01/data/test/users01.dbf',
'/u01/data/test/users02.dbf'
18 CHARACTER SET AL32UTF8;
Control file created.
SQL> alter database open;
控制文件中记录下数据库中数据文件、日志文件的位置信息,检查点信息等重要信息,在数据库的open阶段,oracle将根据控制文件中记录的这些信息找到文件,然后进行检查点及完整性检查。若存在不一致或文件丢失则需要进行恢复。
(1)第一次检查数据文件头中的检查点计数(checkpoint cnt)是否和控制文件中的检查点计数(checkpoint cnt)一致。此步骤检查用以确认数据文件是否来自同一版本,而不是从备份中恢复过来(因为checkpoint cnt不会被冻结,会一直被修改)。
Eg: 不同条件下转储控制文件。热备份模式下,数据文件检查点被冻结(在热备模式下,数据库会生成额外的redo日志),但checkpoint cnt不会被冻结
正常情况下转储控制文件:
Sql >alter system set events ‘immediate trace name CONTROLF level 8’;
Checkpont cnt :181 scn: db97
Stop scn: ffff
热备模式下转储:
Sql > alter tabspace system begin backup;
Sql >alter system set events ‘immediate trace name CONTROLF level 8’;
Checkpont cnt :182 scn: e0fb
Stop scn: ffff
手动checkpoint后转储
Sql > alter system checkpoint;
Sql >alter system set events ‘immediate trace name CONTROLF level 8’;
Checkpont cnt :183 scn: e0fb
Stop scn: ffff
热备结束后转储
Sql > alter tablspace system end backup;
Sql >alter system set events ‘immediate trace name CONTROLF level 8’;
Checkpont cnt :184 scn: e14b
Stop scn: ffff
(2)第一次检查通过则进行第二次检查,第二次检查数据文件头的开始SCN和控制文件中记录的该文件的结束scn是否一致,若一直,则不需要对那个文件进行恢复。
对每个数据文件都完成检查后,打开数据库,锁定数据文件,同时将每个数据文件的结束SCN设置为无穷大。
2、oracle automatic diagnostic repository新特性
启动了diagnostic_dest 参数后,参数Backup_dump_dest、core_dump_dest和user_dump_dest被弃用。
Diagnostic_dest是oracle 11g新特性自动诊断知识库(ADR)的设置。该目录用于存放诊断日志、跟踪文件,被称为ADR BASE
若设置了ORACLE_BASE,则diagnostic_dest=ORACLE_BASE
若未设置了ORACLE_BASE,则diagnostic_dest=ORACLE_HOME/log
ADR信息可以通过V$diag_info视图查询。
Alter日志的格式除了有文本格式(DIAG TRACE),还厚XML格式(DIAG ALTER)adrci工具可以查看XML日志。
ADR之于诊断文件,类似OFA(Optimal Flexible Architecture)之于数据文件,FRA(flash recovery area)之于备份文件。
SQL> select name,value from v$diag_info;
SQL> select name,value from v$diag_info;
NAME VALUE
----------------------------------------------------------------------------------------------------
Diag Enabled TRUE
ADR Base /u01/app/oracle
ADR Home /u01/app/oracle/diag/rdbms/test/test
Diag Trace /u01/app/oracle/diag/rdbms/test/test/trace
Diag Alert /u01/app/oracle/diag/rdbms/test/test/alert
Diag Incident /u01/app/oracle/diag/rdbms/test/test/incident
Diag Cdump /u01/app/oracle/diag/rdbms/test/test/cdump
Health Monitor /u01/app/oracle/diag/rdbms/test/test/hm
Default Trace File /u01/app/oracle/diag/rdbms/test/test/trace/test_ora_13553.trc
Active Problem Count 0
Active Incident Count 0
11 rows selected.
SQL>
3、oracle fault diagnosability infrastructure
数据库的连接方式有本地连接和远程连接两种:
本地连接:通过SQL*PLUS工具在数据库服务器本地,通过sysdba身份进行登录,该方式常用于数据库管理
远程连接:数据库启动之后,要想提供网络服务,通过远程连接访问,需启动数据库的监听器(配置文件为listener.ora),监听器用于在特定的端口上(缺省的端口为1521)提供监听,接收来自客户端的访问请求(客户端请求通过tnsnames.ora文件定义发送)。
可通过netca配置(net configuration assistant)来进行配置。
ADDRESS部分包含了服务器的地址及监听端口信息,CONNECT_DATA部分包含了连接信息,用于定义目标服务的名称。SERVICE_NAME在这里用于显示识别访问的数据库服务;SERVICE_NAME在这里也经常可以用SID来替代,从oracle 9i开始,oracle推荐使用SERVICE_NAME而不是SID。
# Cat $ORACLE_HOME/network/admin/tnsnames.ora
TEST =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.8.134)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = oracle)
)
)
测试连通性:
[oracle@oracle1 admin]$ tnsping oracle
TNS Ping Utility for Linux: Version 11.2.0.4.0 - Production on 05-FEB-2017 12:30:43
Copyright (c) 1997, 2013, Oracle. All rights reserved.
Used parameter files:
Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.8.134)(PORT = 1521))) (CONNECT_DATA = (SERVICE_NAME = oracle)))
OK (0 msec)
若能顺利通信,则可以通过SQL*PLUS或其他工具通过网络服务名进行数据库网络访问
[oracle@oracle1 admin]$ sqlplus test/test@test
1.2.2 服务器端的监听器文件listener.ora配置
文件第一部分定义名为LISTENER(名称可以自定)的侦听器,默认端口为1521,协议为tcp/ipc,地址为192.168.8.134
文件第二部分SID_LIST_LISTENER信息,这部分信息用于提供对外的数据库服务列表。第一个SID_DESC部分(SID_NAME=-PLSExtProc)是数据库缺省就包含的对外部存储过程提供的本地监听。另外两个SID_DESC部分就是对数据库的两个SERVICE_NAMES所设置的监听服务,对于同一个sid对应的数据库,可以对外提供多个服务名供客户端访问。
设置服务吗的参数为GLOBAL_DBNAME,当处理客户端连接请求时,监听器首先尝试将GLOBAL_DBNAME和客户端请求的SERVICE_NAME相匹配;若客户端连接请求的是SID信息,则oracle不检查GLOBAL_DBNAME设置,而是对监听器中设置的SID_NAME进行匹配。
# Cat $ORACLE_HOME/network/admin/listener.ora
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.8.134)(PORT = 1521))
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
)
)
SID_LIST_LISTENER =
(SID_LIST=
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME=/u01/app/oracle/product/11.2.0/db_1)
(PROGRAM=extproc)
)
(SID_DESC =
(GLOBAL_NAME = eygle)
(ORACLE_HOME=/u01/app/oracle/product/11.2.0/db_1)
(SID_NAME = eygle)
)
(SID_DESC =
(GLOBAL_NAME = julia)
(ORACLE_HOME=/u01/app/oracle/product/11.2.0/db_1)
(SID_NAME = eygle)
)
一般设置为如下即可:
# Cat $ORACLE_HOME/network/admin/listener.ora
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.8.134)(PORT = 1521))
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
)
)
SID_LIST_LISTENER =
(SID_LIST=
(SID_DESC =
(ORACLE_HOME=/u01/app/oracle/product/11.2.0/db_1)
(SID_NAME = oracle)
)
)
1、动态注册
实例启动之后,由后台进程PMON(process monitor)在监听器中注册数据库服务信息。不需要在listener.ora配置SID_LIST部分。 若监听器不在主机名标识的地址上的默认端口运行,则必须通过设置local_listener参数和重新注册来指定侦听器的位置。(READY)
Eg:
SQL > alter system set local_listener= LISTENER2
SQL> alter system register;
# Lsnrctl status
Service "oracleXDB" has 1 instance(s).
Instance "oracle", status READY, has 1 handler(s) for this service...
The command completed successfully
2、静态注册
需在listener.ora配置SID_LIST
# Lsnrctl status
Service "oracle" has 2 instance(s).
Instance "oracle", status UNKNOWN, has 1 handler(s) for this service...
Shutdown abort/ immediate/transactional/normal
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/31411496/viewspace-2135705/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/31411496/viewspace-2135705/