• 手工建库


    一:操作步骤

    ---1:手工建库 官方文档位置
    ----Database Administration---》Administrator's Guide----》2 Creating and Configuring an Oracle Database
    
    
    ----1、Specify an Instance Identifier (SID)
      prod
    ----2、建立目录,在$ORACLE_BASE/admin/下建立$ORACLE_SID的目录,再创建子目录/adump(存储审计文件的目录),/dpdump
    
    /u01/app/oracle/admin/prod/{a,dp}dump
    /u01/app/oracle/fast_recovery_area/{prod,PROD}
    ----建立目录,在$ORACLE_BASE/oradata/下建立$ORACLE_SID的目录
    /u01/app/oracle/oradata/prod
    
    ----3、设置oracle用户环境变量实例名为prod
    export ORACLE_SID=prod
    
    ----4、创建参数文件
    cat $ORACLE_HOME/dbs/init.ora |grep -v ^# >initprod.ora
    
    vi initprod.ora
    
    db_name='prod'
    memory_target=512M
    processes = 150
    audit_file_dest='/u01/app/oracle/admin/prod/adump'
    audit_trail ='db'
    db_block_size=8192
    db_domain=''
    db_recovery_file_dest='/u01/app/oracle/fast_recovery_area'
    db_recovery_file_dest_size=4182M
    diagnostic_dest='/u01/app/oracle'
    dispatchers='(PROTOCOL=TCP) (SERVICE=ORCLXDB)'
    open_cursors=300
    remote_login_passwordfile='EXCLUSIVE'
    undo_tablespace='UNDOTBS1'
    control_files = ('/u01/app/oracle/oradata/prod/control01.ctl','/u01/app/oracle/oradata/prod/control02.ctl','/u01/app/oracle/oradata/prod/control03.ctl')
    compatible ='11.2.0.4'
    
    ----5、创建密码文件
    orapwd file=orapwprod password=oracle
    
    ----6、启动实例(NOMOUNTT状态)
    startup nomount
    
    ----7、运行建库脚本
    CREATE DATABASE prod
       LOGFILE GROUP 1 ('/u01/app/oracle/oradata/prod/redo01.log') SIZE 100M,
               GROUP 2 ('/u01/app/oracle/oradata/prod/redo02.log') SIZE 100M,
               GROUP 3 ('/u01/app/oracle/oradata/prod/redo03.log') SIZE 100M
       MAXLOGFILES 50
       MAXLOGMEMBERS 5
       MAXLOGHISTORY 10
       MAXDATAFILES 100
       MAXINSTANCES 1
       CHARACTER SET US7ASCII
       NATIONAL CHARACTER SET AL16UTF16
       DATAFILE '/u01/app/oracle/oradata/prod/system01.dbf' SIZE 325M REUSE   EXTENT MANAGEMENT LOCAL
       SYSAUX DATAFILE '/u01/app/oracle/oradata/prod/sysaux01.dbf' SIZE 325M REUSE  DEFAULT TABLESPACE users
       DATAFILE '/u01/app/oracle/oradata/prod/users01.dbf' SIZE 100M REUSE  DEFAULT TEMPORARY TABLESPACE tempts
          TEMPFILE '/u01/app/oracle/oradata/prod/temp01.dbf' SIZE 20M REUSE
       UNDO TABLESPACE undotbs1
          DATAFILE '/u01/app/oracle/oradata/prod/undotbs01.dbf' SIZE 200M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED;
    
    ----8、运行创建数据字典脚本
    创建数据字典视图
    SQL> @?/rdbms/admin/catalog.sql
    创建PL/SQL的软件包和过程
    SQL> @?/rdbms/admin/catproc.sql
    SQL>@$ORACLE_HOME/sqlplus/admin/pupbld.sql
    

    二:具体实验:

    1:创建有些文件目录。

    [root@localhost ~]# su - oracle
    ---进入oracle base目录
    [oracle@localhost ~]$ cd /u01/app/oracle/
    [oracle@localhost oracle]$ pwd
    /u01/app/oracle
    [oracle@localhost oracle]$ ls
    admin  cfgtoollogs  checkpoints  diag  fast_recovery_area  oradata  product
    --进入admin目录 
    [oracle@localhost oracle]$ cd admin
    [oracle@localhost admin]$ ls
    orcl
    ---创建新的SID :neworcl
    [oracle@localhost admin]$ mkdir neworcl
    [oracle@localhost admin]$ ls
    neworcl  orcl
    [oracle@localhost admin]$
    
    [oracle@localhost admin]$
    
    
    [oracle@localhost admin]$ pwd
    /u01/app/oracle/admin
    [oracle@localhost admin]$ ls
    neworcl  orcl
    [oracle@localhost admin]$ cd neworcl/
    [oracle@localhost neworcl]$ mkdir dpdump
    [oracle@localhost neworcl]$ mkdir adump
    [oracle@localhost neworcl]$ ls
    adump  dpdump
    ---adump 存放的是审计信息
    --dpdump 存放的是:主要是数据泵的一个目录
    [oracle@localhost neworcl]$ ls ../orcl
    adump  dpdump  pfile  wallet
    [oracle@localhost neworcl]$
    ---切换$ORACLE_BASE 目录下
    [oracle@localhost neworcl]$ cd ..
    [oracle@localhost admin]$ ls
    neworcl  orcl
    [oracle@localhost admin]$ cd ..
    [oracle@localhost oracle]$ ls
    admin  cfgtoollogs  checkpoints  diag  fast_recovery_area  oradata  product
    [oracle@localhost oracle]$
    ###在 闪回恢复区  fast_recovery_area   文件夹中创建2个文件夹 neworcl  NEWORCL 
    [oracle@localhost oracle]$ ls
    admin  cfgtoollogs  checkpoints  diag  fast_recovery_area  oradata  product
    [oracle@localhost oracle]$ cd fast_recovery_area/
    [oracle@localhost fast_recovery_area]$ ls
    orcl  ORCL
    [oracle@localhost fast_recovery_area]$ pwd
    /u01/app/oracle/fast_recovery_area
    [oracle@localhost fast_recovery_area]$ mkdir NEWORCL
    [oracle@localhost fast_recovery_area]$ ls
    NEWORCL  orcl  ORCL
    [oracle@localhost fast_recovery_area]$ mkdir neworcl
    [oracle@localhost fast_recovery_area]$ ls
    neworcl  NEWORCL  orcl  ORCL
    [oracle@localhost fast_recovery_area]$ pwd
    /u01/app/oracle/fast_recovery_area
    [oracle@localhost fast_recovery_area]$
    ###在 oradate 目录下 创建 neworcl 目录 
    [oracle@localhost fast_recovery_area]$ pwd
    /u01/app/oracle/fast_recovery_area
    [oracle@localhost fast_recovery_area]$ cd ..
    [oracle@localhost oracle]$ pwd
    /u01/app/oracle
    [oracle@localhost oracle]$ ls
    admin  cfgtoollogs  checkpoints  diag  fast_recovery_area  oradata  product
    [oracle@localhost oracle]$ cd oradata/
    [oracle@localhost oradata]$ ls
    orcl  PROD1
    [oracle@localhost oradata]$ mkdir neworcl
    [oracle@localhost oradata]$ ls
    neworcl  orcl  PROD1
    [oracle@localhost oradata]$
    ##创建目的是用来存放:数据文件和日志文件和控制文件
    [oracle@localhost oradata]$ pwd
    /u01/app/oracle/oradata
    [oracle@localhost oradata]$ cd neworcl/
    [oracle@localhost neworcl]$ pwd
    /u01/app/oracle/oradata/neworcl
    [oracle@localhost neworcl]$

    2:指定数据库的ORACLE_SIE=neworcl

    [oracle@localhost neworcl]$ exp
    exp     expand  expdp   expdpO  expO    export  expr
    [oracle@localhost neworcl]$ export ORACLE_SID=neworcl
    [oracle@localhost neworcl]$ echo $ORACLE_SID        
    neworcl
    [oracle@localhost neworcl]$

    3: 创建一个参数文件 initneworcl.ora  并 创建口令文件 orapwneworcl 及其数据用户密码为 oracle

    ##切换到oracle的家目录
    [oracle@localhost neworcl]$ cd ../../product/11.2.0/db_1/dbs/
    [oracle@localhost dbs]$ pwd
    /u01/app/oracle/product/11.2.0/db_1/dbs
    [oracle@localhost dbs]$
    # 利用init.oracl 文件来创建 initneworcl.ora 初始化参数文件
    [oracle@localhost dbs]$ ls
    dbsorapwPROD1  hc_orcl.dat  hc_PROD1.dat  init.ora  initorcl.ora  initPROD1.ora  lkORCL  lkPROD1  my.dbf  orapworcl  spfileorcl.ora  spfilePROD1.ora  tem.dbf
    [oracle@localhost dbs]$ cat init.ora | grep -v ^# > initneworcl.ora
    [oracle@localhost dbs]$ ls
    dbsorapwPROD1  hc_PROD1.dat     init.ora      initPROD1.ora  lkPROD1  orapworcl       spfilePROD1.ora
    hc_orcl.dat    initneworcl.ora  initorcl.ora  lkORCL         my.dbf   spfileorcl.ora  tem.dbf
    [oracle@localhost dbs]$
    #修改 neworcl 的静态参数文件信息: initneworcl.ora
    [oracle@localhost dbs]$ vi initneworcl.ora
    
    [oracle@localhost dbs]$ cat initneworcl.ora
    
    #指定数据库名称
    db_name='NEWORCL'
    #指定数据库内存大小
    memory_target=300m
    #指定数据库进程数
    processes = 150
    #指定数据库审计的位置
    audit_file_dest='/u01/app/oracle/admin/neworcl/adump'
    #指定审计的级别: db 为数据库级别 
    audit_trail ='db'
    #指定数据库块的大小
    db_block_size=8192
    #数据库域的名称
    db_domain=''
    #闪回恢复区的位置
    db_recovery_file_dest='/u01/app/oracle/fast_recovery_area'
    #闪回恢复区的大小 
    db_recovery_file_dest_size=2G
    #adi 的目录 ;组件的资料库
    diagnostic_dest='/u01/app/oracle'
    # 协议
    dispatchers='(PROTOCOL=TCP) (SERVICE=ORCLXDB)'
    #游标的个数
    open_cursors=300
    #使用口令文件的方式
    remote_login_passwordfile='EXCLUSIVE'
    #undo 表空间的名称 
    undo_tablespace='UNDOTBS1'
    #控制文件:
    control_files = ('/u01/app/oracle/fast_recovery_area/neworcl/control01.ctl','/u01/app/oracle/oradata/neworcl/control02.ctl')
    #数据库版本 
    compatible ='11.2.0.3.0'
    [oracle@localhost dbs]$
    #创建口令文件  orapwneworcl
    [oracle@localhost dbs]$ ls
    dbsorapwPROD1  hc_PROD1.dat     init.ora      initPROD1.ora  lkPROD1  orapworcl       spfilePROD1.ora
    hc_orcl.dat    initneworcl.ora  initorcl.ora  lkORCL         my.dbf   spfileorcl.ora  tem.dbf
    [oracle@localhost dbs]$ orapwd file=orapwneworcl password=oracle
    [oracle@localhost dbs]$ ls
    dbsorapwPROD1  hc_PROD1.dat     init.ora      initPROD1.ora  lkPROD1  orapwneworcl  spfileorcl.ora   tem.dbf
    hc_orcl.dat    initneworcl.ora  initorcl.ora  lkORCL         my.dbf   orapworcl     spfilePROD1.ora
    [oracle@localhost dbs]$

    4:处理数据库启动的时候:ORA-01078, LRM-00123错误 ;原因是:

    原来在initneworcl.ora 的文件, 我自己在注释部分加入了中文.

    不能有中文呀, 连注释都不行.

    同时修改了 initneworcl.ora 文件的数据库名称为小写

    [oracle@localhost dbs]$ rlwrap sqlplus / as sysdba;
    
    SQL*Plus: Release 11.2.0.3.0 Production on Thu Jun 7 22:53:23 2018
    
    Copyright (c) 1982, 2011, Oracle.  All rights reserved.
    
    Connected to an idle instance.
    
    SYS@neworcl> startup nomount;
    ORA-01078: failure in processing system parameters
    LRM-00123: invalid character 135 found in the input file
    SYS@neworcl> quit
    Disconnected
    [oracle@localhost dbs]$ echo $ORACLE_SID
    neworcl
    [oracle@localhost dbs]$ cat initneworcl.ora
    
    #指定数据库名称
    db_name='neworcl'
    #指定数据库内存大小
    memory_target=300m
    #指定数据库进程数
    processes = 150
    #指定数据库审计的位置
    audit_file_dest='/u01/app/oracle/admin/neworcl/adump'
    #指定审计的级别: db 为数据库级别 
    audit_trail ='db'
    #指定数据库块的大小
    db_block_size=8192
    #数据库域的名称
    db_domain=''
    #闪回恢复区的位置
    db_recovery_file_dest='/u01/app/oracle/fast_recovery_area'
    #闪回恢复区的大小 
    db_recovery_file_dest_size=2G
    #adi 的目录 ;组件的资料库
    diagnostic_dest='/u01/app/oracle'
    # 协议
    dispatchers='(PROTOCOL=TCP) (SERVICE=ORCLXDB)'
    #游标的个数
    open_cursors=300
    #使用口令文件的方式
    remote_login_passwordfile='EXCLUSIVE'
    #undo 表空间的名称 
    undo_tablespace='UNDOTBS1'
    #控制文件:
    control_files = ('/u01/app/oracle/fast_recovery_area/neworcl/control01.ctl','/u01/app/oracle/oradata/neworcl/control02.ctl')
    #数据库版本 
    compatible ='11.2.0.3.0'
    [oracle@localhost dbs]$ export $ORACLE_SID =neworcl
    -bash: export: `=neworcl': not a valid identifier
    [oracle@localhost dbs]$ export $ORACLE_SID=neworcl
    [oracle@localhost dbs]$ echo $ORACLE_SID
    neworcl
    [oracle@localhost dbs]$ rlwrap sqlplus / as sysdba;
    
    SQL*Plus: Release 11.2.0.3.0 Production on Thu Jun 7 22:56:44 2018
    
    Copyright (c) 1982, 2011, Oracle.  All rights reserved.
    
    Connected to an idle instance.
    
    SYS@neworcl> startup nomount;
    ORA-01078: failure in processing system parameters
    LRM-00123: invalid character 135 found in the input file
    SYS@neworcl> quit
    Disconnected
    [oracle@localhost dbs]$ ls
    dbsorapwPROD1  hc_PROD1.dat     init.ora      initPROD1.ora  lkPROD1  orapwneworcl  spfileorcl.ora   tem.dbf
    hc_orcl.dat    initneworcl.ora  initorcl.ora  lkORCL         my.dbf   orapworcl     spfilePROD1.ora
    [oracle@localhost dbs]$ vi initneworcl.ora
    
    #指定数据库名称
    #指定数据库内存大小
    #指定数据库进程数
    #指定数据库审计的位置
    #指定审计的级别: db 为数据库级别 
    #指定数据库块的大小
    #数据库域的名称
    #闪回恢复区的位置
    #闪回恢复区的大小 
    #adi 的目录 ;组件的资料库
    # 协议
    #游标的个数
    #使用口令文件的方式
    #undo 表空间的名称 
    
    db_name='neworcl'
    memory_target=300m
    processes = 150
    audit_file_dest='/u01/app/oracle/admin/neworcl/adump'
    audit_trail ='db'
    db_block_size=8192
    db_domain=''
    db_recovery_file_dest='/u01/app/oracle/fast_recovery_area'
    db_recovery_file_dest_size=2G
    diagnostic_dest='/u01/app/oracle'
    dispatchers='(PROTOCOL=TCP) (SERVICE=ORCLXDB)'
    open_cursors=300
    remote_login_passwordfile='EXCLUSIVE'
    undo_tablespace='UNDOTBS1'
    control_files = ('/u01/app/oracle/fast_recovery_area/neworcl/control01.ctl','/u01/app/oracle/oradata/neworcl/control02.ctl')
    compatible ='11.2.0.3.0'
    ~
    "initneworcl.ora" 17L, 561C written
    [oracle@localhost dbs]$ rlwrap sqlplus / as sysdba;
    
    SQL*Plus: Release 11.2.0.3.0 Production on Thu Jun 7 22:58:08 2018
    
    Copyright (c) 1982, 2011, Oracle.  All rights reserved.
    
    Connected to an idle instance.
    
    SYS@neworcl> startup nomount;
    ORACLE instance started.
    
    Total System Global Area  313860096 bytes
    Fixed Size                  1344652 bytes
    Variable Size             209718132 bytes
    Database Buffers           96468992 bytes
    Redo Buffers                6328320 bytes
    SYS@neworcl> quit
    Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - Production
    With the Partitioning, OLAP, Data Mining and Real Application Testing options
    [oracle@localhost dbs]$ cat initneworcl.ora
    
    db_name='neworcl'
    memory_target=300m
    processes = 150
    audit_file_dest='/u01/app/oracle/admin/neworcl/adump'
    audit_trail ='db'
    db_block_size=8192
    db_domain=''
    db_recovery_file_dest='/u01/app/oracle/fast_recovery_area'
    db_recovery_file_dest_size=2G
    diagnostic_dest='/u01/app/oracle'
    dispatchers='(PROTOCOL=TCP) (SERVICE=ORCLXDB)'
    open_cursors=300
    remote_login_passwordfile='EXCLUSIVE'
    undo_tablespace='UNDOTBS1'
    control_files = ('/u01/app/oracle/fast_recovery_area/neworcl/control01.ctl','/u01/app/oracle/oradata/neworcl/control02.ctl')
    compatible ='11.2.0.3.0'
    [oracle@localhost dbs]$

    5:创建数据库,并检测数据创建情况

    ---进入sqlplus --启动数据库进入nomount状态--创建数据库
    [oracle@localhost dbs]$ rlwrap sqlplus / as sysdba;
    
    SQL*Plus: Release 11.2.0.3.0 Production on Thu Jun 7 23:03:38 2018
    
    Copyright (c) 1982, 2011, Oracle.  All rights reserved.
    
    Connected to an idle instance.
    
    SYS@neworcl> startup nomount;
    ORACLE instance started.
    
    Total System Global Area  313860096 bytes
    Fixed Size                  1344652 bytes
    Variable Size             209718132 bytes
    Database Buffers           96468992 bytes
    Redo Buffers                6328320 bytes
    SYS@neworcl> select instance_name ,status from v$intance;
    select instance_name ,status from v$intance
                                      *
    ERROR at line 1:
    ORA-01219: database not open: queries allowed on fixed tables/views only
    
    
    SYS@neworcl> select instance_name ,status from v$instance;
    
    INSTANCE_NAME    STATUS
    ---------------- ------------
    neworcl          STARTED
    
    SYS@neworcl> CREATE DATABASE neworcl
      2     LOGFILE GROUP 1 ('/u01/app/oracle/oradata/neworcl/redo01a.log','/u01/app/oracle/oradata/neworcl/redo01b.log') SIZE 100M BLOCKSIZE 512,
      3             GROUP 2 ('/u01/app/oracle/oradata/neworcl/redo02a.log','/u01/app/oracle/oradata/neworcl/redo02b.log') SIZE 100M BLOCKSIZE 512,
      4             GROUP 3 ('/u01/app/oracle/oradata/neworcl/redo03a.log','/u01/app/oracle/oradata/neworcl/redo03b.log') SIZE 100M BLOCKSIZE 512
      5     MAXLOGFILES 5
      6     MAXLOGMEMBERS 5
      7     MAXLOGHISTORY 1
      8     MAXDATAFILES 100
      9     CHARACTER SET US7ASCII
     10     NATIONAL CHARACTER SET AL16UTF16
     11     EXTENT MANAGEMENT LOCAL
     12     DATAFILE '/u01/app/oracle/oradata/neworcl/system01.dbf' SIZE 325M REUSE
     13     SYSAUX DATAFILE '/u01/app/oracle/oradata/neworcl/sysaux01.dbf' SIZE 325M REUSE
     14     DEFAULT TABLESPACE users
     15        DATAFILE '/u01/app/oracle/oradata/neworcl/users01.dbf'
     16        SIZE 500M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED
     17     DEFAULT TEMPORARY TABLESPACE tempts1
     18        TEMPFILE '/u01/app/oracle/oradata/neworcl/temp01.dbf'
     19        SIZE 20M REUSE
     20     UNDO TABLESPACE UNDOTBS1
     21        DATAFILE '/u01/app/oracle/oradata/neworcl/undotbs01.dbf'
     22        SIZE 200M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED;
    
    Database created.
    
    SYS@neworcl>
    

    新开一个窗口,来查看数据库创建的这些情况:

    [oracle@localhost neworcl]$ cd /u01/app/oracle/oradata/neworcl/
    [oracle@localhost neworcl]$ ls
    control02.ctl  redo01a.log  redo01b.log  redo02a.log  redo02b.log  redo03a.log  redo03b.log  sysaux01.dbf  system01.dbf
    [oracle@localhost neworcl]$ tail -f /u01/app/oracle/diag/rdbms/neworcl/neworcl/trace/alert_neworcl.log
    Completed: ALTER DATABASE DEFAULT TABLESPACE USERS
    processing ?/rdbms/admin/dfmap.bsq
    processing ?/rdbms/admin/denv.bsq
    processing ?/rdbms/admin/drac.bsq
    processing ?/rdbms/admin/dsec.bsq
    processing ?/rdbms/admin/doptim.bsq
    processing ?/rdbms/admin/dobj.bsq
    processing ?/rdbms/admin/djava.bsq
    processing ?/rdbms/admin/dpart.bsq
    processing ?/rdbms/admin/drep.bsq
    processing ?/rdbms/admin/daw.bsq
    processing ?/rdbms/admin/dsummgt.bsq
    processing ?/rdbms/admin/dtools.bsq
    processing ?/rdbms/admin/dexttab.bsq
    processing ?/rdbms/admin/ddm.bsq
    processing ?/rdbms/admin/dlmnr.bsq
    processing ?/rdbms/admin/ddst.bsq
    Thu Jun 07 23:19:56 2018
    SMON: enabling tx recovery
    Starting background process SMCO
    Thu Jun 07 23:19:56 2018
    SMCO started with pid=20, OS id=4736
    replication_dependency_tracking turned off (no async multimaster replication found)
    Starting background process QMNC
    Thu Jun 07 23:19:58 2018
    QMNC started with pid=21, OS id=4738
    Completed: CREATE DATABASE neworcl
       LOGFILE GROUP 1 ('/u01/app/oracle/oradata/neworcl/redo01a.log','/u01/app/oracle/oradata/neworcl/redo01b.log') SIZE 100M BLOCKSIZE 512,
               GROUP 2 ('/u01/app/oracle/oradata/neworcl/redo02a.log','/u01/app/oracle/oradata/neworcl/redo02b.log') SIZE 100M BLOCKSIZE 512,
               GROUP 3 ('/u01/app/oracle/oradata/neworcl/redo03a.log','/u01/app/oracle/oradata/neworcl/redo03b.log') SIZE 100M BLOCKSIZE 512
       MAXLOGFILES 5
       MAXLOGMEMBERS 5
       MAXLOGHISTORY 1
       MAXDATAFILES 100
       CHARACTER SET US7ASCII
       NATIONAL CHARACTER SET AL16UTF16
       EXTENT MANAGEMENT LOCAL
       DATAFILE '/u01/app/oracle/oradata/neworcl/system01.dbf' SIZE 325M REUSE
       SYSAUX DATAFILE '/u01/app/oracle/oradata/neworcl/sysaux01.dbf' SIZE 325M REUSE
       DEFAULT TABLESPACE users
          DATAFILE '/u01/app/oracle/oradata/neworcl/users01.dbf'
          SIZE 500M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED
       DEFAULT TEMPORARY TABLESPACE tempts1
          TEMPFILE '/u01/app/oracle/oradata/neworcl/temp01.dbf'
          SIZE 20M REUSE
       UNDO TABLESPACE UNDOTBS1
          DATAFILE '/u01/app/oracle/oradata/neworcl/undotbs01.dbf'
          SIZE 200M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED
    

    6:运行新的数据库脚本:

    image

    @?/rdbms/admin/catalog.sql 
    @?/rdbms/admin/catproc.sql
    @?/sqlplus/admin/pupbld.sql
    EXIT
    SYS@neworcl>
    SYS@neworcl> -- End of pupbld.sql
    ----当手工建库的脚本执行完毕后,查看数据库的状态:此时数据库的状态已经为 open  
    
    SYS@neworcl> select status from v$instance;
    
    STATUS
    ------------
    OPEN
    
    1 row selected.
    
    SYS@neworcl>

    7:当打开一个新的shh窗口的时候;进入 新建的数据库 neworcl 时的操作方法

    Last login: Thu Jun  7 22:35:12 2018 from 192.168.242.1
    [root@localhost ~]# su - oracle
    [oracle@localhost ~]$ cat .bash_profile
    # .bash_profile
    
    # Get the aliases and functions
    if [ -f ~/.bashrc ]; then
            . ~/.bashrc
    fi
    
    # User specific environment and startup programs
    
    PATH=$PATH:$HOME/bin
    
    
    export ORACLE_SID=orcl
    export ORACLE_BASE=/u01/app/oracle
    export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1
    export PATH=$PATH:$ORACLE_HOME/bin
    export ORACLE_TERM=xterm
    export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ORACLE_HOME/lib
    
    export CLASSPATH=$ORACLE_HOME/JRE:ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib
    [oracle@localhost ~]$ echo $ORACLE_SID
    orcl
    [oracle@localhost ~]$ export ORACLE_SID=neworcl
    [oracle@localhost ~]$ echo $ORACLE_SID
    neworcl
    [oracle@localhost ~]$ rlwrap sqlplus / as sysdba;
    
    SQL*Plus: Release 11.2.0.3.0 Production on Thu Jun 7 23:45:30 2018
    
    Copyright (c) 1982, 2011, Oracle.  All rights reserved.
    
    
    Connected to:
    Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - Production
    With the Partitioning, OLAP, Data Mining and Real Application Testing options
    
    SYS@neworcl> select instance_name,status from v$instance;
    
    INSTANCE_NAME    STATUS
    ---------------- ------------
    neworcl          OPEN
    
    SYS@neworcl>
    SYS@neworcl> ho ps -ef | grep orc
    oracle    4430     1  0 Jun07 ?        00:00:00 ora_pmon_neworcl
    oracle    4432     1  0 Jun07 ?        00:00:00 ora_psp0_neworcl
    oracle    4435     1  0 Jun07 ?        00:00:00 ora_vktm_neworcl
    oracle    4439     1  0 Jun07 ?        00:00:00 ora_gen0_neworcl
    oracle    4441     1  0 Jun07 ?        00:00:00 ora_diag_neworcl
    oracle    4443     1  0 Jun07 ?        00:00:00 ora_dbrm_neworcl
    oracle    4446     1  0 Jun07 ?        00:00:00 ora_dia0_neworcl
    oracle    4448     1  0 Jun07 ?        00:00:00 ora_mman_neworcl
    oracle    4450     1  0 Jun07 ?        00:00:02 ora_dbw0_neworcl
    oracle    4452     1  0 Jun07 ?        00:00:14 ora_lgwr_neworcl
    oracle    4455     1  0 Jun07 ?        00:00:00 ora_ckpt_neworcl
    oracle    4457     1  0 Jun07 ?        00:00:00 ora_smon_neworcl
    oracle    4459     1  0 Jun07 ?        00:00:00 ora_reco_neworcl
    oracle    4461     1  0 Jun07 ?        00:00:00 ora_mmon_neworcl
    oracle    4463     1  0 Jun07 ?        00:00:00 ora_mmnl_neworcl
    oracle    4465     1  0 Jun07 ?        00:00:00 ora_d000_neworcl
    oracle    4467     1  0 Jun07 ?        00:00:00 ora_s000_neworcl
    oracle    4736     1  0 Jun07 ?        00:00:00 ora_smco_neworcl
    oracle    4738     1  0 Jun07 ?        00:00:00 ora_qmnc_neworcl
    oracle    4746     1  0 Jun07 ?        00:00:00 ora_q000_neworcl
    oracle    4800     1  0 Jun07 ?        00:00:00 ora_cjq0_neworcl
    oracle    4900  4899  0 Jun07 ?        00:00:00 oracleneworcl (DESCRIPTION=(LOCAL=YES)(ADDRESS=(PROTOCOL=beq)))
    oracle    4909     1  0 Jun07 ?        00:00:00 ora_q002_neworcl
    oracle    4942     1  0 00:00 ?        00:00:00 ora_w000_neworcl
    oracle    5025     1  0 00:02 ?        00:00:00 ora_pmon_orcl
    oracle    5027     1  0 00:02 ?        00:00:00 ora_psp0_orcl
    oracle    5029     1  0 00:02 ?        00:00:00 ora_vktm_orcl
    oracle    5033     1  0 00:02 ?        00:00:00 ora_gen0_orcl
    oracle    5035     1  0 00:02 ?        00:00:00 ora_diag_orcl
    oracle    5037     1  0 00:02 ?        00:00:00 ora_dbrm_orcl
    oracle    5039     1  0 00:02 ?        00:00:00 ora_dia0_orcl
    oracle    5041     1  0 00:02 ?        00:00:00 ora_mman_orcl
    oracle    5043     1  0 00:02 ?        00:00:00 ora_dbw0_orcl
    oracle    5045     1  0 00:02 ?        00:00:00 ora_lgwr_orcl
    oracle    5047     1  0 00:02 ?        00:00:00 ora_ckpt_orcl
    oracle    5049     1  0 00:02 ?        00:00:00 ora_smon_orcl
    oracle    5051     1  0 00:02 ?        00:00:00 ora_reco_orcl
    oracle    5053     1  0 00:02 ?        00:00:00 ora_mmon_orcl
    oracle    5055     1  0 00:02 ?        00:00:00 ora_mmnl_orcl
    oracle    5057     1  0 00:02 ?        00:00:00 ora_d000_orcl
    oracle    5059     1  0 00:02 ?        00:00:00 ora_s000_orcl
    oracle    5083     1  0 00:02 ?        00:00:00 ora_arc0_orcl
    oracle    5085     1  0 00:02 ?        00:00:00 ora_arc1_orcl
    oracle    5087     1  0 00:02 ?        00:00:00 ora_arc2_orcl
    oracle    5089     1  0 00:02 ?        00:00:00 ora_qmnc_orcl
    oracle    5105     1  0 00:02 ?        00:00:00 ora_cjq0_orcl
    oracle    5107     1  0 00:03 ?        00:00:00 ora_vkrm_orcl
    oracle    5109     1  0 00:03 ?        00:00:00 ora_q000_orcl
    oracle    5111     1  0 00:03 ?        00:00:00 ora_q001_orcl
    oracle    5155     1  0 00:07 ?        00:00:00 ora_smco_orcl
    oracle    5157     1  0 00:07 ?        00:00:00 ora_w000_orcl
    oracle    5183  4899  0 00:11 pts/3    00:00:00 /bin/bash -c ps -ef | grep orc
    oracle    5185  5183  0 00:11 pts/3    00:00:00 grep orc
    
    SYS@neworcl>

    三:查看内存信息

    SYS@orcl> desc v$memory_dynamic_components
     Name                                      Null?    Type
     ----------------------------------------- -------- ----------------------------
     COMPONENT                                          VARCHAR2(64)
     CURRENT_SIZE                                       NUMBER
     MIN_SIZE                                           NUMBER
     MAX_SIZE                                           NUMBER
     USER_SPECIFIED_SIZE                                NUMBER
     OPER_COUNT                                         NUMBER
     LAST_OPER_TYPE                                     VARCHAR2(13)
     LAST_OPER_MODE                                     VARCHAR2(9)
     LAST_OPER_TIME                                     DATE
     GRANULE_SIZE                                       NUMBER
    
    SYS@orcl> col COMPONENT for a30;
    SYS@orcl> set linesize 300;
    
    SYS@orcl> select COMPONENT ,CURRENT_SIZE/1024/1024 , MAX_SIZE/1024/1024  from v$memory_dynamic_components ;
    
    COMPONENT                      CURRENT_SIZE/1024/1024 MAX_SIZE/1024/1024
    ------------------------------ ---------------------- ------------------
    shared pool                                       180                180
    large pool                                          4                  4
    java pool                                           4                  4
    streams pool                                        4                  4
    SGA Target                                        328                328
    DEFAULT buffer cache                               96                 96
    KEEP buffer cache                                   0                  0
    RECYCLE buffer cache                                0                  0
    DEFAULT 2K buffer cache                            16                 16
    DEFAULT 4K buffer cache                             0                  0
    DEFAULT 8K buffer cache                             0                  0
    
    COMPONENT                      CURRENT_SIZE/1024/1024 MAX_SIZE/1024/1024
    ------------------------------ ---------------------- ------------------
    DEFAULT 16K buffer cache                           16                 16
    DEFAULT 32K buffer cache                            0                  0
    Shared IO Pool                                      0                  0
    PGA Target                                        172                184
    ASM Buffer Cache                                    0                  0
    
    16 rows selected.
    
    SYS@orcl>

    ——————————————————————————————————————————————————————————————————————————————-——————————

  • 相关阅读:
    greenplum导数据
    greenplum 集群部署
    jmx远程访问权限设置
    分布式实时日志处理平台ELK
    hbase0.95.2部署
    hadoop2.2.0部署
    highcharts
    FreeMarker
    使用solr的完整流程
    solr搜索流程
  • 原文地址:https://www.cnblogs.com/ios9/p/9152965.html
Copyright © 2020-2023  润新知