Chinaunix首页 | 论坛 | 博客
  • 博客访问: 3197699
  • 博文数量: 443
  • 博客积分: 11301
  • 博客等级: 上将
  • 技术积分: 5679
  • 用 户 组: 普通用户
  • 注册时间: 2004-10-08 12:30
个人简介

欢迎加入IT云增值在线QQ交流群:342584734

文章分类

全部博文(443)

文章存档

2022年(1)

2021年(1)

2015年(2)

2014年(1)

2013年(1)

2012年(4)

2011年(19)

2010年(32)

2009年(2)

2008年(4)

2007年(31)

2006年(301)

2005年(42)

2004年(2)

分类:

2007-05-09 22:39:31

ZFS是SUN Solaris 10的下一代文件存储解决方案,ZFS即Zettabyte File System,也叫动态文件系统Dynamic File System, 是第一个128位文件系统,无限容量、自优化、数据永远保持一致,并且管理简单.
ZFS不仅支持基于文件系统方式的访问,也支持基于卷(裸设备)方式的访问,加上ZFS的不断完善和成熟,基本上可以取代传统的磁盘管理软件,如Solairs Volume Manager和Veritas Volume Manager.本文将介绍如何在Solaris 10 ZFS上安装Oracle 9i.
基本需求:
- 将Oracle程序文件安装在zfs文件系统上.
- 将数据库data file安装在zfs裸卷上.
step1. 创建pool和zfs文件系统及祼卷.
  # zpool create ora_pool c0t4d0
  # zfs create -V 210m   ora_pool/controlfile01_200m
  # zfs create -V 210m   ora_pool/controlfile02_200m
  # zfs create -V 210m   ora_pool/controlfile03_200m
  # zfs create -V 4010m  ora_pool/index01_4000m
  # zfs create -V 410m   ora_pool/redo1_01_400m
  # zfs create -V 410m   ora_pool/redo2_01_400m
  # zfs create -V 410m   ora_pool/redo3_01_400m 
  # zfs create -V 810m   ora_pool/system_800m                 
  # zfs create -V 1010m  ora_pool/tools_1000m                 
  # zfs create -V 4010m  ora_pool/undotbs1_01_4000m      
  # zfs create -V 4010m  ora_pool/users01_4000m
  ZFS卷提供了类似于VxVM卷的路径名供引用:
  /dev/zvol/[r]dsk//
  # zfs create ora_pool/oracle
  # zfs set mountpoint=/opt/oracle ora_pool/oracle
step2. 创建oracle用户及dba组,设置基本的环境变量.
  # groupadd dba
  # useradd -d /opt/oracle -g dba -s /bin/sh -m oracle
  # passwd oracle
  # ORACLE_BASE=/opt/oracle; export ORACLE_BASE
  # ORACLE_HOME=$ORACLE_BASE/product/9.2; export ORACLE_HOME
  # ORACLE_SID=ora9; export ORACLE_SID
  # chown oracle:dba /dev/zvol/rdsk/ora_pool/*
  # chmod 600 /dev/zvol/rdsk/ora_pool/*
step3. 基于项目管理方式,为oracle分配系统资源如最大共享内存、信号灯等.
  # projadd -U oracle -p 1233 -c "oracle parameters setting" user.oracle
  # projmod -a -K "project.max-shm-memory=(priv,17179869184,deny)" user.oracle (为物理内存的1/2,单位为字节)
  # projmod -a -K "project.max-sem-ids=(priv,2000,deny)" user.oracle
  # projmod -a -K "process.max-sem-nsems=(priv,2048,deny)" user.oracle
  # projmod -a -K "project.max-shm-ids=(priv,256,deny)" user.oracle
step4. 安装Oracle程序(过程略).
step5. 利用脚本方式创建新数据库.
  oracle> cat $ORACLE_BASE/admin/ora9/scripts/ora9.sh
  #!/bin/sh
  mkdir /opt/oracle/admin/ora9/bdump
  mkdir /opt/oracle/admin/ora9/cdump
  mkdir /opt/oracle/admin/ora9/create
  mkdir /opt/oracle/admin/ora9/pfile
  mkdir /opt/oracle/admin/ora9/udump
  mkdir /opt/oracle/oradata/ora9
  mkdir /opt/oracle/product/9.2/dbs
  export ORACLE_SID ora9
  export PATH=$PATH:/opt/oracle/product/9.2/bin/
  echo Add this entry in the oratab: ora9:/opt/oracle/product/9.2:Y
  orapwd file=/opt/oracle/product/9.2/dbs/orapwora9  password=change_on_install
  sqlplus /nolog @/opt/oracle/admin/ora9/scripts/CreateDB.sql
  sqlplus /nolog @/opt/oracle/admin/ora9/scripts/CreateDBFiles.sql
  sqlplus /nolog @/opt/oracle/admin/ora9/scripts/CreateDBCatalog.sql
  sqlplus /nolog @/opt/oracle/admin/ora9/scripts/postDBCreation.sql
  oracle> cat $ORACLE_BASE/admin/ora9/scripts/CreateDB.sql
  connect SYS/change_on_install as SYSDBA
  set echo on
  spool /opt/oracle/product/9.2/assistants/dbca/logs/CreateDB.log
  startup nomount pfile="/opt/oracle/admin/ora9/scripts/init.ora";
  CREATE DATABASE ora9
  MAXINSTANCES 1
  MAXLOGHISTORY 1
  MAXLOGFILES 5
  MAXLOGMEMBERS 3
  MAXDATAFILES 100
  DATAFILE '/dev/zvol/rdsk/ora_pool/system_800m' SIZE 800M REUSE
  EXTENT MANAGEMENT LOCAL
  DEFAULT TEMPORARY TABLESPACE TEMP TEMPFILE '/dev/zvol/rdsk/ora_pool/temp01_4000m' SIZE 4000M REUSE
  UNDO TABLESPACE "UNDOTBS1" DATAFILE '/dev/zvol/rdsk/ora_pool/undotbs1_01_4000m' SIZE 4000M REUSE
  CHARACTER SET UTF8
  NATIONAL CHARACTER SET AL16UTF16
  LOGFILE GROUP 1 ('/dev/zvol/rdsk/ora_pool/redo1_01_400m') SIZE 400M,
  GROUP 2 ('/dev/zvol/rdsk/ora_pool/redo2_01_400m') SIZE 400M,
  GROUP 3 ('/dev/zvol/rdsk/ora_pool/redo3_01_400m') SIZE 400M;
  spool off
  exit;
  oracle> cat $ORACLE_BASE/admin/ora9/scripts/CreateDBFiles.sql
  connect SYS/change_on_install as SYSDBA
  set echo on
  spool /opt/oracle/product/9.2/assistants/dbca/logs/CreateDBFiles.log
  CREATE TABLESPACE "INDX" LOGGING DATAFILE '/dev/zvol/rdsk/ora_pool/index01_4000m' SIZE 4000M REUSE EXTENT MANAGEMENT LOCAL SEGMENT SPACE MANAGEMENT  AUTO ;
  CREATE TABLESPACE "TOOLS" LOGGING DATAFILE '/dev/zvol/rdsk/ora_pool/tools_1000m' SIZE 1000M REUSE EXTENT MANAGEMENT LOCAL SEGMENT SPACE MANAGEMENT  AUTO ;
  CREATE TABLESPACE "USERS" LOGGING DATAFILE '/dev/zvol/rdsk/ora_pool/users01_4000m' SIZE 4000M REUSE EXTENT MANAGEMENT LOCAL SEGMENT SPACE MANAGEMENT  AUTO ;
  spool off
  exit;
  oracle> cat $ORACLE_BASE/admin/ora9/scripts/postDBCreation.sql
  connect SYS/change_on_install as SYSDBA
  set echo on
  spool /opt/oracle/product/9.2/assistants/dbca/logs/postDBCreation.log
  @/opt/oracle/product/9.2/rdbms/admin/utlrp.sql;
  shutdown ;
  connect SYS/change_on_install as SYSDBA
  set echo on
  spool /opt/oracle/product/9.2/assistants/dbca/logs/postDBCreation.log
  create spfile='/dev/zvol/rdsk/ora_pool/spfile_30m' FROM pfile='/opt/oracle/admin/ora9/scripts/init.ora';
  startup ;
step6. 启动数据库.
  oracle> cat /opt/oracle/product/9.2/dbs/initora9.ora
  spfile='/dev/zvol/rdsk/ora_pool/spfile_30m'
  oracle> echo "ora9:/opt/oracle/product/9.2:Y" >> /var/opt/oracle/oratab
  oracle> sqlplus "/as sysdba"
  sql> startup pfile='/opt/oracle/admin/ora9/scripts/init.ora
  sql> create spfile='/dev/zvol/rdsk/ora_pool/spfile_30m' FROM pfile='/opt/oracle/admin/ora9/scripts/init.ora';
  sql> shutdown immediate;
  sql> startup pfile='/opt/oracle/product/9.2/dbs/initora9.ora'
  sql> show parameters spfile;
   NAME        TYPE       VALUE
   --------    -----     ---------
   spfile      string    /dev/zvol/rdsk/ora_pool/spfile_30m
  SQL> select name from v$datafile;
  NAME
  --------------------------------------------------
  /dev/zvol/rdsk/ora_pool/system_800m
  /dev/zvol/rdsk/ora_pool/undotbs1_01_4000m
  /dev/zvol/rdsk/ora_pool/index01_4000m
  /dev/zvol/rdsk/ora_pool/tools_1000m
  /dev/zvol/rdsk/ora_pool/users01_4000m
阅读(4524) | 评论(2) | 转发(1) |
给主人留下些什么吧!~~