zoukankan      html  css  js  c++  java
  • 最简单的oracle10g手工建库步骤

    最简单的oracle10g手工建库步骤
    平台:Linux AS release 4,Oracle10.2.0.4
    db_name = ypythb

    1. 设置环境变量
    $ export ORACLE_BASE=/oracle
    $ export ORACLE_HOME=/oracle/product/10.2
    $ export ORACLE_SID=ypythb

    2. 建初始化参数文件
    $ vi $ORACLE_HOME/dbs/initypythb.ora
    #以下为建库必需参数
    control_files=(/oradata/ypythb/control1.ctl,/oradata/ypythb/control2.ctl,/oradata/ypythb/control3.ctl)
    undo_management=AUTO
    undo_tablespace=UNDOTBS1
    db_name=ypythb
    db_unique_name = ypythb
    db_block_size=8192
    sga_max_size=2000M
    sga_target=3000M
    audit_file_dest=/oracle/admin/ypythb/adump
    background_dump_dest=/oracle/admin/ypythb/bdump
    core_dump_dest=/oracle/admin/ypythb/cdump
    user_dump_dest=/oracle/admin/ypythb/udump
    open_cursors=1500
    processes=500

    3. 建立密码文件
    $ $ORACLE_HOME/bin/orapwd file=$ORACLE_HOME/dbs/orapwypythb password=oracle force=y

    4. 建立需要的目录
    $ rm -rf $ORACLE_BASE/admin/$ORACLE_SID
    $ mkdir -p $ORACLE_BASE/admin/$ORACLE_SID/adump
    mkdir -p $ORACLE_BASE/admin/$ORACLE_SID/bdump
    mkdir -p $ORACLE_BASE/admin/$ORACLE_SID/cdump
    mkdir -p $ORACLE_BASE/admin/$ORACLE_SID/dpdump
    mkdir -p $ORACLE_BASE/admin/$ORACLE_SID/udump
    mkdir -p $ORACLE_BASE/admin/$ORACLE_SID/pfile

    5. 建spfile后启动实例并开始建库
    $ sqlplus '/as sysdba'
    SQL> create spfile from pfile;   (会自动读取pfile:$ORACLE_HOME/dbs/init$ORACLE_SID.ora)
    SQL> startup nomount
    SQL> create database ypythb CONTROLFILE REUSE
       MAXINSTANCES 8 MAXDATAFILES 100
       MAXLOGHISTORY 1 MAXLOGFILES 16 MAXLOGMEMBERS 5  
       character set UTF8 national character set UTF8
       logfile group 1 ('/oradata/ypythb/redo1.log') size 200M reuse,
       group 2 ('/oradata/ypythb/redo2.log') size 200M reuse,
       group 3 ('/oradata/ypythb/redo3.log') size 200M reuse
    datafile '/oradata/ypythb/system.dbf' size 1024M reuse autoextend on next 100M maxsize unlimited extent management local
    sysaux datafile '/oradata/ypythb/sysaux.dbf' size 1024M autoextend on next 100M maxsize unlimited
    default temporary tablespace temp tempfile '/oradata/ypythb/temp01.dbf' size 100M reuse autoextend on next 10M maxsize unlimited
    undo tablespace undotbs1 datafile '/oradata/ypythb/undotbs1.dbf' size 100M reuse autoextend on next 10M maxsize unlimited
    USER SYS IDENTIFIED BY "oracle" USER SYSTEM IDENTIFIED BY "oracle";

    6. 运行数据字典脚本,其中catalog和catproc是必需的,其它可选:
    SQL> spool /oradata/cat_ypythb.log
    SQL> @?/rdbms/admin/catalog.sql       (建数据字典视图)
    SQL> @?/rdbms/admin/catproc.sql       (建存储过程包)
    SQL> @?/rdbms/admin/catblock.sql   (建锁相关的几个视图)
    SQL> @?/rdbms/admin/catoctk.sql       (建密码工具包dbms_crypto_toolkit)
    SQL> @?/rdbms/admin/owminst.plb       (建工作空间管理相关对象,如dmbs_wm)
    SQL> spool off
    执行完后检查/orahome/cat.log看看有什么不可接受的错误没有。

    7. 新建sqlplus属性和帮助、USERS表空间
    SQL> connect system/oracle
    SQL> @?/sqlplus/admin/pupbld.sql
    SQL> @?/sqlplus/admin/help/hlpbld.sql helpus.sql
    SQL> connect /as sysdba
    SQL> CREATE TABLESPACE USERS LOGGING DATAFILE '/oradata/ypythb/users01.dbf' SIZE 1024M REUSE AUTOEXTEND ON NEXT 100m MAXSIZE UNLIMITED EXTENT MANAGEMENT LOCAL SEGMENT SPACE MANAGEMENT AUTO;
    SQL> ALTER DATABASE DEFAULT TABLESPACE USERS;

    8. 最后修改为归档模式并重启
    SQL> shutdown immediate;
    SQL> connect /as sysdba
    SQL> startup mount
    SQL> alter database archivelog;
    SQL> alter database open;
    重新编译所有失效过程:
    SQL> execute utl_recomp.recomp_serial();

    9、建立和配置EM(可选):
    SQL> @?/sysman/admin/emdrep/sql/emreposcre /oracle/product/10.2 SYSMAN oracle TEMP ON;
    SQL> alter user SYSMAN identified by "sysman" account unlock;
    SQL> alter user DBSNMP identified by "dbsnmp" account unlock;
    SQL> host emca -config dbcontrol db -silent -DB_UNIQUE_NAME ypyhtb -PORT 1521 -EM_HOME /oracle/product/10.2/bin -LISTENER LISTENER -SERVICE_NAME ypythb.LK -SYS_PWD "oracle" -SID ypythb -ORACLE_HOME /oracle/product/10.2 -DBSNMP_PWD "dbsnmp" -HOST "172.19.201.184" -LISTENER_OH /oracle/product/10.2 -LOG_FILE /oradata/ypythb/emConfig.log -SYSMAN_PWD "sysman";

    到此建库完毕!

  • 相关阅读:
    Flask-上传文件和访问上传的文件
    苹果审核加急信
    iTunes Connect 协议更新
    iOS 关于Xcode上的Other linker flags
    cocoaPods
    iOS 支付宝的集成与遇到的问题
    iOS中app在iTunes中更新版本流程
    iOS集成支付宝问题
    iOS 获取键盘下落速度
    iosMD5加密和base64加密
  • 原文地址:https://www.cnblogs.com/caibird2005/p/1597261.html
Copyright © 2011-2022 走看看