使用OEM,SQL*Plus,iSQL*Plus 管理Oracle实例

2023-10-10 22:19

本文主要是介绍使用OEM,SQL*Plus,iSQL*Plus 管理Oracle实例,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

--==========================================

--使用OEM,SQL*Plus,iSQL*Plus 管理Oracle实例

--==========================================

/*

一、管理组件

    Oracle 10g数据库管理包含三个组件,本文主要介绍Database Control,SQL*PlusiSQL*Plus

       Database instance(数据库实例)  -->系统使用的后台进程

       Listener (监听器)              -->监听客户端连接到数据库

       Management interfance

           Database Control           -->OEM

          Management agent (when using Grid Control)  --网格管理

二、使用OEM管理Oracle        

    1.关于OEMOracle i开始就随软件提供企业管理器(OEM

        g中,oracledbca建库过程中会出现四个用户:sys,system,dbsnap,sysman

       (--dbsnap 用户用于OEM智能代理管理工作,sysman用户则是OEM的管理员帐号)

       如果在dbca建库过程中没有选择安装OEM,则没有dbsnapsysman用户,如果在dbca建库时选择启用database control管理数据库,

       则需要在数据库中建立一个sysmanschema,用于保存OEM的一些数据,这个就是OEM的资料档案库(repository),在G版本中,

       这个库存储在sysaux表空间中

      

    2.OEM的启动和关闭

    启动:emctl start dbconsole   启动后用浏览器http://IP:1158/em   来登陆OEM,进行图形化操作数据库

       关闭:emctl stop dbconsole

       状态:emctl status dbconsole                     */

       --下面演示EM启动到停止的过程

       [oracle@robinson scripts]$ emctl start dbconsole  --启动

        TZ set to PRC

        Oracle Enterprise Manager 10g Database Control Release 10.2.0.1.0 

        Copyright (c) 1996, 2005 Oracle Corporation.  All rights reserved.

        http://robinson.com:1158/em/console/aboutApplication

        Starting Oracle Enterprise Manager 10g Database Control ...................... started.

        ------------------------------------------------------------------

        Logs are generated in directory /u01/app/oracle/10g/robinson.com_orcl/sysman/log

        [oracle@robinson scripts]$ emctl status dbconsole    --查看状态

        TZ set to PRC

        Oracle Enterprise Manager 10g Database Control Release 10.2.0.1.0 

        Copyright (c) 1996, 2005 Oracle Corporation.  All rights reserved.

        http://robinson.com:1158/em/console/aboutApplication

        Oracle Enterprise Manager 10g is running.

        ------------------------------------------------------------------

        Logs are generated in directory /u01/app/oracle/10g/robinson.com_orcl/sysman/log

        [oracle@robinson scripts]$ emctl stop dbconsole      --停止

        TZ set to PRC

        Oracle Enterprise Manager 10g Database Control Release 10.2.0.1.0 

        Copyright (c) 1996, 2005 Oracle Corporation.  All rights reserved.

        http://robinson.com:1158/em/console/aboutApplication

        Stopping Oracle Enterprise Manager 10g Database Control ...

        ...  Stopped.

        /*

       

    3.重建OEM

    由于EM需要J2EE环境支持,正常创建后,在$ORACLE_HOME目录下将会建立一个

    类似$ORACLE_HOME/oc4j/j2ee/OC4J_DBConsole_<hostname>_<sid>的目录,如果此目录不存在,则EM将无法启动。

    另外,如果服务器修改过主机名等信息,导致OEM可能无法启动,此时需要重新配置EM   

        使用emca命令来重建EM档案库,关于emca的用户,使用emca -h 来查看详细说明 */

      

       [oracle@robinson scripts]$ emca -config dbcontrol db -repos recreate

 

       STARTED EMCA at Apr 21, 2010 3:09:04 PM

       EM Configuration Assistant, Version 10.2.0.1.0 Production

       Copyright (c) 2003, 2005, Oracle.  All rights reserved.

 

       Enter the following information:

       Database SID: orcl

       Database Control is already configured for the database orcl

       You have chosen to configure Database Control for managing the database orcl

       This will remove the existing configuration and the default settings and perform a fresh configuration

       Do you wish to continue? [yes(Y)/no(N)]: y

       Listener port number: 1521

       Password for SYS user: 

       Password for DBSNMP user: 

       Password for SYSMAN user: 

       Email address for notifications (optional):

       Outgoing Mail (SMTP) server for notifications (optional):

       -----------------------------------------------------------------

 

       You have specified the following settings

 

       Database ORACLE_HOME ................ /u01/app/oracle/10g

 

       Database hostname ................ robinson.com

       Listener port number ................ 1521

       Database SID ................ orcl

       Email address for notifications ...............

       Outgoing Mail (SMTP) server for notifications ...............

 

       -----------------------------------------------------------------

       Do you wish to continue? [yes(Y)/no(N)]: y

       Apr 21, 2010 3:09:24 PM oracle.sysman.emcp.EMConfig perform

       INFO: This operation is being logged at /u01/app/oracle/10g/cfgtoollogs/emca/orcl/emca_2010-04-21_03-09-04-PM.log.

       Apr 21, 2010 3:09:25 PM oracle.sysman.emcp.util.DBControlUtil stopOMS

       INFO: Stopping Database Control (this may take a while) ...

       Apr 21, 2010 3:09:32 PM oracle.sysman.emcp.EMReposConfig dropRepository

       INFO: Dropping the EM repository (this may take a while) ...

       Apr 21, 2010 3:11:41 PM oracle.sysman.emcp.EMReposConfig invoke

       INFO: Repository successfully dropped

       Apr 21, 2010 3:11:41 PM oracle.sysman.emcp.EMReposConfig createRepository

       INFO: Creating the EM repository (this may take a while) ...

       Apr 21, 2010 3:16:01 PM oracle.sysman.emcp.EMReposConfig invoke

       INFO: Repository successfully created

       Apr 21, 2010 3:16:08 PM oracle.sysman.emcp.util.DBControlUtil startOMS

       INFO: Starting Database Control (this may take a while) ...

       Apr 21, 2010 3:17:55 PM oracle.sysman.emcp.EMDBPostConfig performConfiguration

       INFO: Database Control started successfully

       Apr 21, 2010 3:17:55 PM oracle.sysman.emcp.EMDBPostConfig performConfiguration

       INFO: >>>>>>>>>>> The Database Control URL is http://robinson.com:1158/em <<<<<<<<<<<

       Enterprise Manager configuration completed successfully

       FINISHED EMCA at Apr 21, 2010 3:17:55 PM

       [oracle@robinson scripts]$ emctl status dbconsole

       TZ set to PRC

       Oracle Enterprise Manager 10g Database Control Release 10.2.0.1.0 

       Copyright (c) 1996, 2005 Oracle Corporation.  All rights reserved.

       http://robinson.com:1158/em/console/aboutApplication

       Oracle Enterprise Manager 10g is running.

       ------------------------------------------------------------------

       Logs are generated in directory /u01/app/oracle/10g/robinson.com_orcl/sysman/log

       /*

       注意:如果启动EM有问题,确保监听器已经启动

       打开浏览器,使用sysman用户登陆,也可以使用sys用户登陆,当使用sys用户登陆时,注意几点:

       a.口令文件存在并配置正常

       b.监听启动

       c.remote_login_passwordfile设置不能为NONE

       重建EM成功后,ORACLE主要创建的相关目录有个,分别是:

        a.$ORACLE_HOME/oc4j/j2ee/OC4J_DBConsole_<hostname>_<sid>

        b.$ORACLE_HOME/<hostname>_<sid>

      

    4.查看默认的端口号      */

       [oracle@robinson scripts]$ cat $ORACLE_HOME/install/portlist.ini

        iSQL*Plus HTTP port number =5560

        Enterprise Manager Console HTTP Port (orcl) = 1158

        Enterprise Manager Agent Port (orcl) = 3938

      /*   

      

    5.建议

        OEM管理和维护直观简单,但并不建议使用OEM来进行管理,因为JAVA的界面通常消耗的资源较多,

       加上网络连接的因素,OEM界面很容易失去响应,从而可能导致很多意外,通过命令行操作可以让

       我们更加熟悉ORACLE的本质,又可以减少低级的意外错误。

 

三、使用SQL*PlusiSQL*Plus管理Oracle

    SQL*PlusiSQL*Plus同样可以完成Oracle的管理工作,能够通过命令的方式来执行查询,更新,删除等操作

      

    1.SQL*Plus 使用相关账户登陆到到实例,启动数据库,完成相关的管理任务  */

      [oracle@robinson scripts]$ sqlplus / as sysdba

 

      SQL*Plus: Release 10.2.0.1.0 - Production on Wed Apr 21 15:38:54 2010

 

      Copyright (c) 1982, 2005, Oracle.  All rights reserved.

 

     Connected to:

     Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production

     With the Partitioning, OLAP and Data Mining options

 

     SQL>  

     /*

     

    2.iSQL*Plus(i开始出现的基于websqlplus工具)

      10giSQL*Plus的启动与关闭

      启动:isqlplusctl start

      关闭:isqlplusctl stop                    */

      [oracle@robinson scripts]$ isqlplusctl start

      perl: warning: Setting locale failed.

      perl: warning: Please check that your locale settings:

          LANGUAGE = (unset),

          LC_ALL = (unset),

          LANG = "en"

      are supported and installed on your system.

      perl: warning: Falling back to the standard locale ("C").

      iSQL*Plus 10.2.0.1.0

      Copyright (c) 2003, 2005, Oracle.  All rights reserved.

      Starting iSQL*Plus ...

      iSQL*Plus started.

 

      [oracle@robinson scripts]$ isqlplusctl stop

      perl: warning: Setting locale failed.

      perl: warning: Please check that your locale settings:

          LANGUAGE = (unset),

          LC_ALL = (unset),

          LANG = "en"

      are supported and installed on your system.

     perl: warning: Falling back to the standard locale ("C").

     iSQL*Plus 10.2.0.1.0

     Copyright (c) 2003, 2005, Oracle.  All rights reserved.

     Stopping iSQL*Plus ...

     iSQL*Plus stopped.

 

      /*

      修改iSQL*Plus默认端口号

      [oracle@robinson scripts]$ cat $ORACLE_HOME/oc4j/j2ee/isqlplus/config/http-web-site.xml |grep 5560

      <web-site port="5560" display-name="OC4J Java HTTP Web Site">  --将改为其他端口号即可

     

      启动isqlplus,然后通过浏览器登陆http://IP:5560/isqlplus

      注意:默认情况下,sysdba用户无法通过isqlplus登陆 

     

四、更多        */

 

    SQL/PLSQL 基础

   

    Oralce 10g 使用DBCA创建数据库

   

    使用Uniread实现SQLplus翻页功能

   

    Linux (RHEL 5.4)下安装Oracle 10g R2

   

    VmWare6.5.2下安装RHEL 5.4(配置Oracle安装环境)

   

    Oracle相关

 

    Oracle实例和Oracle数据库(Oracle体系结构)

      

 

 

这篇关于使用OEM,SQL*Plus,iSQL*Plus 管理Oracle实例的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/183465

相关文章

C++使用栈实现括号匹配的代码详解

《C++使用栈实现括号匹配的代码详解》在编程中,括号匹配是一个常见问题,尤其是在处理数学表达式、编译器解析等任务时,栈是一种非常适合处理此类问题的数据结构,能够精确地管理括号的匹配问题,本文将通过C+... 目录引言问题描述代码讲解代码解析栈的状态表示测试总结引言在编程中,括号匹配是一个常见问题,尤其是在

Java中String字符串使用避坑指南

《Java中String字符串使用避坑指南》Java中的String字符串是我们日常编程中用得最多的类之一,看似简单的String使用,却隐藏着不少“坑”,如果不注意,可能会导致性能问题、意外的错误容... 目录8个避坑点如下:1. 字符串的不可变性:每次修改都创建新对象2. 使用 == 比较字符串,陷阱满

Python使用国内镜像加速pip安装的方法讲解

《Python使用国内镜像加速pip安装的方法讲解》在Python开发中,pip是一个非常重要的工具,用于安装和管理Python的第三方库,然而,在国内使用pip安装依赖时,往往会因为网络问题而导致速... 目录一、pip 工具简介1. 什么是 pip?2. 什么是 -i 参数?二、国内镜像源的选择三、如何

使用C++实现链表元素的反转

《使用C++实现链表元素的反转》反转链表是链表操作中一个经典的问题,也是面试中常见的考题,本文将从思路到实现一步步地讲解如何实现链表的反转,帮助初学者理解这一操作,我们将使用C++代码演示具体实现,同... 目录问题定义思路分析代码实现带头节点的链表代码讲解其他实现方式时间和空间复杂度分析总结问题定义给定

Linux使用nload监控网络流量的方法

《Linux使用nload监控网络流量的方法》Linux中的nload命令是一个用于实时监控网络流量的工具,它提供了传入和传出流量的可视化表示,帮助用户一目了然地了解网络活动,本文给大家介绍了Linu... 目录简介安装示例用法基础用法指定网络接口限制显示特定流量类型指定刷新率设置流量速率的显示单位监控多个

JavaScript中的reduce方法执行过程、使用场景及进阶用法

《JavaScript中的reduce方法执行过程、使用场景及进阶用法》:本文主要介绍JavaScript中的reduce方法执行过程、使用场景及进阶用法的相关资料,reduce是JavaScri... 目录1. 什么是reduce2. reduce语法2.1 语法2.2 参数说明3. reduce执行过程

如何使用Java实现请求deepseek

《如何使用Java实现请求deepseek》这篇文章主要为大家详细介绍了如何使用Java实现请求deepseek功能,文中的示例代码讲解详细,感兴趣的小伙伴可以跟随小编一起学习一下... 目录1.deepseek的api创建2.Java实现请求deepseek2.1 pom文件2.2 json转化文件2.2

mybatis和mybatis-plus设置值为null不起作用问题及解决

《mybatis和mybatis-plus设置值为null不起作用问题及解决》Mybatis-Plus的FieldStrategy主要用于控制新增、更新和查询时对空值的处理策略,通过配置不同的策略类型... 目录MyBATis-plusFieldStrategy作用FieldStrategy类型每种策略的作

python使用fastapi实现多语言国际化的操作指南

《python使用fastapi实现多语言国际化的操作指南》本文介绍了使用Python和FastAPI实现多语言国际化的操作指南,包括多语言架构技术栈、翻译管理、前端本地化、语言切换机制以及常见陷阱和... 目录多语言国际化实现指南项目多语言架构技术栈目录结构翻译工作流1. 翻译数据存储2. 翻译生成脚本

C++ Primer 多维数组的使用

《C++Primer多维数组的使用》本文主要介绍了多维数组在C++语言中的定义、初始化、下标引用以及使用范围for语句处理多维数组的方法,具有一定的参考价值,感兴趣的可以了解一下... 目录多维数组多维数组的初始化多维数组的下标引用使用范围for语句处理多维数组指针和多维数组多维数组严格来说,C++语言没