当前位置: 首页 > Linux, Oracle, oracle 11g > 正文

LINUX环境下静默建库ORACLE11gR2

实验名称:ORACLE静默建库。
实验环境:OEL5.4 ORACLE11gR2
刚做了ORACLE11gR2在OEL5.4平台的静默安装(http://www.dbdream.com.cn/2012/03/03/linux%E7%8E%AF%E5%A2%83%E4%B8%8B%E9%9D%99%E9%BB%98%E5%AE%89%E8%A3%85oracle11gr2%E6%95%B0%E6%8D%AE%E5%BA%93%E8%BD%AF%E4%BB%B6/),现在在此环境下做下ORACLE静默建库的实验,实验过程如下:
1.修改responseFile文件的以下内容:

[oracle@stream ~]$ vi database/response/dbca.rsp
RESPONSEFILE_VERSION = "11.2.0"
OPERATION_TYPE = "createDatabase"
GDBNAME = "STREAM"
SID = "stream"
TEMPLATENAME = "New_Database.dbt"
SYSPASSWORD = "oracle"
SYSTEMPASSWORD = "oracle"
SYSMANPASSWORD = "oracle"
DBSNMPPASSWORD = "oracle"
DATAFILEDESTINATION ="/u01/app/oracle/oradata/stream"
STORAGETYPE=FS
CHARACTERSET = "ZHS16GBK"
NATIONALCHARACTERSET= "AL16UTF16"
DATABASETYPE = "MULTIPURPOSE"
AUTOMATICMEMORYMANAGEMENT = "FALSE"

以上参数的含义如下:

RESPONSEFILE_VERSION:数据库版本信息。
OPERATION_TYPE:执行操作类型:创建数据库、根据DB创建模板、
创建克隆模板、删除数据库、配置数据库、添加实例(RAC环境下)、
删除实例(RAC环境下)
GDBNAME:指定Global Name
SID:指定SID
TEMPLATENAME:模板名称
SYSPASSWORD:SYS用户密码
SYSTEMPASSWORD:SYSTEM用户密码
SYSMANPASSWORD:SYSMAN用户的密码,当EM管理类型选择local的时候需要
DBSNMPPASSWORD:DBS的密码,当EM设置了之后需要
DATAFILEDESTINATION:数据库文件的存放目录
STORAGETYPE:数据库要创建在何种文件类型FS、ASM等
CHARACTERSET:数据库字符集
NATIONALCHARACTERSET:国家字符集
DATABASETYPE:指定数据库的类型,有OLTP或者warehouse
AUTOMATICMEMORYMANAGEMENT:是否开启AMM内存自动管理

2.配置好responseFile文件以后,就可以开始静默安装了。

[oracle@stream database]$ dbca -silent -responseFile
/home/oracle/database/response/dbca.rsp
Copying database files
1% complete
3% complete
37% complete
Creating and starting Oracle instance
40% complete
45% complete
50% complete
55% complete
56% complete
60% complete
62% complete
Completing Database Creation
66% complete
70% complete
73% complete
85% complete
96% complete
100% complete
Look at the log file "/u01/app/oracle/cfgtoollogs/dbca/STREAM/
STREAM.log" for further details.
数据库创建完成后,登录数据库,验证是否成功创建。
[oracle@stream database]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on Thu Mar 1 10:44:40 2012
Copyright (c) 1982, 2009, Oracle.  All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0-Production
With the Partitioning, OLAP, Data Mining and Real Application

SQL> select status,instance_name from v$instance;

STATUS       INSTANCE_NAME
------------ ----------------
OPEN         stream
SQL> select name,OPEN_MODE,CURRENT_SCN,DBID,CREATED from v$database;

NAME      OPEN_MODE            DBID CREATED
--------- -------------------- ---------- ---------
STREAM    READ WRITE           1542802256 01-MAR-12
SQL> select * from v$version;

BANNER
----------------------------------------------------------------
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 -
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> show parameter spfile

NAME       TYPE        VALUE
---------- ----------- ------------------------------
spfile     string      /u01/app/oracle/product/11.2.0
/dbhome_1/dbs/spfilestream.ora
SQL> select name from v$datafile;

NAME
--------------------------------------------------
/u01/app/oracle/oradata/stream/STREAM/system01.dbf
/u01/app/oracle/oradata/stream/STREAM/sysaux01.dbf
/u01/app/oracle/oradata/stream/STREAM/undotbs01.dbf
/u01/app/oracle/oradata/stream/STREAM/users01.dbf
SQL> select * from v$tablespace;

       TS# NAME                           INC BIG FLA ENC
---------- ------------------------------ --- --- --- ---
         0 SYSTEM                         YES NO  YES
         1 SYSAUX                         YES NO  YES
         2 UNDOTBS1                       YES NO  YES
         4 USERS                          YES NO  YES
         3 TEMP                           NO  NO  YES
SQL> show parameter control_files

NAME          TYPE      VALUE
------------- --------- ------------------------------
control_files string    /u01/app/oracle/oradata/stream
                        /STREAM/control01.ctl, /u01/ap
                        p/oracle/flash_recovery_area/S
                        TREAM/control02.ctl
SQL> select GROUP#,SEQUENCE#,BYTES,MEMBERS,STATUS from v$log;

    GROUP#  SEQUENCE#      BYTES    MEMBERS STATUS
---------- ---------- ---------- ---------- --------
         1          4   52428800          1 INACTIVE
         2          5   52428800          1 CURRENT
         3          3   52428800          1 INACTIVE

由于设置了AUTOMATICMEMORYMANAGEMENT = “FALSE”,所以数据库AMM自动内存管理没有使用。AMM是ORACLE11g的新特性,自动管理SGA+PGA部分的内存。

SQL> show parameter memory_

NAME                      TYPE        VALUE
------------------------  ----------- -----
hi_shared_memory_address  integer     0
memory_max_target         big integer 0
memory_target             big integer 0
shared_memory_address     integer     0

3.静默配置监听。
如果使用DBCA图形界面创建数据库,在安装玩数据库软件后就需要创建监听,如果使用静默的方式创建数据库,则可以在创建数据库之后创建监听,静默创建监听也很简单,值需要修改$ORACLE_HOME/network/admin/ listener.ora文件即可,初始没有这个文件,需要手动创建。

[oracle@stream admin]$ vi listener.ora
LISTENER =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = stream)(PORT = 1521))
  )

只需要在listener.ora文件里加入上面几行信息,即可启动监听。

[oracle@stream admin]$ lsnrctl start

在远程客户端的tnsnames.ora文件中加入以下内容。

STREAM_TEST =
  (DESCRIPTION =
    (ADDRESS_LIST =
  (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.60.130)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SERVICE_NAME = stream)
    )
  )

远程客户端登录数据库测试。

D:Administrator>sqlplus system/ORACLE@STREAM_TEST

SQL*Plus: Release 11.2.0.1.0 Production on 星期四 3月 1 11:52:13 2012
Copyright (c) 1982, 2010, Oracle.  All rights reserved.
连接到:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application

SQL> SHOW PARAMETER NAME

NAME                     TYPE        VALUE
------------------------ ----------- ------
db_file_name_convert     string
db_name                  string      STREAM
db_unique_name           string      STREAM
global_names             boolean     FALSE
instance_name            string      stream
lock_name_space          string
log_file_name_convert    string
service_names            string      STREAM
SQL> SELECT DBID FROM V$DATABASE;

      DBID
----------
1542802256

上文查过静默安装的数据库DBID为1542802256,证明数据库连接正确,静默配置的监听好用。

本文固定链接: http://www.dbdream.com.cn/2012/03/linux%e7%8e%af%e5%a2%83%e4%b8%8b%e9%9d%99%e9%bb%98%e5%bb%ba%e5%ba%93oracle11gr2/ | 信春哥,系统稳,闭眼上线不回滚!

该日志由 dbdream 于2012年03月03日发表在 Linux, Oracle, oracle 11g 分类下, 你可以发表评论,并在保留原文地址及作者的情况下引用到你的网站或博客。
原创文章转载请注明: LINUX环境下静默建库ORACLE11gR2 | 信春哥,系统稳,闭眼上线不回滚!
关键字: ,

LINUX环境下静默建库ORACLE11gR2:等您坐沙发呢!

发表评论

快捷键:Ctrl+Enter