oracle组件
目前在用的四个oracle版本
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options
数据库服务
[oracle@localhost network]$ sqlplus / as sysdba SQL*Plus: Release 11.2.0.1.0 Production on Mon Jul 13 09:57:14 2015 Copyright (c) 1982, 2009, Oracle. All rights reserved. Connected to an idle instance. SQL> startup nomount ORACLE instance started. Total System Global Area 1603411968 bytes Fixed Size 2213776 bytes Variable Size 973080688 bytes Database Buffers 620756992 bytes Redo Buffers 7360512 bytes SQL> alter database mount; Database altered. SQL> alter database open; Database altered. SQL> shutdown immediate Database closed. Database dismounted. ORACLE instance shut down.
监听器服务
监听器服务通过lsnrctl工具进行控制
[oracle@localhost ~]$ lsnrctl LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 13-JUL-2015 09:26:22 Copyright (c) 1991, 2009, Oracle. All rights reserved. Welcome to LSNRCTL, type "help" for information. LSNRCTL> status Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521))) TNS-12541: TNS:no listener TNS-12560: TNS:protocol adapter error TNS-00511: No listener Linux Error: 2: No such file or directory Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=localhost.localdomain)(PORT=1521))) TNS-12541: TNS:no listener TNS-12560: TNS:protocol adapter error TNS-00511: No listener Linux Error: 111: Connection refused LSNRCTL> start Starting /u01/app/oracle/product/11.2.0/dbhome_1/bin/tnslsnr: please wait... TNSLSNR for Linux: Version 11.2.0.1.0 - Production System parameter file is /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora Log messages written to /u01/app/oracle/diag/tnslsnr/localhost/listener/alert/log.xml Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521))) Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=localhost.localdomain)(PORT=1521))) Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521))) STATUS of the LISTENER ------------------------ Alias LISTENER Version TNSLSNR for Linux: Version 11.2.0.1.0 - Production Start Date 13-JUL-2015 09:27:41 Uptime 0 days 0 hr. 0 min. 0 sec Trace Level off Security ON: Local OS Authentication SNMP OFF Listener Parameter File /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora Listener Log File /u01/app/oracle/diag/tnslsnr/localhost/listener/alert/log.xml Listening Endpoints Summary... (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521))) (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=localhost.localdomain)(PORT=1521))) The listener supports no services The command completed successfully LSNRCTL>
LSNRCTL> help
The following operations are available
An asterisk (*) denotes a modifier or extended command:
start stop status
services version reload
save_config trace spawn
change_password quit exit
set* show*
LSNRCTL> set
The following operations are available after set
An asterisk (*) denotes a modifier or extended command:
password rawmode
displaymode trc_file
trc_directory trc_level
log_file log_directory
log_status current_listener
inbound_connect_timeout startup_waittime
save_config_on_stop dynamic_registration
enable_global_dynamic_endpoint connection_rate_limit
valid_node_checking_registration registration_invited_nodes
registration_excluded_nodes
LSNRCTL> show
The following operations are available after show
An asterisk (*) denotes a modifier or extended command:
rawmode displaymode
rules trc_file
trc_directory trc_level
log_file log_directory
log_status current_listener
inbound_connect_timeout startup_waittime
snmp_visible save_config_on_stop
dynamic_registration enable_global_dynamic_endpoint
oracle_home pid
connection_rate_limit valid_node_checking_registration
registration_invited_nodes registration_excluded_nodes
监听日志
[oracle@localhost log]$ ls
sqlnet.log
[oracle@localhost log]$ pwd
/u01/app/oracle/product/11.2.0/dbhome_1/network/log
对于默认的监听名称:listener,默认的端口号:1521,当采用动态监听的时候,
即使没有listener.ora文件,监听进程依然可以正常工作。
Service "baoka" has 2 instance(s).
Instance "baoka1", status UNKNOWN, has 1 handler(s) for this service...
Handler(s):
"DEDICATED" established:110 refused:84
LOCAL SERVER
Instance "baoka1", status READY, has 1 handler(s) for this service...
Handler(s):
"DEDICATED" established:45600 refused:0 state:ready
LOCAL SERVER
Service "baoka" has 2 instance(s).
Instance "baoka2", status UNKNOWN, has 1 handler(s) for this service...
Handler(s):
"DEDICATED" established:33 refused:12
LOCAL SERVER
Instance "baoka2", status READY, has 1 handler(s) for this service...
Handler(s):
"DEDICATED" established:211 refused:0 state:ready
LOCAL SERVER
控制器服务
更改firefox的语言设置就可以将oem设置为英语,路径为选项-内容-语言,将英语往上移就可以了,再刷新页面
在oracle10g/11g中,数据库企业管理器(oracle enterprise manager OEM)以数据库控制器(database control)或网格控制器(grid control)形式存在
10g之前,使用的工具是OEM即c/s结构,控制器是b/s结构,并且开始是http,后来换成https
https://ip:1158/em 输入用户名密码与身份,即sys:密码:sysdba
[oracle@localhost network]$ emctl status dbconsole Oracle Enterprise Manager 11g Database Control Release 11.2.0.1.0 Copyright (c) 1996, 2009 Oracle Corporation. All rights reserved. https://localhost.localdomain:1158/em/console/aboutApplication Oracle Enterprise Manager 11g is not running. ------------------------------------------------------------------ Logs are generated in directory /u01/app/oracle/product/11.2.0/dbhome_1/localhost.localdomain_orcl/sysman/log
[oracle@localhost network]$ emctl start dbconsole
Oracle Enterprise Manager 11g Database Control Release 11.2.0.1.0
Copyright (c) 1996, 2009 Oracle Corporation. All rights reserved.
https://localhost.localdomain:1158/em/console/aboutApplication
Starting Oracle Enterprise Manager 11g Database Control ....... started.
------------------------------------------------------------------
Logs are generated in directory /u01/app/oracle/product/11.2.0/dbhome_1/localhost.localdomain_orcl/sysman/log
[oracle@localhost network]$ emctl getversion
Oracle Enterprise Manager 11g Database Control Release 11.2.0.1.0
Copyright (c) 1996, 2009 Oracle Corporation. All rights reserved.
Enterprise Manager 11g DB Control Version 11.2.0.1.0
Enterprise Manager 10g Agent Version 10.2.0.4.0
根据两个报错重新配置oem,先加入ORACLE_UNQNAME,再重新配置oem [oracle@oracle4 ~]$ emctl status dbconsole Environment variable ORACLE_UNQNAME not defined. Please set ORACLE_UNQNAME to database unique name. [oracle@oracle4 ~]$ vi .bash_profile [oracle@oracle4 ~]$ source .bash_profile [oracle@oracle4 ~]$ emctl status dbconsole OC4J Configuration issue. /u01/app/oracle/product/11.2.0.4/dbhome_1/oc4j/j2ee/OC4J_DBConsole_oracle4_my not found. [oracle@oracle4 ~]$ emca -config dbcontrol db STARTED EMCA at Aug 7, 2017 11:06:57 AM EM Configuration Assistant, Version 11.2.0.3.0 Production Copyright (c) 2003, 2011, Oracle. All rights reserved. Enter the following information: Database SID: my Listener port number: 1521 Listener ORACLE_HOME [ /u01/app/oracle/product/11.2.0.4/dbhome_1 ]: Password for SYS user: Password for DBSNMP user: Password for DBSNMP user: Aug 7, 2017 11:07:19 AM oracle.sysman.emcp.util.GeneralUtil initSQLEngineLoacly WARNING: ORA-28000: the account is locked Password for SYSMAN user: Aug 7, 2017 11:07:33 AM oracle.sysman.emcp.util.GeneralUtil initSQLEngineLoacly WARNING: ORA-28000: the account is locked Email address for notifications (optional): Outgoing Mail (SMTP) server for notifications (optional): ----------------------------------------------------------------- You have specified the following settings Database ORACLE_HOME ................ /u01/app/oracle/product/11.2.0.4/dbhome_1 Local hostname ................ oracle4 Listener ORACLE_HOME ................ /u01/app/oracle/product/11.2.0.4/dbhome_1 Listener port number ................ 1521 Database SID ................ my Email address for notifications ............... Outgoing Mail (SMTP) server for notifications ............... ----------------------------------------------------------------- Do you wish to continue? [yes(Y)/no(N)]: Do you wish to continue? [yes(Y)/no(N)]: y Aug 7, 2017 11:08:03 AM oracle.sysman.emcp.EMConfig perform INFO: This operation is being logged at /u01/app/oracle/cfgtoollogs/emca/my/emca_2017_08_07_11_06_56.log. Aug 7, 2017 11:08:07 AM oracle.sysman.emcp.EMReposConfig uploadConfigDataToRepository INFO: Uploading configuration data to EM repository (this may take a while) ... Aug 7, 2017 11:08:48 AM oracle.sysman.emcp.EMReposConfig invoke INFO: Uploaded configuration data successfully Aug 7, 2017 11:08:49 AM oracle.sysman.emcp.util.DBControlUtil secureDBConsole INFO: Securing Database Control (this may take a while) ... Aug 7, 2017 11:10:02 AM oracle.sysman.emcp.util.DBControlUtil secureDBConsole INFO: Database Control secured successfully. Aug 7, 2017 11:10:02 AM oracle.sysman.emcp.util.DBControlUtil startOMS INFO: Starting Database Control (this may take a while) ... Aug 7, 2017 11:10:20 AM oracle.sysman.emcp.EMDBPostConfig performConfiguration INFO: Database Control started successfully Aug 7, 2017 11:10:20 AM oracle.sysman.emcp.EMDBPostConfig performConfiguration INFO: >>>>>>>>>>> The Database Control URL is https://oracle4:1158/em <<<<<<<<<<< Aug 7, 2017 11:10:25 AM oracle.sysman.emcp.EMDBPostConfig invoke WARNING: ************************ WARNING ************************ Management Repository has been placed in secure mode wherein Enterprise Manager data will be encrypted. The encryption key has been placed in the file: /u01/app/oracle/product/11.2.0.4/dbhome_1/oracle4_my/sysman/config/emkey.ora. Ensure this file is backed up as the encrypted data will become unusable if this file is lost. *********************************************************** Enterprise Manager configuration completed successfully FINISHED EMCA at Aug 7, 2017 11:10:25 AM
css服务
[grid@rac02 ~]$ crsctl check css css服务没启动 CRS-4530: Communications failure contacting Cluster Synchronization Services daemon [grid@rac02 ~]$ ps -ef|grep cssd 没有css进程 果然没有CSS的服务daemon进程,再看一下HAS(High Availability Service)的状态 [grid@rac02 ~]$ crsctl check has has服务是启动的 CRS-4638: Oracle High Availability Services is online [grid@rac02 ~]$ ps -ef|grep d.bin root 8505 1 0 11:36 ? 00:00:03 /u01/app/11.2.0/grid/bin/ohasd.bin reboot root 8763 1 0 11:36 ? 00:00:04 /u01/app/11.2.0/grid/bin/orarootagent.bin root 9581 1 0 11:40 ? 00:00:50 /u01/app/11.2.0/grid/bin/cssdmonitor grid 13033 1 0 12:05 ? 00:00:01 /u01/app/11.2.0/grid/bin/oraagent.bin grid 13048 1 0 12:05 ? 00:00:15 /u01/app/11.2.0/grid/bin/evmd.bin root 15277 1 0 15:22 ? 00:00:00 /u01/app/11.2.0/grid/bin/crsd.bin reboot grid 15950 13914 0 15:24 pts/11 00:00:00 grep d.bin [grid@rac02 ~]$ crs_stat -t 进一步查看各资源的状态 CRS-0184: Cannot communicate with the CRS daemon. [root@rac02 bus]# find / -name crsd.log 查看CRS日志 [root@rac02 bus]# less /u01/app/11.2.0/grid/log/rac02/crsd/crsd.log
组件
查看各组件及版本 SQL> set linesize 800 SQL> set pagesize 100 SQL> column product format A40 SQL> column version format A20 SQL> column status format A20 SQL> select * from product_component_version; PRODUCT VERSION STATUS ---------------------------------------- -------------------- -------------------- NLSRTL 11.2.0.1.0 Production Oracle Database 11g Enterprise Edition 11.2.0.1.0 64bit Production PL/SQL 11.2.0.1.0 Production TNS for Linux: 11.2.0.1.0 Production SQL> select * from v$version; BANNER -------------------------------------------------------------------------------- Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production PL/SQL Release 11.2.0.1.0 - Production CORE 11.2.0.1.0 Production TNS for Linux: Version 11.2.0.1.0 - Production NLSRTL Version 11.2.0.1.0 - Production SQL> select * from v$option; PARAMETER VALUE ---------------------------------------------------------------- ---------------------------------------------------------------- Partitioning TRUE Objects TRUE Real Application Clusters FALSE Advanced replication TRUE Bit-mapped indexes TRUE Connection multiplexing TRUE Connection pooling TRUE Database queuing TRUE Incremental backup and recovery TRUE Instead-of triggers TRUE Parallel backup and recovery TRUE Parallel execution TRUE Parallel load TRUE Point-in-time tablespace recovery TRUE Fine-grained access control TRUE Proxy authentication/authorization TRUE Change Data Capture TRUE Plan Stability TRUE Online Index Build TRUE Coalesce Index TRUE Managed Standby TRUE Materialized view rewrite TRUE Materialized view warehouse refresh TRUE Database resource manager TRUE Spatial TRUE Automatic Storage Management FALSE Export transportable tablespaces TRUE Transparent Application Failover TRUE Fast-Start Fault Recovery TRUE Sample Scan TRUE Duplexed backups TRUE Java TRUE OLAP Window Functions TRUE Block Media Recovery TRUE Fine-grained Auditing TRUE Application Role TRUE Enterprise User Security TRUE Oracle Data Guard TRUE Oracle Label Security FALSE OLAP TRUE Basic Compression TRUE Join index TRUE Trial Recovery TRUE Data Mining TRUE Online Redefinition TRUE Streams Capture TRUE File Mapping TRUE Block Change Tracking TRUE Flashback Table TRUE Flashback Database TRUE Transparent Data Encryption TRUE Backup Encryption TRUE Unused Block Compression TRUE Oracle Database Vault FALSE Result Cache TRUE SQL Plan Management TRUE SecureFiles Encryption TRUE Real Application Testing TRUE Flashback Data Archive TRUE DICOM TRUE Active Data Guard TRUE Server Flash Cache TRUE Advanced Compression TRUE XStream TRUE Deferred Segment Creation TRUE 65 rows selected.
Database Components (dbca安装过程中显示的组件)
Component Selected
Oracle JVM TRUE
Oracle Text TRUE
Oracle XML DB TRUE
Oracle Multimedia TRUE
Oracle OLAP TRUE
Oracle Spatial TRUE
Oracle Label Security TRUE
Sample Schemas FALSE
Enterprise Manager Repository TRUE
Oracle Application Express TRUE
Oracle Warehouse Builder TRUE
Oracle Database Vault FALSE