zoukankan      html  css  js  c++  java
  • oracle安装配置

    X Window System

    yum groupinstall "X Window System"

    安装

    启动 vncserver

    添加用户

    groupadd oinstall

    groupadd dba

    useradd -g oinstall -G dba oracle

    passwd oracle

    修改内核 /etc/sysctl.conf 

    fs.aio-max-nr = 1048576

    fs.file-max = 6815744

    kernel.shmall = 2097152

    kernel.shmmax = 536870912

    kernel.shmmni = 4096

    kernel.sem = 250 32000 100 128

    net.ipv4.ip_local_port_range = 9000 65500

    net.core.rmem_default = 262144

    net.core.rmem_max = 4194304

    net.core.wmem_default = 262144

    net.core.wmem_max = 1048586

    应用配置:/sbin/sysctl -p

    修改用户限制 /etc/security/limits.conf 

    oracle soft nproc 2047

    oracle hard nproc 16384

    oracle soft nofile 1024

    oracle hard nofile 65536

    修改用户验证选项 /etc/pam.d/login

    session required pam_limits.so

    修改用户配置文件 /etc/profile

    if [ $USER = "oracle" ]; then

            if [ $SHELL = "/bin/ksh" ]; then

                  ulimit -p 16384

                  ulimit -n 65536

            else

                  ulimit -u 16384 -n 65536

            fi

    fi

    安装目录配置

    mkdir -p /u01/

    chown -R oracle:oinstall /u01/

    chmod -R 775 /u01/

    修改root用户bash shell: /root/.bash_profile(oracle用户的bash环境也修改掉/home/oracle/.bash_profile)

    #oracle

    export ORACLE_BASE=/u01/app

    export ORACLE_HOME=$ORACLE_BASE/oracle/product/11.2.0/dbhome_1

    export ORACLE_SID=orcl

    export PATH=$ORACLE_HOME/bin:$PATH:$HOME/bin

    export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib:/usr/local/lib

    export CLASSPATH=$ORACLE_HOME/jdk/jre

    export NLS_LANG=american_america.ZHS16GBK

    export TMP=/tmp

    export TMPDIR=$TMP

    必要软件

    libaio-devel sysstat unixODBC unixODBC-devel pdksh

    启动图形界面,切换安装用户

    xclock可调出clock

    xhost localhost  或者 xhost +

    su oracle

    执行安装:./runInstaller ;

    如果执行时显示乱码,先切换为英文,export LANG=en ,暂时切换为英文;

    安装时会产生临时文件到/tmp,所以那个目录要oracle用户有权限写,如果没有,使用 chmod -R 777 /tmp

    图形安装过程(略)

    产品语言:添加Simple Chinese

    选择字符编码为:ZHS16GBK

    安装完成

    通过 https://10.12.0.100:1158/em 访问,此时oracle已启动;

    卸载

    使用oracle deinstall: ./runInstaller -deinstall

    切换至root用户

    rm -f /etc/oraInst.loc /etc/oratab

    rm -rf /etc/oracle

    rm -f /etc/initab.cssd

    rm -f /usr/local/bin/coraenv /usr/local/bin/dbhome /usr/local/bin/oraenv

    服务启动

    sqlplus "/as sysdba"

    startup

    退出sqlplus启动lsnrctl监听

    lsnrctl start

    ----一步步启动----

    startup nomount; --started

    alter database mount; --mounted

    alter database open; --selecct status from v$instance; --open

    -----

    alter database close;--mounted

    alter database dismount;--started

    shutdown;

    开机自启动

    root用户修改/etc/rc.local 添加:

    su - oracle -c 'dbstart'

    su - oracle -c 'lsnrctl start'

    root用户修改:/etc/oratab

    orcl:/u01/app/oracle/product/11.2.0/dbhome_1:Y

    sqlplus管理

    sqlplus /nolog

    SQL> conn / as sysdba

    SQL> startup nomount

    ORACLE instance started.

    Total System Global Area 839282688 bytes

    Fixed Size 2217992 bytes

    Variable Size 549455864 bytes

    Database Buffers 281018368 bytes

    Redo Buffers 6590464 bytes

    SQL> alter database mount

    SQL> alter database open

    以上三步可直接使用 startup 完成启动;

    关闭

    shutdown immediate;

    sqlplus设置

    show all --显示所有设置

    define --显示所有变量

    SQL>l (字母)列出执行过的命令

    del 行号

    调用vi

    vi $ORACLE_HOME/sqlplus/admin/glogin.sql

    加入DEFINE_EDITOR=vi

    EM

    启动em管理1158

    emctl start dbconsole

    启动监听1521

    lsnrctl start

    修改监听端口

    $ORACLE_HOME/network/admin/listener.ora

    修改完重启动lsnrctl,监听正常了,但em不能正常监控到;

    重建EM

    重建过程中保持lsnrctl 正常;

    emca -deconfig dbcontrol db -repos drop

    权限控制

    系统权限

    创建用户

    create user lubx identified by "123" account unlock;

    grant connect to lubx;

    外部认证用户:oracle 不依赖于oracle数据字典验证,依赖于操作系统验证;

    创建外部认证用户

    create user ora001 identified externally account unlock;

    grant connect to ora001;

    要使用ora001登录需做以下设置:

    alter system set remote_os_authent=true scope=spfile;

    alter system set os_authent_prefix='' scope=spfile;

    重启数据库:shutdown immediate; startup;

    创建系统账号ora001: useradd -g oinstall ora001

    sqlplus /nolog

    conn /

    show user;

    Windows下:

    create user ora001 identified externally account unlock;

    grant connect to ora001;

    grant resource to ora001;

    创建系统账号:ora001

    授予权限:

    grant create session to "lubx"

    grant unlimited tablespace to "lubx"

    如果加上with admin option,则该用户可以将引权限转授其他人;

    取消权限:revoke(不能实现级联取消权限)

    revoke create table from lubx

    对象权限

    授予权限

    grant select,update on test to lubx

    可加with admin option

    取消权限revoke 可实现级联取消权限

    revoke select,update on test from lubx

    删除用户

    如果此用户没创建任何对象,直接 drop user;否则加 casecade

    角色:基于权限或其他角色的容器

    grant "connect" to "lubx"

    grant "resource" to "lubx"

    不能使用with grant option但可使用with grant admin

    Profile

    alter system set resource_limit=true;

    show parameter resource_limit;

    create profile "TEST_PROFILE" limit failed_login_attempts 3;

    alter user lubx profile TEST_PROFILE;

    grant connect,resource,select_catalog_role,sysdba to user

    排错目录

    /u01/app/oracle/admin/orcl/dpdump

    /u01/app/oracle/diag/rdbms/orcl/orcl/trace

    基础知识

    SGA: 共享池、数据库高速缓冲区、日志缓冲区...

    共享池:oracle硬解析后的SQL语句,以及最近使用的对象元数据;

    高速缓冲:待更新的数据;

    日志缓冲:CKPT使用

    Oracle基本进程:

    SMON:系统监视进程,负责数据库打开;

    PMON: 进程监视进程,管理用户会话;

    DBWn:数据库写入器,实时将调整缓冲区数据变化定稿磁盘重做日志文件;

    CKPT:检查点进程,控制DBWn发生频率;

    常用命令

    sqlplus "/as sysdba"

    shutdown immediate;

    netca

    netmgr

    sqlplus不支持上下键解决

    安装: yum install readline

    编译安装 http://utopia.knoware.nl/~hlub/rlwrap/rlwrap-0.37.tar.gz

    修改 .bashrc

    alias sqlplus='rlwrap sqlplus'

    alias rman='rlwrap rman'

    支持删除: stty erase ^H

    init.ora

    db_name instance_name service_name

    OS

    oracle_sid

    tns

    service_name sid

    导入示例

    @/u01/oracle/rdbms/admin/utlsampl.sql

    连接数

    select value from v$parameter where name = 'processes'--数据库允许的最大连接数

    select count(*) from v$process; --当前连接数

    Linux下安装Oracle客户端

    su - oracle

    unzip linux.x64_11gR1_client.zip

    1)修改 clientcustom.rsp(/tmp/client/response)

        FROM_LOCATION="/tmp/client/stage/products.xml"   

       ORACLE_HOME=/usr/local/oracle

       ORACLE_HOME_NAME="ORACLE_HOME"

       COMPONENT_LANGUAGES={"en","zh_CN"}

    2)开始安装

      ./runInstaller -silent -responseFile /tmp/client/response/clientcustom.rsp

    3)修改oracle用户.profile

    umask 022

    ORACLE_BASE=/usr/local/oracle; export ORACLE_BASE

    ORACLE_HOME=$ORACLE_BASE/product/11.1.0/client; export ORACLE_HOME

    PATH=$ORACLE_HOME/bin:$PATH; export PATH

    source .profile

  • 相关阅读:
    微软Office团队做产品的十大经验教训 沧海
    Definitio of Business Intelligence 沧海
    爱购家园,轻松工作,轻松生活 沧海
    SAAS概述 沧海
    一定要做自己最内行的东西,一定要在自己本身的职位上来提升自己 沧海
    Android应用的构成 沧海
    管理的最高境界,就是激发每个员工的潜力。让每个员工都觉得自己的工作是一份事业。 沧海
    The life cycle of a typical project 一个典型的项目生命周期 沧海
    印度英语的特点归纳 沧海
    3G时代的移动业务赢利模式分析 沧海
  • 原文地址:https://www.cnblogs.com/bugbeta/p/8782069.html
Copyright © 2011-2022 走看看